[libvirt] [PATCH 3/7] Add smbios element to schema and configuration
Daniel P. Berrange
berrange at redhat.com
Wed Nov 3 11:45:38 UTC 2010
On Tue, Nov 02, 2010 at 05:36:45PM +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 at redhat.com>
> ---
> docs/schemas/domain.rng | 16 ++++++++++++++++
> src/conf/domain_conf.c | 17 +++++++++++++++++
> src/conf/domain_conf.h | 11 +++++++++++
> 3 files changed, 44 insertions(+), 0 deletions(-)
Ah, ok some parts of patch 2 need to be pulled into this patch 3
to ensure the code is bisectable still.
> diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng
> index ced46f3..aee425f 100644
> --- a/docs/schemas/domain.rng
> +++ b/docs/schemas/domain.rng
> @@ -33,6 +33,9 @@
> <optional>
> <ref name="sysinfo"/>
> </optional>
> + <optional>
> + <ref name="smbios"/>
> + </optional>
> <ref name="os"/>
> <ref name="clock"/>
> <ref name="resources"/>
This bit should be under <define name='oshvm'>
> @@ -1819,6 +1822,19 @@
> </data>
> </define>
>
> + <define name="smbios">
> + <element name="smbios">
> + <attribute name="mode">
> + <choice>
> + <value>emulate</value>
> + <value>host</value>
> + <value>sysinfo</value>
> + </choice>
> + </attribute>
> + <empty/>
> + </element>
> + </define>
Looks good.
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 2fc761b..259ee80 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -5068,6 +5074,17 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
> if (def->sysinfo == NULL)
> goto error;
> }
> + tmp = virXPathString("string(./smbios/@mode)", ctxt);
This would needs to be ./os/smbios/@mode
> + if (tmp) {
> + if ((def->smbios_mode = virDomainSmbiosModeTypeFromString(tmp)) < 0) {
> + virDomainReportError(VIR_ERR_INTERNAL_ERROR,
> + _("unknown smbios mode '%s'"), tmp);
> + goto error;
> + }
> + VIR_FREE(tmp);
> + } else {
> + def->smbios_mode = VIR_DOMAIN_SMBIOS_NONE; /* not present */
> + }
> @@ -968,6 +977,7 @@ struct _virDomainDef {
> virDomainMemballoonDefPtr memballoon;
> virCPUDefPtr cpu;
> virSysinfoDefPtr sysinfo;
> + int smbios_mode;
>
And this moved to virDomainOsDef.
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