[libvirt] [PATCH 6/7] Add sysinfo/smbios support to the QEmu driver

Daniel P. Berrange berrange at redhat.com
Mon Nov 8 13:28:06 UTC 2010


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 at 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 :|




More information about the libvir-list mailing list