[libvirt] [PATCH] Fix indentation of sysinfo data

Daniel P. Berrange berrange at redhat.com
Thu Oct 23 17:36:44 UTC 2014


The <sysinfo> data block was indented by 2 spaces too many.
This was missed because we never had any test validating
the XML formatting.
---
 src/conf/domain_conf.c                              | 13 +------------
 tests/qemuxml2argvdata/qemuxml2argv-smbios-date.xml | 16 ++++++++++------
 tests/qemuxml2xmltest.c                             |  1 +
 3 files changed, 12 insertions(+), 18 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 73c199e..39befb0 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -17668,17 +17668,6 @@ virDomainNVRAMDefFormat(virBufferPtr buf,
     return 0;
 }
 
-static int
-virDomainSysinfoDefFormat(virBufferPtr buf,
-                          virSysinfoDefPtr def)
-{
-    int ret;
-    virBufferAdjustIndent(buf, 2);
-    ret = virSysinfoFormat(buf, def);
-    virBufferAdjustIndent(buf, -2);
-    return ret;
-}
-
 
 static int
 virDomainWatchdogDefFormat(virBufferPtr buf,
@@ -18890,7 +18879,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
         virDomainResourceDefFormat(buf, def->resource);
 
     if (def->sysinfo)
-        virDomainSysinfoDefFormat(buf, def->sysinfo);
+        virSysinfoFormat(buf, def->sysinfo);
 
     if (def->os.bootloader) {
         virBufferEscapeString(buf, "<bootloader>%s</bootloader>\n",
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-smbios-date.xml b/tests/qemuxml2argvdata/qemuxml2argv-smbios-date.xml
index 7b2f33a..88f953f 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-smbios-date.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-smbios-date.xml
@@ -4,20 +4,24 @@
   <memory unit='KiB'>1048576</memory>
   <currentMemory unit='KiB'>1048576</currentMemory>
   <vcpu placement='static'>1</vcpu>
-  <os>
-    <type arch='i686' machine='pc'>hvm</type>
-    <smbios mode="sysinfo"/>
-  </os>
-  <sysinfo type="smbios">
+  <sysinfo type='smbios'>
     <bios>
-      <entry name="date">999/999/123</entry>
+      <entry name='date'>11/21/1923</entry>
     </bios>
   </sysinfo>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+    <smbios mode='sysinfo'/>
+  </os>
   <clock offset='utc'/>
   <on_poweroff>destroy</on_poweroff>
   <on_reboot>restart</on_reboot>
   <on_crash>restart</on_crash>
   <devices>
     <emulator>/usr/bin/qemu</emulator>
+    <controller type='usb' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <memballoon model='virtio'/>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 978e5f1..4c2b928 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -405,6 +405,7 @@ mymain(void)
 
     DO_TEST("tap-vhost");
     DO_TEST("shmem");
+    DO_TEST("smbios-date");
 
     virObjectUnref(driver.caps);
     virObjectUnref(driver.xmlopt);
-- 
2.1.0




More information about the libvir-list mailing list