]> xenbits.xensource.com Git - libvirt.git/commitdiff
conf: domcaps: Don't output XML on tristate ABSENT
authorCole Robinson <crobinso@redhat.com>
Tue, 19 Feb 2019 19:12:47 +0000 (14:12 -0500)
committerCole Robinson <crobinso@redhat.com>
Mon, 18 Mar 2019 14:51:02 +0000 (10:51 -0400)
Change domcaps to skip formatting XML if the default
TRISTATE_BOOL_ABSENT is found. Now when domcaps is extended, driver
XML output won't change until an explicit TRISTATE_BOOL value is set
in driver code.

Acked-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
src/conf/domain_capabilities.c
tests/domaincapsschemadata/empty.xml

index 081549eefbfbd37043eb79038501b8538da0879a..f45a3bcc3d1b7a1907ef6f476e37301690e4fb42 100644 (file)
@@ -370,10 +370,12 @@ virDomainCapsStringValuesFormat(virBufferPtr buf,
 
 #define FORMAT_PROLOGUE(item) \
     do { \
+        if (item->supported == VIR_TRISTATE_BOOL_ABSENT) \
+            return; \
         virBufferAsprintf(buf, "<" #item " supported='%s'%s\n", \
                 (item->supported == VIR_TRISTATE_BOOL_YES) ? "yes" : "no", \
                 (item->supported == VIR_TRISTATE_BOOL_YES) ? ">" : "/>"); \
-        if (item->supported != VIR_TRISTATE_BOOL_YES) \
+        if (item->supported == VIR_TRISTATE_BOOL_NO) \
             return; \
         virBufferAdjustIndent(buf, 2); \
     } while (0)
@@ -386,8 +388,10 @@ virDomainCapsStringValuesFormat(virBufferPtr buf,
 
 #define FORMAT_SINGLE(name, supported) \
     do { \
-        virBufferAsprintf(&buf, "<%s supported='%s'/>\n", name, \
-                (supported == VIR_TRISTATE_BOOL_YES) ? "yes" : "no"); \
+        if (supported != VIR_TRISTATE_BOOL_ABSENT) { \
+            virBufferAsprintf(&buf, "<%s supported='%s'/>\n", name, \
+                    (supported == VIR_TRISTATE_BOOL_YES) ? "yes" : "no"); \
+        } \
     } while (0)
 
 #define ENUM_PROCESS(master, capsEnum, valToStr) \
index 2b2e97d3b3f5f5e05eac5fb792613e620e830250..6c3f5f54fd8e866ed3a1b0abc97f88923f4f006f 100644 (file)
@@ -3,23 +3,14 @@
   <domain>kvm</domain>
   <machine>my-machine-type</machine>
   <arch>x86_64</arch>
-  <iothreads supported='no'/>
-  <os supported='no'/>
   <cpu>
     <mode name='host-passthrough' supported='no'/>
     <mode name='host-model' supported='no'/>
     <mode name='custom' supported='no'/>
   </cpu>
   <devices>
-    <disk supported='no'/>
-    <graphics supported='no'/>
-    <video supported='no'/>
-    <hostdev supported='no'/>
   </devices>
   <features>
-    <gic supported='no'/>
-    <vmcoreinfo supported='no'/>
-    <genid supported='no'/>
     <sev supported='no'/>
   </features>
 </domainCapabilities>