This wires up the previously added OEM strings XML schema to be able to
generate comamnd line args for QEMU. This requires QEMU >= 2.12 release
containing this patch:
commit 2d6dcbf93fb01b4a7f45a93d276d4d74b16392dd
Author: Daniel P. Berrange <berrange@redhat.com>
Date: Sat Oct 28 21:51:36 2017 +0100
smbios: support setting OEM strings table
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
---
src/qemu/qemu_command.c | 28 ++++++++++++++++++++++++++++
tests/qemuxml2argvdata/smbios.args | 2 ++
tests/qemuxml2argvdata/smbios.xml | 5 +++++
tests/qemuxml2xmloutdata/smbios.xml | 5 +++++
4 files changed, 40 insertions(+)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index b8aede32d2..96bd0ad8ee 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6142,6 +6142,26 @@ qemuBuildSmbiosBaseBoardStr(virSysinfoBaseBoardDefPtr def)
}
+static char *
+qemuBuildSmbiosOEMStringsStr(virSysinfoOEMStringsDefPtr def)
+{
+ virBuffer buf = VIR_BUFFER_INITIALIZER;
+ size_t i;
+
+ if (!def)
+ return NULL;
+
+ virBufferAddLit(&buf, "type=11");
+
+ for (i = 0; i < def->nvalues; i++) {
+ virBufferAddLit(&buf, ",value=");
+ virQEMUBuildBufferEscapeComma(&buf, def->values[i]);
+ }
+
+ return virBufferContentAndReset(&buf);
+}
+
+
static int
qemuBuildSmbiosCommandLine(virCommandPtr cmd,
virQEMUDriverPtr driver,
@@ -6212,6 +6232,14 @@ qemuBuildSmbiosCommandLine(virCommandPtr cmd,
virCommandAddArgList(cmd, "-smbios", smbioscmd, NULL);
VIR_FREE(smbioscmd);
}
+
+ if (source->oemStrings) {
+ if (!(smbioscmd = qemuBuildSmbiosOEMStringsStr(source->oemStrings)))
+ return -1;
+
+ virCommandAddArgList(cmd, "-smbios", smbioscmd, NULL);
+ VIR_FREE(smbioscmd);
+ }
}
return 0;
diff --git a/tests/qemuxml2argvdata/smbios.args b/tests/qemuxml2argvdata/smbios.args
index 3d94a109f9..d27d436a3a 100644
--- a/tests/qemuxml2argvdata/smbios.args
+++ b/tests/qemuxml2argvdata/smbios.args
@@ -17,6 +17,8 @@ serial=32dfcb37-5af1-552b-357c-be8c3aa38310,\
uuid=c7a5fdbd-edaf-9455-926a-d65c16db1809,sku=1234567890,family=Red Hat' \
-smbios 'type=2,manufacturer=Hewlett-Packard,product=0B4Ch,version=D,\
serial=CZC1065993,asset=CZC1065993,location=Upside down' \
+-smbios 'type=11,value=Hello,value=World,value=This is,,\
+ more tricky value=escaped' \
-nographic \
-nodefaults \
-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
diff --git a/tests/qemuxml2argvdata/smbios.xml b/tests/qemuxml2argvdata/smbios.xml
index c12477dcb5..319bdf61df 100644
--- a/tests/qemuxml2argvdata/smbios.xml
+++ b/tests/qemuxml2argvdata/smbios.xml
@@ -26,6 +26,11 @@
<entry name='asset'>CZC1065993</entry>
<entry name='location'>Upside down</entry>
</baseBoard>
+ <oemStrings>
+ <entry>Hello</entry>
+ <entry>World</entry>
+ <entry>This is, more tricky value=escaped</entry>
+ </oemStrings>
</sysinfo>
<os>
<type arch='i686' machine='pc'>hvm</type>
diff --git a/tests/qemuxml2xmloutdata/smbios.xml b/tests/qemuxml2xmloutdata/smbios.xml
index d21f6275f0..cbe616c7da 100644
--- a/tests/qemuxml2xmloutdata/smbios.xml
+++ b/tests/qemuxml2xmloutdata/smbios.xml
@@ -26,6 +26,11 @@
<entry name='asset'>CZC1065993</entry>
<entry name='location'>Upside down</entry>
</baseBoard>
+ <oemStrings>
+ <entry>Hello</entry>
+ <entry>World</entry>
+ <entry>This is, more tricky value=escaped</entry>
+ </oemStrings>
</sysinfo>
<os>
<type arch='i686' machine='pc'>hvm</type>
--
2.14.3
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
On 01/17/2018 12:37 PM, Daniel P. Berrange wrote: > This wires up the previously added OEM strings XML schema to be able to > generate comamnd line args for QEMU. This requires QEMU >= 2.12 release > containing this patch: > > commit 2d6dcbf93fb01b4a7f45a93d276d4d74b16392dd > Author: Daniel P. Berrange <berrange@redhat.com> > Date: Sat Oct 28 21:51:36 2017 +0100 > > smbios: support setting OEM strings table > > Signed-off-by: Daniel P. Berrange <berrange@redhat.com> > --- > src/qemu/qemu_command.c | 28 ++++++++++++++++++++++++++++ > tests/qemuxml2argvdata/smbios.args | 2 ++ > tests/qemuxml2argvdata/smbios.xml | 5 +++++ > tests/qemuxml2xmloutdata/smbios.xml | 5 +++++ > 4 files changed, 40 insertions(+) > Would a QEMU < 2.12 cause a failure if the 'type=11' OEM strings were provided or do we need to add a capability in virQEMUCapsInitQMPMonitor based on version? What's here looks good and the provisional Reviewed-by: John Ferlan <jferlan@redhat.com> if we don't need the capability. If we need it, then probably need to update the patch. John -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
On Thu, Jan 25, 2018 at 09:04:05AM -0500, John Ferlan wrote: > > > On 01/17/2018 12:37 PM, Daniel P. Berrange wrote: > > This wires up the previously added OEM strings XML schema to be able to > > generate comamnd line args for QEMU. This requires QEMU >= 2.12 release > > containing this patch: > > > > commit 2d6dcbf93fb01b4a7f45a93d276d4d74b16392dd > > Author: Daniel P. Berrange <berrange@redhat.com> > > Date: Sat Oct 28 21:51:36 2017 +0100 > > > > smbios: support setting OEM strings table > > > > Signed-off-by: Daniel P. Berrange <berrange@redhat.com> > > --- > > src/qemu/qemu_command.c | 28 ++++++++++++++++++++++++++++ > > tests/qemuxml2argvdata/smbios.args | 2 ++ > > tests/qemuxml2argvdata/smbios.xml | 5 +++++ > > tests/qemuxml2xmloutdata/smbios.xml | 5 +++++ > > 4 files changed, 40 insertions(+) > > > > Would a QEMU < 2.12 cause a failure if the 'type=11' OEM strings were > provided or do we need to add a capability in virQEMUCapsInitQMPMonitor > based on version? Yes it will $ qemu-system-x86_64 -smbios type=11 qemu-system-x86_64: -smbios type=11: Don't know how to build fields for SMBIOS type 11 Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
© 2016 - 2025 Red Hat, Inc.