conf: Use virXMLFormatElement in virDomainDiskBackingStoreFormat
Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
945eab4060
commit
0f13b78b20
@ -23826,8 +23826,12 @@ virDomainDiskBackingStoreFormat(virBufferPtr buf,
|
|||||||
virDomainXMLOptionPtr xmlopt,
|
virDomainXMLOptionPtr xmlopt,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
|
VIR_AUTOCLEAN(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
|
||||||
|
VIR_AUTOCLEAN(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
|
||||||
bool inactive = flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE;
|
bool inactive = flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE;
|
||||||
|
|
||||||
|
virBufferSetChildIndent(&childBuf, buf);
|
||||||
|
|
||||||
if (!backingStore)
|
if (!backingStore)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -23847,22 +23851,23 @@ virDomainDiskBackingStoreFormat(virBufferPtr buf,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
virBufferAsprintf(buf, "<backingStore type='%s'",
|
virBufferAsprintf(&attrBuf, " type='%s'",
|
||||||
virStorageTypeToString(backingStore->type));
|
virStorageTypeToString(backingStore->type));
|
||||||
if (backingStore->id != 0)
|
if (backingStore->id != 0)
|
||||||
virBufferAsprintf(buf, " index='%u'", backingStore->id);
|
virBufferAsprintf(&attrBuf, " index='%u'", backingStore->id);
|
||||||
virBufferAddLit(buf, ">\n");
|
|
||||||
virBufferAdjustIndent(buf, 2);
|
|
||||||
|
|
||||||
virBufferAsprintf(buf, "<format type='%s'/>\n",
|
virBufferAsprintf(&childBuf, "<format type='%s'/>\n",
|
||||||
virStorageFileFormatTypeToString(backingStore->format));
|
virStorageFileFormatTypeToString(backingStore->format));
|
||||||
if (virDomainDiskSourceFormat(buf, backingStore, 0, false, flags, xmlopt) < 0 ||
|
if (virDomainDiskSourceFormat(&childBuf, backingStore, 0, false, flags, xmlopt) < 0)
|
||||||
virDomainDiskBackingStoreFormat(buf, backingStore->backingStore,
|
return -1;
|
||||||
|
|
||||||
|
if (virDomainDiskBackingStoreFormat(&childBuf, backingStore->backingStore,
|
||||||
xmlopt, flags) < 0)
|
xmlopt, flags) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
virBufferAdjustIndent(buf, -2);
|
if (virXMLFormatElement(buf, "backingStore", &attrBuf, &childBuf) < 0)
|
||||||
virBufferAddLit(buf, "</backingStore>\n");
|
return -1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user