提交 3efdbae5 编写于 作者: J Ján Tomko

conf: use virXMLFormatElement in virDomainFSDefFormat

Use the virXMLFormatElement helper to format the driver element
to simplify adding further sub-elements.
Signed-off-by: NJán Tomko <jtomko@redhat.com>
Reviewed-by: NPeter Krempa <pkrempa@redhat.com>
上级 3a3a85c5
......@@ -24999,7 +24999,7 @@ virDomainFSDefFormat(virBufferPtr buf,
const char *fsdriver = virDomainFSDriverTypeToString(def->fsdriver);
const char *wrpolicy = virDomainFSWrpolicyTypeToString(def->wrpolicy);
const char *src = def->src->path;
g_auto(virBuffer) driverBuf = VIR_BUFFER_INITIALIZER;
g_auto(virBuffer) driverAttrBuf = VIR_BUFFER_INITIALIZER;
if (!type) {
virReportError(VIR_ERR_INTERNAL_ERROR,
......@@ -25024,25 +25024,21 @@ virDomainFSDefFormat(virBufferPtr buf,
virBufferAdjustIndent(buf, 2);
if (def->fsdriver) {
virBufferAsprintf(&driverBuf, " type='%s'", fsdriver);
virBufferAsprintf(&driverAttrBuf, " type='%s'", fsdriver);
if (def->format)
virBufferAsprintf(&driverBuf, " format='%s'",
virBufferAsprintf(&driverAttrBuf, " format='%s'",
virStorageFileFormatTypeToString(def->format));
/* Don't generate anything if wrpolicy is set to default */
if (def->wrpolicy)
virBufferAsprintf(&driverBuf, " wrpolicy='%s'", wrpolicy);
virBufferAsprintf(&driverAttrBuf, " wrpolicy='%s'", wrpolicy);
}
virDomainVirtioOptionsFormat(&driverBuf, def->virtio);
virDomainVirtioOptionsFormat(&driverAttrBuf, def->virtio);
if (virBufferUse(&driverBuf)) {
virBufferAddLit(buf, "<driver");
virBufferAddBuffer(buf, &driverBuf);
virBufferAddLit(buf, "/>\n");
}
virXMLFormatElement(buf, "driver", &driverAttrBuf, NULL);
switch (def->type) {
case VIR_DOMAIN_FS_TYPE_MOUNT:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册