mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
conf: Avoid formatting empty <capabilities> element
If none of the 'capabilities' features are enabled we'd still format the opening and closing tag for the <capabilities element. The implementation is suboptimal but will be refactored for a better approach. This is done prior to the refactor to show that tests are not impacted. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
c7637521d6
commit
89dda12b8d
@ -27933,8 +27933,15 @@ virDomainDefFormatFeatures(virBufferPtr buf,
|
||||
break;
|
||||
}
|
||||
|
||||
virBufferAsprintf(buf, "<capabilities policy='%s'>\n",
|
||||
virBufferAsprintf(buf, "<capabilities policy='%s'",
|
||||
virDomainCapabilitiesPolicyTypeToString(def->features[i]));
|
||||
|
||||
if (!virDomainDefHasCapabilitiesFeatures(def)) {
|
||||
virBufferAddLit(buf, "/>\n");
|
||||
break;
|
||||
} else {
|
||||
virBufferAddLit(buf, ">\n");
|
||||
}
|
||||
virBufferAdjustIndent(buf, 2);
|
||||
for (j = 0; j < VIR_DOMAIN_CAPS_FEATURE_LAST; j++) {
|
||||
if (def->caps_features[j] != VIR_TRISTATE_SWITCH_ABSENT)
|
||||
|
@ -25,8 +25,7 @@
|
||||
</os>
|
||||
<features>
|
||||
<privnet/>
|
||||
<capabilities policy='allow'>
|
||||
</capabilities>
|
||||
<capabilities policy='allow'/>
|
||||
</features>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
|
@ -13,8 +13,7 @@
|
||||
</os>
|
||||
<features>
|
||||
<privnet/>
|
||||
<capabilities policy='allow'>
|
||||
</capabilities>
|
||||
<capabilities policy='allow'/>
|
||||
</features>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
|
@ -15,8 +15,7 @@
|
||||
</os>
|
||||
<features>
|
||||
<privnet/>
|
||||
<capabilities policy='allow'>
|
||||
</capabilities>
|
||||
<capabilities policy='allow'/>
|
||||
</features>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
|
@ -14,8 +14,7 @@
|
||||
</idmap>
|
||||
<features>
|
||||
<privnet/>
|
||||
<capabilities policy='allow'>
|
||||
</capabilities>
|
||||
<capabilities policy='allow'/>
|
||||
</features>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
|
@ -9,8 +9,7 @@
|
||||
<init>/sbin/init</init>
|
||||
</os>
|
||||
<features>
|
||||
<capabilities policy='allow'>
|
||||
</capabilities>
|
||||
<capabilities policy='allow'/>
|
||||
</features>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
|
@ -15,8 +15,7 @@
|
||||
</os>
|
||||
<features>
|
||||
<privnet/>
|
||||
<capabilities policy='allow'>
|
||||
</capabilities>
|
||||
<capabilities policy='allow'/>
|
||||
</features>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
|
@ -9,8 +9,7 @@
|
||||
<init>/sbin/init</init>
|
||||
</os>
|
||||
<features>
|
||||
<capabilities policy='allow'>
|
||||
</capabilities>
|
||||
<capabilities policy='allow'/>
|
||||
</features>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
|
@ -9,8 +9,7 @@
|
||||
<init>/sbin/init</init>
|
||||
</os>
|
||||
<features>
|
||||
<capabilities policy='allow'>
|
||||
</capabilities>
|
||||
<capabilities policy='allow'/>
|
||||
</features>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
|
@ -10,8 +10,7 @@
|
||||
</os>
|
||||
<features>
|
||||
<privnet/>
|
||||
<capabilities policy='allow'>
|
||||
</capabilities>
|
||||
<capabilities policy='allow'/>
|
||||
</features>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
|
@ -9,8 +9,7 @@
|
||||
<init>/sbin/init</init>
|
||||
</os>
|
||||
<features>
|
||||
<capabilities policy='allow'>
|
||||
</capabilities>
|
||||
<capabilities policy='allow'/>
|
||||
</features>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
|
@ -9,8 +9,7 @@
|
||||
<init>/sbin/init</init>
|
||||
</os>
|
||||
<features>
|
||||
<capabilities policy='allow'>
|
||||
</capabilities>
|
||||
<capabilities policy='allow'/>
|
||||
</features>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
|
Loading…
Reference in New Issue
Block a user