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(a)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 ?
In line with my comments on previous patches, the smbios_mode would naturally
fit under the virDomainOSDef struct.
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 :|