[libvirt] [PATCH 0/7] Revamped Smbios/Sysinfo support v2

v2: incorporates Dan suggestions especially move smbios into <os> This patch set implements a new way to store system informations and pass them to the domain, it's modelled on the SMBIOS support in hypervisors using a complete emulation (type hvm) and allow to override those informations in domains: The simplest is the use of: <os> <type>hvm</type> <smbios mode="host"/> <os> in which case the domain will try to inherit those values from the Host own values, the classical use case is the use of OEM'ed Windows versions where one need to export SMBIOS informations from the host to the guest. But the <sysinfo> construct allows to define those informations, for example: <os> <type>hvm</type> <smbios mode="sysinfo"/> <os> <sysinfo type="smbios"> <bios> <entry name="vendor">QEmu/KVM</entry> <entry name="version">0.13</entry> </bios> <system> <entry name="manufacturer">Fedora</entry> <entry name="product">Virt-Manager</entry> <entry name="version">0.8.2-3.fc14</entry> <entry name="serial">32dfcb37-5af1-552b-357c-be8c3aa38310</entry> <entry name="uuid">c7a5fdbd-edaf-9455-926a-d65c16db1809</entry> </system> </sysinfo> In that case libvirt hypervisor driver will try to set up those values in the domain emulation. The patch set attached implement those modes for QEmu, and based on our previous reviews with Matthias the first mode should be implementable in the ESX driver (for just a couple of settings though) and the VirtualBox driver should be abble to implement both if we understood correctly, Daniel

Currently includes a subset of the SMBIOS strings set Signed-off-by: Daniel Veillard <veillard@redhat.com> --- docs/schemas/domain.rng | 75 +++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 75 insertions(+), 0 deletions(-)

On Fri, Nov 05, 2010 at 04:46:32PM +0100, Daniel Veillard wrote:
Currently includes a subset of the SMBIOS strings set
Signed-off-by: Daniel Veillard <veillard@redhat.com> --- docs/schemas/domain.rng | 75 +++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 75 insertions(+), 0 deletions(-)
ACK Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

* src/conf/domain_conf.h: defines a new internal type added to the domain structure * src/conf/domain_conf.c: parsing and serialization of that new type Signed-off-by: Daniel Veillard <veillard@redhat.com> --- src/conf/domain_conf.c | 180 +++++++++++++++++++++++++++++++++++++++++++++++- src/conf/domain_conf.h | 26 +++++++ 2 files changed, 205 insertions(+), 1 deletions(-)

On Fri, Nov 05, 2010 at 04:46:33PM +0100, Daniel Veillard wrote:
* src/conf/domain_conf.h: defines a new internal type added to the domain structure * src/conf/domain_conf.c: parsing and serialization of that new type
Signed-off-by: Daniel Veillard <veillard@redhat.com> --- src/conf/domain_conf.c | 180 +++++++++++++++++++++++++++++++++++++++++++++++- src/conf/domain_conf.h | 26 +++++++ 2 files changed, 205 insertions(+), 1 deletions(-)
ACK Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

the element has a mode attribute allowing only 3 values: - emulate: use the smbios emulation from the hypervisor - host: try to use the smbios values from the node - sysinfo: grab the values from the <sysinfo> fields * docs/schemas/domain.rng: extend the schemas * src/conf/domain_conf.h: add the flag to the domain config * src/conf/domain_conf.h: parse and serialize the smbios if present Signed-off-by: Daniel Veillard <veillard@redhat.com> --- docs/schemas/domain.rng | 16 ++++++++++++++++ src/conf/domain_conf.c | 32 ++++++++++++++++++++++++++++++++ src/conf/domain_conf.h | 11 +++++++++++ 3 files changed, 59 insertions(+), 0 deletions(-)

