1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-01-11 09:17:52 +03:00

conf: domcaps: Don't output XML on tristate ABSENT

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>
This commit is contained in:
Cole Robinson 2019-02-19 14:12:47 -05:00
parent 91e85d8939
commit e3119a3323
2 changed files with 7 additions and 12 deletions

View File

@ -370,10 +370,12 @@ virDomainCapsStringValuesFormat(virBufferPtr buf,
#define FORMAT_PROLOGUE(item) \ #define FORMAT_PROLOGUE(item) \
do { \ do { \
if (item->supported == VIR_TRISTATE_BOOL_ABSENT) \
return; \
virBufferAsprintf(buf, "<" #item " supported='%s'%s\n", \ virBufferAsprintf(buf, "<" #item " supported='%s'%s\n", \
(item->supported == VIR_TRISTATE_BOOL_YES) ? "yes" : "no", \ (item->supported == VIR_TRISTATE_BOOL_YES) ? "yes" : "no", \
(item->supported == VIR_TRISTATE_BOOL_YES) ? ">" : "/>"); \ (item->supported == VIR_TRISTATE_BOOL_YES) ? ">" : "/>"); \
if (item->supported != VIR_TRISTATE_BOOL_YES) \ if (item->supported == VIR_TRISTATE_BOOL_NO) \
return; \ return; \
virBufferAdjustIndent(buf, 2); \ virBufferAdjustIndent(buf, 2); \
} while (0) } while (0)
@ -386,8 +388,10 @@ virDomainCapsStringValuesFormat(virBufferPtr buf,
#define FORMAT_SINGLE(name, supported) \ #define FORMAT_SINGLE(name, supported) \
do { \ do { \
virBufferAsprintf(&buf, "<%s supported='%s'/>\n", name, \ if (supported != VIR_TRISTATE_BOOL_ABSENT) { \
(supported == VIR_TRISTATE_BOOL_YES) ? "yes" : "no"); \ virBufferAsprintf(&buf, "<%s supported='%s'/>\n", name, \
(supported == VIR_TRISTATE_BOOL_YES) ? "yes" : "no"); \
} \
} while (0) } while (0)
#define ENUM_PROCESS(master, capsEnum, valToStr) \ #define ENUM_PROCESS(master, capsEnum, valToStr) \

View File

@ -3,23 +3,14 @@
<domain>kvm</domain> <domain>kvm</domain>
<machine>my-machine-type</machine> <machine>my-machine-type</machine>
<arch>x86_64</arch> <arch>x86_64</arch>
<iothreads supported='no'/>
<os supported='no'/>
<cpu> <cpu>
<mode name='host-passthrough' supported='no'/> <mode name='host-passthrough' supported='no'/>
<mode name='host-model' supported='no'/> <mode name='host-model' supported='no'/>
<mode name='custom' supported='no'/> <mode name='custom' supported='no'/>
</cpu> </cpu>
<devices> <devices>
<disk supported='no'/>
<graphics supported='no'/>
<video supported='no'/>
<hostdev supported='no'/>
</devices> </devices>
<features> <features>
<gic supported='no'/>
<vmcoreinfo supported='no'/>
<genid supported='no'/>
<sev supported='no'/> <sev supported='no'/>
</features> </features>
</domainCapabilities> </domainCapabilities>