qemu: Format <allowReboot> conditionally

If the value is VIR_TRISTATE_BOOL_ABSENT we should just omit
the element entirely.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Andrea Bolognani 2022-03-24 19:49:40 +01:00
parent 817aa45025
commit c49651ac17

View File

@ -2205,9 +2205,10 @@ void
qemuDomainObjPrivateXMLFormatAllowReboot(virBuffer *buf,
virTristateBool allowReboot)
{
virBufferAsprintf(buf, "<allowReboot value='%s'/>\n",
virTristateBoolTypeToString(allowReboot));
if (allowReboot) {
virBufferAsprintf(buf, "<allowReboot value='%s'/>\n",
virTristateBoolTypeToString(allowReboot));
}
}