On Fri, Nov 05, 2010 at 04:46:34PM +0100, Daniel Veillard wrote:
the element has a mode attribute allowing only 3 values: - emulate: use the smbios emulation from the hypervisor - host: try to use the smbios values from the node - sysinfo: grab the values from the <sysinfo> fields
* docs/schemas/domain.rng: extend the schemas * src/conf/domain_conf.h: add the flag to the domain config * src/conf/domain_conf.h: parse and serialize the smbios if present
Signed-off-by: Daniel Veillard <veillard@redhat.com> --- docs/schemas/domain.rng | 16 ++++++++++++++++ src/conf/domain_conf.c | 32 ++++++++++++++++++++++++++++++++ src/conf/domain_conf.h | 11 +++++++++++ 3 files changed, 59 insertions(+), 0 deletions(-)
ACK Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

Move existing routines about virSysinfoDef to an util module, add a new entry point virSysinfoRead() to read the host values with dmidecode * src/conf/domain_conf.c src/conf/domain_conf.h src/util/sysinfo.c src/util/sysinfo.h: move to a new module, add virSysinfoRead() * src/Makefile.am: handle the new module build * src/libvirt_private.syms: new internal symbols * include/libvirt/virterror.h src/util/virterror.c: defined a new error code for that module * po/POTFILES.in: add new file for translations Signed-off-by: Daniel Veillard <veillard@redhat.com> --- include/libvirt/virterror.h | 3 +- po/POTFILES.in | 1 + src/Makefile.am | 1 + src/conf/domain_conf.c | 19 ---- src/conf/domain_conf.h | 25 +----- src/libvirt_private.syms | 5 + src/util/sysinfo.c | 236 +++++++++++++++++++++++++++++++++++++++++++ src/util/sysinfo.h | 58 +++++++++++ src/util/virterror.c | 3 + 9 files changed, 307 insertions(+), 44 deletions(-) create mode 100644 src/util/sysinfo.c create mode 100644 src/util/sysinfo.h

On Fri, Nov 05, 2010 at 04:46:35PM +0100, Daniel Veillard wrote:
Move existing routines about virSysinfoDef to an util module, add a new entry point virSysinfoRead() to read the host values with dmidecode
* src/conf/domain_conf.c src/conf/domain_conf.h src/util/sysinfo.c src/util/sysinfo.h: move to a new module, add virSysinfoRead() * src/Makefile.am: handle the new module build * src/libvirt_private.syms: new internal symbols * include/libvirt/virterror.h src/util/virterror.c: defined a new error code for that module * po/POTFILES.in: add new file for translations
Signed-off-by: Daniel Veillard <veillard@redhat.com> --- include/libvirt/virterror.h | 3 +- po/POTFILES.in | 1 + src/Makefile.am | 1 + src/conf/domain_conf.c | 19 ---- src/conf/domain_conf.h | 25 +----- src/libvirt_private.syms | 5 + src/util/sysinfo.c | 236 +++++++++++++++++++++++++++++++++++++++++++ src/util/sysinfo.h | 58 +++++++++++ src/util/virterror.c | 3 + 9 files changed, 307 insertions(+), 44 deletions(-) create mode 100644 src/util/sysinfo.c create mode 100644 src/util/sysinfo.h
ACK Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

Read and store the data when initializing the driver. Signed-off-by: Daniel Veillard <veillard@redhat.com> --- src/qemu/qemu_conf.h | 2 ++ src/qemu/qemu_driver.c | 7 +++++++ 2 files changed, 9 insertions(+), 0 deletions(-)

On Fri, Nov 05, 2010 at 04:46:36PM +0100, Daniel Veillard wrote:
Read and store the data when initializing the driver.
Signed-off-by: Daniel Veillard <veillard@redhat.com> --- src/qemu/qemu_conf.h | 2 ++ src/qemu/qemu_driver.c | 7 +++++++ 2 files changed, 9 insertions(+), 0 deletions(-)
ACK Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

