[PATCH] capabilities: Format <domain/> properly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The <domain/> element under /capabilities/guest/arch/ can have no
child elements. If that's the case we format:

        <domain type='xen'>
        </domain>

instead of simpler:

        <domain type='xen'/>

This commit fixes that.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/conf/capabilities.c                      |  9 ++++++-
 tests/capabilityschemadata/caps-qemu-kvm.xml | 36 ++++++++++------------------
 tests/capabilityschemadata/caps-test.xml     |  6 ++---
 tests/capabilityschemadata/caps-test2.xml    |  6 ++---
 tests/xencapsdata/xen-i686-pae-hvm.xml       |  6 ++---
 tests/xencapsdata/xen-i686-pae.xml           |  3 +--
 tests/xencapsdata/xen-i686.xml               |  3 +--
 tests/xencapsdata/xen-ia64-be-hvm.xml        |  6 ++---
 tests/xencapsdata/xen-ia64-be.xml            |  3 +--
 tests/xencapsdata/xen-ia64-hvm.xml           |  6 ++---
 tests/xencapsdata/xen-ia64.xml               |  3 +--
 tests/xencapsdata/xen-ppc64.xml              |  3 +--
 tests/xencapsdata/xen-x86_64-hvm.xml         |  9 +++----
 tests/xencapsdata/xen-x86_64.xml             |  3 +--
 14 files changed, 39 insertions(+), 63 deletions(-)

diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c
index 37d19c1..6c11a7f 100644
--- a/src/conf/capabilities.c
+++ b/src/conf/capabilities.c
@@ -969,8 +969,15 @@ virCapabilitiesFormatXML(virCapsPtr caps)
         }
 
         for (j = 0; j < caps->guests[i]->arch.ndomains; j++) {
-            virBufferAsprintf(&buf, "<domain type='%s'>\n",
+            virBufferAsprintf(&buf, "<domain type='%s'",
                                   caps->guests[i]->arch.domains[j]->type);
+            if (!caps->guests[i]->arch.domains[j]->info.emulator &&
+                !caps->guests[i]->arch.domains[j]->info.loader &&
+                !caps->guests[i]->arch.domains[j]->info.nmachines) {
+                virBufferAddLit(&buf, "/>\n");
+                continue;
+            }
+            virBufferAddLit(&buf, ">\n");
             virBufferAdjustIndent(&buf, 2);
             if (caps->guests[i]->arch.domains[j]->info.emulator)
                 virBufferAsprintf(&buf, "<emulator>%s</emulator>\n",
diff --git a/tests/capabilityschemadata/caps-qemu-kvm.xml b/tests/capabilityschemadata/caps-qemu-kvm.xml
index 55faa16..7055c7a 100644
--- a/tests/capabilityschemadata/caps-qemu-kvm.xml
+++ b/tests/capabilityschemadata/caps-qemu-kvm.xml
@@ -39,8 +39,7 @@
       <machine canonical='pc-0.11' maxCpus='255'>pc</machine>
       <machine maxCpus='255'>pc-0.10</machine>
       <machine maxCpus='1'>isapc</machine>
-      <domain type='qemu'>
-      </domain>
+      <domain type='qemu'/>
       <domain type='kvm'>
         <emulator>/usr/bin/qemu-kvm</emulator>
         <machine maxCpus='255'>pc-0.11</machine>
@@ -66,8 +65,7 @@
       <machine canonical='pc-0.11'>pc</machine>
       <machine>pc-0.10</machine>
       <machine>isapc</machine>
-      <domain type='qemu'>
-      </domain>
+      <domain type='qemu'/>
       <domain type='kvm'>
         <emulator>/usr/bin/qemu-kvm</emulator>
         <machine>pc-0.11</machine>
@@ -108,8 +106,7 @@
       <machine>realview</machine>
       <machine>versatilepb</machine>
       <machine>versatileab</machine>
-      <domain type='qemu'>
-      </domain>
+      <domain type='qemu'/>
     </arch>
   </guest>
 
@@ -119,8 +116,7 @@
       <wordsize>64</wordsize>
       <emulator>/usr/bin/qemu-system-aarch64</emulator>
       <machine>machvirt</machine>
-      <domain type='qemu'>
-      </domain>
+      <domain type='qemu'/>
     </arch>
   </guest>
 
@@ -131,8 +127,7 @@
       <emulator>/usr/bin/qemu-system-microblaze</emulator>
       <machine>petalogix-s3adsp1800</machine>
       <machine>microblaze-fdt</machine>
-      <domain type='qemu'>
-      </domain>
+      <domain type='qemu'/>
     </arch>
   </guest>
 
@@ -143,8 +138,7 @@
       <emulator>/usr/bin/qemu-system-microblazeel</emulator>
       <machine>petalogix-s3adsp1800</machine>
       <machine>microblaze-fdt</machine>
-      <domain type='qemu'>
-      </domain>
+      <domain type='qemu'/>
     </arch>
   </guest>
 
@@ -158,8 +152,7 @@
       <machine>magnum</machine>
       <machine>pica61</machine>
       <machine>mips</machine>
-      <domain type='qemu'>
-      </domain>
+      <domain type='qemu'/>
     </arch>
   </guest>
 
@@ -173,8 +166,7 @@
       <machine>magnum</machine>
       <machine>pica61</machine>
       <machine>mips</machine>
-      <domain type='qemu'>
-      </domain>
+      <domain type='qemu'/>
     </arch>
   </guest>
 
@@ -195,8 +187,7 @@
       <machine>SS-1000</machine>
       <machine>SS-2000</machine>
       <machine>SS-2</machine>
-      <domain type='qemu'>
-      </domain>
+      <domain type='qemu'/>
     </arch>
   </guest>
 
@@ -212,8 +203,7 @@
       <machine>taihu</machine>
       <machine>mac99</machine>
       <machine>prep</machine>
-      <domain type='qemu'>
-      </domain>
+      <domain type='qemu'/>
     </arch>
   </guest>
 
@@ -223,8 +213,7 @@
       <wordsize>32</wordsize>
       <emulator>/usr/bin/xenner</emulator>
       <machine>xenner</machine>
-      <domain type='kvm'>
-      </domain>
+      <domain type='kvm'/>
     </arch>
     <features>
       <pae/>
@@ -240,8 +229,7 @@
       <wordsize>64</wordsize>
       <emulator>/usr/bin/xenner</emulator>
       <machine>xenner</machine>
-      <domain type='kvm'>
-      </domain>
+      <domain type='kvm'/>
     </arch>
     <features>
       <acpi default='on' toggle='yes'/>
diff --git a/tests/capabilityschemadata/caps-test.xml b/tests/capabilityschemadata/caps-test.xml
index 64f9bb6..da19961 100644
--- a/tests/capabilityschemadata/caps-test.xml
+++ b/tests/capabilityschemadata/caps-test.xml
@@ -43,8 +43,7 @@
     <arch name='i686'>
       <wordsize>32</wordsize>
       <emulator>/usr/bin/test-hv</emulator>
-      <domain type='test'>
-      </domain>
+      <domain type='test'/>
     </arch>
     <features>
       <pae/>
@@ -57,8 +56,7 @@
     <arch name='i686'>
       <wordsize>32</wordsize>
       <emulator>/usr/bin/test-hv</emulator>
-      <domain type='test'>
-      </domain>
+      <domain type='test'/>
     </arch>
     <features>
       <pae/>
diff --git a/tests/capabilityschemadata/caps-test2.xml b/tests/capabilityschemadata/caps-test2.xml
index a99c1b8..e676395 100644
--- a/tests/capabilityschemadata/caps-test2.xml
+++ b/tests/capabilityschemadata/caps-test2.xml
@@ -51,8 +51,7 @@
       <machine>pc-0.11</machine>
       <machine>pc-0.10</machine>
       <machine>isapc</machine>
-      <domain type='qemu'>
-      </domain>
+      <domain type='qemu'/>
       <domain type='kvm'>
         <emulator>/usr/libexec/qemu-kvm</emulator>
         <machine>pc-1.2</machine>
@@ -94,8 +93,7 @@
       <machine>pc-0.11</machine>
       <machine>pc-0.10</machine>
       <machine>isapc</machine>
-      <domain type='qemu'>
-      </domain>
+      <domain type='qemu'/>
       <domain type='kvm'>
         <emulator>/usr/libexec/qemu-kvm</emulator>
         <machine>pc-1.2</machine>
diff --git a/tests/xencapsdata/xen-i686-pae-hvm.xml b/tests/xencapsdata/xen-i686-pae-hvm.xml
index 872e5f6..cf6a1de 100644
--- a/tests/xencapsdata/xen-i686-pae-hvm.xml
+++ b/tests/xencapsdata/xen-i686-pae-hvm.xml
@@ -22,8 +22,7 @@
       <wordsize>32</wordsize>
       <emulator>/usr/lib/xen/bin/qemu-dm</emulator>
       <machine>xenpv</machine>
-      <domain type='xen'>
-      </domain>
+      <domain type='xen'/>
     </arch>
     <features>
       <pae/>
@@ -37,8 +36,7 @@
       <emulator>/usr/lib/xen/bin/qemu-dm</emulator>
       <loader>/usr/lib/xen/boot/hvmloader</loader>
       <machine>xenfv</machine>
-      <domain type='xen'>
-      </domain>
+      <domain type='xen'/>
     </arch>
     <features>
       <pae/>
diff --git a/tests/xencapsdata/xen-i686-pae.xml b/tests/xencapsdata/xen-i686-pae.xml
index 3dba6eb..c917fbe 100644
--- a/tests/xencapsdata/xen-i686-pae.xml
+++ b/tests/xencapsdata/xen-i686-pae.xml
@@ -22,8 +22,7 @@
       <wordsize>32</wordsize>
       <emulator>/usr/lib/xen/bin/qemu-dm</emulator>
       <machine>xenpv</machine>
-      <domain type='xen'>
-      </domain>
+      <domain type='xen'/>
     </arch>
     <features>
       <pae/>
diff --git a/tests/xencapsdata/xen-i686.xml b/tests/xencapsdata/xen-i686.xml
index 22d7685..5771e2b 100644
--- a/tests/xencapsdata/xen-i686.xml
+++ b/tests/xencapsdata/xen-i686.xml
@@ -19,8 +19,7 @@
       <wordsize>32</wordsize>
       <emulator>/usr/lib/xen/bin/qemu-dm</emulator>
       <machine>xenpv</machine>
-      <domain type='xen'>
-      </domain>
+      <domain type='xen'/>
     </arch>
     <features>
       <nonpae/>
diff --git a/tests/xencapsdata/xen-ia64-be-hvm.xml b/tests/xencapsdata/xen-ia64-be-hvm.xml
index 222de1d..19d23e9 100644
--- a/tests/xencapsdata/xen-ia64-be-hvm.xml
+++ b/tests/xencapsdata/xen-ia64-be-hvm.xml
@@ -19,8 +19,7 @@
       <wordsize>64</wordsize>
       <emulator>/usr/lib/xen/bin/qemu-dm</emulator>
       <machine>xenpv</machine>
-      <domain type='xen'>
-      </domain>
+      <domain type='xen'/>
     </arch>
     <features>
       <ia64_be/>
@@ -34,8 +33,7 @@
       <emulator>/usr/lib/xen/bin/qemu-dm</emulator>
       <loader>/usr/lib/xen/boot/hvmloader</loader>
       <machine>xenfv</machine>
-      <domain type='xen'>
-      </domain>
+      <domain type='xen'/>
     </arch>
     <features>
       <ia64_be/>
diff --git a/tests/xencapsdata/xen-ia64-be.xml b/tests/xencapsdata/xen-ia64-be.xml
index 017816c..78fa77e 100644
--- a/tests/xencapsdata/xen-ia64-be.xml
+++ b/tests/xencapsdata/xen-ia64-be.xml
@@ -19,8 +19,7 @@
       <wordsize>64</wordsize>
       <emulator>/usr/lib/xen/bin/qemu-dm</emulator>
       <machine>xenpv</machine>
-      <domain type='xen'>
-      </domain>
+      <domain type='xen'/>
     </arch>
     <features>
       <ia64_be/>
diff --git a/tests/xencapsdata/xen-ia64-hvm.xml b/tests/xencapsdata/xen-ia64-hvm.xml
index 33c4946..6e22372 100644
--- a/tests/xencapsdata/xen-ia64-hvm.xml
+++ b/tests/xencapsdata/xen-ia64-hvm.xml
@@ -19,8 +19,7 @@
       <wordsize>64</wordsize>
       <emulator>/usr/lib/xen/bin/qemu-dm</emulator>
       <machine>xenpv</machine>
-      <domain type='xen'>
-      </domain>
+      <domain type='xen'/>
     </arch>
   </guest>
 
@@ -31,8 +30,7 @@
       <emulator>/usr/lib/xen/bin/qemu-dm</emulator>
       <loader>/usr/lib/xen/boot/hvmloader</loader>
       <machine>xenfv</machine>
-      <domain type='xen'>
-      </domain>
+      <domain type='xen'/>
     </arch>
     <features>
       <acpi default='on' toggle='yes'/>
diff --git a/tests/xencapsdata/xen-ia64.xml b/tests/xencapsdata/xen-ia64.xml
index 82ce965..9e3eaf4 100644
--- a/tests/xencapsdata/xen-ia64.xml
+++ b/tests/xencapsdata/xen-ia64.xml
@@ -19,8 +19,7 @@
       <wordsize>64</wordsize>
       <emulator>/usr/lib/xen/bin/qemu-dm</emulator>
       <machine>xenpv</machine>
-      <domain type='xen'>
-      </domain>
+      <domain type='xen'/>
     </arch>
   </guest>
 
diff --git a/tests/xencapsdata/xen-ppc64.xml b/tests/xencapsdata/xen-ppc64.xml
index 91401b9..0132c45 100644
--- a/tests/xencapsdata/xen-ppc64.xml
+++ b/tests/xencapsdata/xen-ppc64.xml
@@ -19,8 +19,7 @@
       <wordsize>64</wordsize>
       <emulator>/usr/lib/xen/bin/qemu-dm</emulator>
       <machine>xenpv</machine>
-      <domain type='xen'>
-      </domain>
+      <domain type='xen'/>
     </arch>
   </guest>
 
diff --git a/tests/xencapsdata/xen-x86_64-hvm.xml b/tests/xencapsdata/xen-x86_64-hvm.xml
index 8de8cf4..7458f0b 100644
--- a/tests/xencapsdata/xen-x86_64-hvm.xml
+++ b/tests/xencapsdata/xen-x86_64-hvm.xml
@@ -22,8 +22,7 @@
       <wordsize>64</wordsize>
       <emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
       <machine>xenpv</machine>
-      <domain type='xen'>
-      </domain>
+      <domain type='xen'/>
     </arch>
   </guest>
 
@@ -34,8 +33,7 @@
       <emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
       <loader>/usr/lib/xen/boot/hvmloader</loader>
       <machine>xenfv</machine>
-      <domain type='xen'>
-      </domain>
+      <domain type='xen'/>
     </arch>
     <features>
       <pae/>
@@ -52,8 +50,7 @@
       <emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
       <loader>/usr/lib/xen/boot/hvmloader</loader>
       <machine>xenfv</machine>
-      <domain type='xen'>
-      </domain>
+      <domain type='xen'/>
     </arch>
     <features>
       <acpi default='on' toggle='yes'/>
diff --git a/tests/xencapsdata/xen-x86_64.xml b/tests/xencapsdata/xen-x86_64.xml
index 0c3279b..b686432 100644
--- a/tests/xencapsdata/xen-x86_64.xml
+++ b/tests/xencapsdata/xen-x86_64.xml
@@ -22,8 +22,7 @@
       <wordsize>64</wordsize>
       <emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
       <machine>xenpv</machine>
-      <domain type='xen'>
-      </domain>
+      <domain type='xen'/>
     </arch>
   </guest>
 
-- 
2.0.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]