1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-02-14 05:57:26 +03:00

conf: refactor virDomainResourceDefFormat

Prepare the function for additional sub-elements where all of the
sub-elements are optional.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
Pavel Hrdina 2021-08-05 15:29:45 +02:00
parent 77b53057c7
commit 9ea9f7dab2

View File

@ -26761,11 +26761,15 @@ static void
virDomainResourceDefFormat(virBuffer *buf,
virDomainResourceDef *def)
{
virBufferAddLit(buf, "<resource>\n");
virBufferAdjustIndent(buf, 2);
virBufferEscapeString(buf, "<partition>%s</partition>\n", def->partition);
virBufferAdjustIndent(buf, -2);
virBufferAddLit(buf, "</resource>\n");
g_auto(virBuffer) childBuf = VIR_BUFFER_INIT_CHILD(buf);
if (!def)
return;
if (def->partition)
virBufferEscapeString(&childBuf, "<partition>%s</partition>\n", def->partition);
virXMLFormatElement(buf, "resource", NULL, &childBuf);
}
@ -27918,7 +27922,6 @@ virDomainDefFormatInternalSetRootName(virDomainDef *def,
if (virDomainNumatuneFormatXML(buf, def->numa) < 0)
return -1;
if (def->resource)
virDomainResourceDefFormat(buf, def->resource);
for (i = 0; i < def->nsysinfo; i++) {