[libvirt] [PATCH 2/7] Sysinfo parsing and saving to/from configuration files
Daniel Veillard
veillard at redhat.com
Wed Nov 3 13:05:02 UTC 2010
On Wed, Nov 03, 2010 at 11:41:38AM +0000, Daniel P. Berrange wrote:
> On Tue, Nov 02, 2010 at 05:36:44PM +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 at redhat.com>
> > ---
> > src/conf/domain_conf.c | 192 +++++++++++++++++++++++++++++++++++++++++++++++-
> > src/conf/domain_conf.h | 26 +++++++
> > 2 files changed, 217 insertions(+), 1 deletions(-)
> >
>
> > @@ -6504,6 +6679,21 @@ char *virDomainDefFormat(virDomainDefPtr def,
> > virBufferVSprintf(&buf, " current='%u'", def->vcpus);
> > virBufferVSprintf(&buf, ">%u</vcpu>\n", def->maxvcpus);
> >
> > + if (def->sysinfo)
> > + virDomainSysinfoDefFormat(&buf, def->sysinfo);
> > +
> > + if (def->smbios_mode) {
> > + const char *mode;
> > +
> > + mode = virDomainSmbiosModeTypeToString(def->smbios_mode);
> > + if (mode == NULL) {
> > + virDomainReportError(VIR_ERR_INTERNAL_ERROR,
> > + _("unexpected smbios mode %d"), def->smbios_mode);
> > + goto cleanup;
> > + }
> > + virBufferVSprintf(&buf, " <smbios mode='%s'/>\n", mode);
> > + }
> > +
> > if (def->os.bootloader) {
> > virBufferEscapeString(&buf, " <bootloader>%s</bootloader>\n",
> > def->os.bootloader);
> > diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
> > index 5499f28..91ba131 100644
> > --- a/src/conf/domain_conf.h
> > +++ b/src/conf/domain_conf.h
> > @@ -606,6 +606,30 @@ struct _virDomainMemballoonDef {
> > };
> >
> >
> > +enum virDomainSysinfoType {
> > + VIR_DOMAIN_SYSINFO_SMBIOS,
> > +
> > + VIR_DOMAIN_SYSINFO_LAST
> > +};
> > +
> > +typedef struct _virSysinfoDef virSysinfoDef;
> > +typedef virSysinfoDef *virSysinfoDefPtr;
> > +struct _virSysinfoDef {
> > + int type;
> > +
> > + char *bios_vendor;
> > + char *bios_version;
> > + char *bios_date;
> > + char *bios_release;
> > +
> > + char *system_manufacturer;
> > + char *system_product;
> > + char *system_version;
> > + char *system_serial;
> > + char *system_uuid;
> > + char *system_sku;
> > +};
> > +
> > /* Flags for the 'type' field in next struct */
> > enum virDomainDeviceType {
> > VIR_DOMAIN_DEVICE_DISK,
> > @@ -943,6 +967,7 @@ struct _virDomainDef {
> > virDomainWatchdogDefPtr watchdog;
> > virDomainMemballoonDefPtr memballoon;
> > virCPUDefPtr cpu;
> > + virSysinfoDefPtr sysinfo;
> >
> > void *namespaceData;
> > virDomainXMLNamespace ns;
> > @@ -1195,6 +1220,7 @@ VIR_ENUM_DECL(virDomainChr)
>
>
> Is this the right version of the patch ? The code references def->smbios_mode,
> but smbios_mode is never added to virDomainDef in domain_conf.h ?
Hum, something got grong when I merged patches I'm afraid, okay to
double-check ..
> In line with my comments on previous patches, the smbios_mode would naturally
> fit under the virDomainOSDef struct.
yeah,
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
daniel at veillard.com | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
More information about the libvir-list
mailing list