mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 20:45:18 +00:00
qemu: domain: Refactor formatting of node names into status XML
Use virXMLFormatElement to simplify the logic. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
b18328256b
commit
9fb7ccb3cf
@ -2370,15 +2370,12 @@ qemuStorageSourcePrivateDataFormat(virStorageSourcePtr src,
|
||||
{
|
||||
g_auto(virBuffer) tmp = VIR_BUFFER_INIT_CHILD(buf);
|
||||
qemuDomainStorageSourcePrivatePtr srcPriv = QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(src);
|
||||
g_auto(virBuffer) nodenamesChildBuf = VIR_BUFFER_INIT_CHILD(buf);
|
||||
|
||||
if (src->nodestorage || src->nodeformat) {
|
||||
virBufferAddLit(buf, "<nodenames>\n");
|
||||
virBufferAdjustIndent(buf, 2);
|
||||
virBufferEscapeString(buf, "<nodename type='storage' name='%s'/>\n", src->nodestorage);
|
||||
virBufferEscapeString(buf, "<nodename type='format' name='%s'/>\n", src->nodeformat);
|
||||
virBufferAdjustIndent(buf, -2);
|
||||
virBufferAddLit(buf, "</nodenames>\n");
|
||||
}
|
||||
virBufferEscapeString(&nodenamesChildBuf, "<nodename type='storage' name='%s'/>\n", src->nodestorage);
|
||||
virBufferEscapeString(&nodenamesChildBuf, "<nodename type='format' name='%s'/>\n", src->nodeformat);
|
||||
|
||||
virXMLFormatElement(buf, "nodenames", NULL, &nodenamesChildBuf);
|
||||
|
||||
if (src->pr)
|
||||
virBufferAsprintf(buf, "<reservations mgralias='%s'/>\n", src->pr->mgralias);
|
||||
|
Loading…
x
Reference in New Issue
Block a user