[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] qemu: add support for setting OEM strings SMBIOS data fields



On Fri, Nov 17, 2017 at 04:48:53PM +0000, Daniel P. Berrange wrote:
The OEM strings table in SMBIOS allows the vendor to pass arbitrary strings
into the guest OS. This can be used as a way to pass data to an application like
cloud-init, or potentially as an alternative to the kernel command line for OS
installers where you can't modify the install ISO image to change the kernel
args.

As an example, consider if cloud-init and anaconda supported OEM strings you
could use something like

   <oemStrings>
     <entry>cloud-init:ds=nocloud-net;s=http://10.10.0.1:8000/</entry>
     <entry>anaconda:method=http://dl.fedoraproject.org/pub/fedora/linux/releases/25/x86_64/os</entry>
   </oemStrings>

use of a application specific prefix as illustrated above is recommended so that
an app can reliably identify which of the many OEM strings are targetted at it.

Signed-off-by: Daniel P. Berrange <berrange redhat com>
---

NB, the QEMU side of this patch is queued but won't merge until 2.12 opens
up for dev work, so this libvirt patch will need to wait a little


Let me guess, there will be no way to tell whether QEMU supports this
option or not...

docs/formatdomain.html.in                          | 13 ++++++
docs/schemas/domaincommon.rng                      |  9 ++++
src/conf/domain_conf.c                             | 53 ++++++++++++++++++++++
src/qemu/qemu_command.c                            | 28 ++++++++++++
src/util/virsysinfo.c                              | 33 ++++++++++++++
src/util/virsysinfo.h                              | 10 ++++
tests/qemuxml2argvdata/qemuxml2argv-smbios.args    |  2 +
tests/qemuxml2argvdata/qemuxml2argv-smbios.xml     |  5 ++
tests/qemuxml2xmloutdata/qemuxml2xmlout-smbios.xml |  5 ++
9 files changed, 158 insertions(+)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 0e4f76f066..5d81fbb555 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -14315,6 +14315,48 @@ virSysinfoBaseBoardParseXML(xmlXPathContextPtr ctxt,
    return ret;
}

+static int
+virSysinfoOEMStringsParseXML(xmlNodePtr node,
+                             xmlXPathContextPtr ctxt,
+                             virSysinfoOEMStringsDefPtr *oem)
+{
+    int ret = -1;
+    virSysinfoOEMStringsDefPtr def;
+    xmlNodePtr *strings = NULL;
+    int nstrings;
+    size_t i;
+
+    if (!virXMLNodeNameEqual(node, "oemStrings")) {
+        virReportError(VIR_ERR_XML_ERROR, "%s",
+                       _("XML does not contain expected 'system' element"));

This copy-and-paste error message with the wrong element name should not
happen, since we only call this function if we found an 'oemStrings'
node.

+        return ret;
+    }
+
+    nstrings = virXPathNodeSet("./entry", ctxt, &strings);
+    if (nstrings < 0)
+        return -1;
+    if (nstrings == 0)
+        return 0;
+
+    if (VIR_ALLOC(def) < 0)
+        goto cleanup;
+

ACK

Would look better with the XML changes and command line formatter
changes separated

Jan

Attachment: signature.asc
Description: Digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]