The patch is based on the possiblity in the QEmu command line to add -smbios options allowing to override the default values picked by QEmu. We need to detect this first from QEmu help output. If the domain is defined with smbios to be inherited from host then we pass the values coming from the Host own SMBIOS, but if the domain is defined with smbios to come from sysinfo, we use the ones coming from the domain definition. * src/qemu/qemu_conf.h: add the QEMUD_CMD_FLAG_SMBIOS_TYPE enum value * src/qemu/qemu_conf.c: scan the help output for the smbios support, and if available add support based on the domain definitions, and host data * tests/qemuhelptest.c: add the new enum in the outputs Signed-off-by: Daniel Veillard <veillard@redhat.com> --- src/qemu/qemu_conf.c | 123 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/qemu/qemu_conf.h | 3 +- tests/qemuhelptest.c | 15 ++++-- 3 files changed, 135 insertions(+), 6 deletions(-)

On Fri, Nov 05, 2010 at 04:46:37PM +0100, Daniel Veillard wrote:
The patch is based on the possiblity in the QEmu command line to add -smbios options allowing to override the default values picked by QEmu. We need to detect this first from QEmu help output. If the domain is defined with smbios to be inherited from host then we pass the values coming from the Host own SMBIOS, but if the domain is defined with smbios to come from sysinfo, we use the ones coming from the domain definition.
* src/qemu/qemu_conf.h: add the QEMUD_CMD_FLAG_SMBIOS_TYPE enum value * src/qemu/qemu_conf.c: scan the help output for the smbios support, and if available add support based on the domain definitions, and host data * tests/qemuhelptest.c: add the new enum in the outputs
Signed-off-by: Daniel Veillard <veillard@redhat.com> --- src/qemu/qemu_conf.c | 123 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/qemu/qemu_conf.h | 3 +- tests/qemuhelptest.c | 15 ++++-- 3 files changed, 135 insertions(+), 6 deletions(-)
@@ -4092,6 +4171,50 @@ int qemudBuildCommandLine(virConnectPtr conn, } }
+ if ((def->os.smbios_mode != VIR_DOMAIN_SMBIOS_NONE) && + (def->os.smbios_mode != VIR_DOMAIN_SMBIOS_EMULATE)) { + virSysinfoDefPtr source = NULL; + + if (!(qemuCmdFlags & QEMUD_CMD_FLAG_SMBIOS_TYPE)) { + qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("the QEMU binary %s does not support smbios settings"), + emulator); + goto error; + } + + /* should we really error out or just warn in those cases ? */ + if (def->os.smbios_mode == VIR_DOMAIN_SMBIOS_HOST) { + if (driver->hostsysinfo == NULL) { + qemuReportError(VIR_ERR_INTERNAL_ERROR, + _("Host SMBIOS informations are not available")); + goto error; + }
This one should use VIR_ERR_CONFIG_UNSUPPORTED too, because we're just saying that this data isn't available with qemu:///session instances really. Also s/informations are not/information is not/
+ source = driver->hostsysinfo; + } else if (def->os.smbios_mode == VIR_DOMAIN_SMBIOS_SYSINFO) { + if (def->sysinfo == NULL) { + qemuReportError(VIR_ERR_XML_ERROR, + _("Domain '%s' sysinfo are not available"), + def->name); + goto error; + } + source = def->sysinfo; + }
ACK with those minor fixes Regards, Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

On Mon, Nov 08, 2010 at 01:28:06PM +0000, Daniel P. Berrange wrote:
On Fri, Nov 05, 2010 at 04:46:37PM +0100, Daniel Veillard wrote:
+ if (def->os.smbios_mode == VIR_DOMAIN_SMBIOS_HOST) { + if (driver->hostsysinfo == NULL) { + qemuReportError(VIR_ERR_INTERNAL_ERROR, + _("Host SMBIOS informations are not available")); + goto error; + }
This one should use VIR_ERR_CONFIG_UNSUPPORTED too, because we're just saying that this data isn't available with qemu:///session instances really.
Also s/informations are not/information is not/ [...]
ACK with those minor fixes
Okay I pushed the full patch set with this small fix, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

Signed-off-by: Daniel Veillard <veillard@redhat.com> --- tests/qemuxml2argvdata/qemuxml2argv-smbios.args | 1 + tests/qemuxml2argvdata/qemuxml2argv-smbios.xml | 39 +++++++++++++++++++++++ tests/qemuxml2argvtest.c | 2 + 3 files changed, 42 insertions(+), 0 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-smbios.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-smbios.xml

On Fri, Nov 05, 2010 at 04:46:38PM +0100, Daniel Veillard wrote:
Signed-off-by: Daniel Veillard <veillard@redhat.com> --- tests/qemuxml2argvdata/qemuxml2argv-smbios.args | 1 + tests/qemuxml2argvdata/qemuxml2argv-smbios.xml | 39 +++++++++++++++++++++++ tests/qemuxml2argvtest.c | 2 + 3 files changed, 42 insertions(+), 0 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-smbios.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-smbios.xml
ACK Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

On 11/05/2010 09:46 AM, Daniel Veillard wrote:
v2: incorporates Dan suggestions especially move smbios into <os>
This patch set implements a new way to store system informations and pass them to the domain, it's modelled on the SMBIOS support in hypervisors using a complete emulation (type hvm) and allow to override those informations in domains:
The simplest is the use of:
<os> <type>hvm</type> <smbios mode="host"/> <os>
in which case the domain will try to inherit those values from the Host own values, the classical use case is the use of OEM'ed Windows versions where one need to export SMBIOS informations from the host to the guest.
How does this interact with migration? Will the guest see different host information (either at the moment of migration, or on the first reboot after migration), or are we planning on treating this as shorthand, and internally converting it to a <sysinfo> tree as part of the migration? -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

On Fri, Nov 05, 2010 at 10:11:00AM -0600, Eric Blake wrote:
On 11/05/2010 09:46 AM, Daniel Veillard wrote:
v2: incorporates Dan suggestions especially move smbios into <os>
This patch set implements a new way to store system informations and pass them to the domain, it's modelled on the SMBIOS support in hypervisors using a complete emulation (type hvm) and allow to override those informations in domains:
The simplest is the use of:
<os> <type>hvm</type> <smbios mode="host"/> <os>
in which case the domain will try to inherit those values from the Host own values, the classical use case is the use of OEM'ed Windows versions where one need to export SMBIOS informations from the host to the guest.
How does this interact with migration? Will the guest see different host information (either at the moment of migration, or on the first reboot after migration), or are we planning on treating this as shorthand, and internally converting it to a <sysinfo> tree as part of the migration?
<smbios mode="host"/> clearly can't play well with migration. With the current code since the internal XML is not extended the SMBIOS values will be seen as changing during run from a guest OS point of view. I'm not sure it's worth trying to "fix" this, unless having another mode where host data at define time gets turned into a domain sysinfo. Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

On Fri, Nov 05, 2010 at 10:11:00AM -0600, Eric Blake wrote:
On 11/05/2010 09:46 AM, Daniel Veillard wrote:
v2: incorporates Dan suggestions especially move smbios into <os>
This patch set implements a new way to store system informations and pass them to the domain, it's modelled on the SMBIOS support in hypervisors using a complete emulation (type hvm) and allow to override those informations in domains:
The simplest is the use of:
<os> <type>hvm</type> <smbios mode="host"/> <os>
in which case the domain will try to inherit those values from the Host own values, the classical use case is the use of OEM'ed Windows versions where one need to export SMBIOS informations from the host to the guest.
How does this interact with migration? Will the guest see different host information (either at the moment of migration, or on the first reboot after migration), or are we planning on treating this as shorthand, and internally converting it to a <sysinfo> tree as part of the migration?
I believe that VMWare defines that the data in this region *will* change when the guest is migrated. Whether this upsets the guest OS or not is a open question. If the admin wants something explicitly migration safe, then they can use the manual setup we allow for in the XML, though of course only QEMU supports this approach. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
participants (3)
-
Daniel P. Berrange
-
Daniel Veillard
-
Eric Blake