|
|
d76c62 |
From d77f180068dab8747f5e2c098a9c59213ce19108 Mon Sep 17 00:00:00 2001
|
|
|
d76c62 |
Message-Id: <d77f180068dab8747f5e2c098a9c59213ce19108@dist-git>
|
|
|
d76c62 |
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
|
|
|
d76c62 |
Date: Wed, 4 Mar 2020 12:42:29 +0100
|
|
|
d76c62 |
Subject: [PATCH] conf: use virXMLFormatElement in virDomainFSDefFormat
|
|
|
d76c62 |
MIME-Version: 1.0
|
|
|
d76c62 |
Content-Type: text/plain; charset=UTF-8
|
|
|
d76c62 |
Content-Transfer-Encoding: 8bit
|
|
|
d76c62 |
|
|
|
d76c62 |
Use the virXMLFormatElement helper to format the driver element
|
|
|
d76c62 |
to simplify adding further sub-elements.
|
|
|
d76c62 |
|
|
|
d76c62 |
Signed-off-by: Ján Tomko <jtomko@redhat.com>
|
|
|
d76c62 |
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
|
|
|
d76c62 |
(cherry picked from commit 3efdbae5bf054d1a2bdc98fdccff0273abe54c88)
|
|
|
d76c62 |
Signed-off-by: Ján Tomko <jtomko@redhat.com>
|
|
|
d76c62 |
https://bugzilla.redhat.com/show_bug.cgi?id=1694166
|
|
|
d76c62 |
Message-Id: <966ad0eebcb1ae5f20f59fc6cc84008bbfa6426f.1583322090.git.jtomko@redhat.com>
|
|
|
d76c62 |
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
d76c62 |
---
|
|
|
d76c62 |
src/conf/domain_conf.c | 16 ++++++----------
|
|
|
d76c62 |
1 file changed, 6 insertions(+), 10 deletions(-)
|
|
|
d76c62 |
|
|
|
d76c62 |
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
|
|
d76c62 |
index 8a5f14d6cb..88117187c8 100644
|
|
|
d76c62 |
--- a/src/conf/domain_conf.c
|
|
|
d76c62 |
+++ b/src/conf/domain_conf.c
|
|
|
d76c62 |
@@ -24991,7 +24991,7 @@ virDomainFSDefFormat(virBufferPtr buf,
|
|
|
d76c62 |
const char *fsdriver = virDomainFSDriverTypeToString(def->fsdriver);
|
|
|
d76c62 |
const char *wrpolicy = virDomainFSWrpolicyTypeToString(def->wrpolicy);
|
|
|
d76c62 |
const char *src = def->src->path;
|
|
|
d76c62 |
- g_auto(virBuffer) driverBuf = VIR_BUFFER_INITIALIZER;
|
|
|
d76c62 |
+ g_auto(virBuffer) driverAttrBuf = VIR_BUFFER_INITIALIZER;
|
|
|
d76c62 |
|
|
|
d76c62 |
if (!type) {
|
|
|
d76c62 |
virReportError(VIR_ERR_INTERNAL_ERROR,
|
|
|
d76c62 |
@@ -25016,25 +25016,21 @@ virDomainFSDefFormat(virBufferPtr buf,
|
|
|
d76c62 |
|
|
|
d76c62 |
virBufferAdjustIndent(buf, 2);
|
|
|
d76c62 |
if (def->fsdriver) {
|
|
|
d76c62 |
- virBufferAsprintf(&driverBuf, " type='%s'", fsdriver);
|
|
|
d76c62 |
+ virBufferAsprintf(&driverAttrBuf, " type='%s'", fsdriver);
|
|
|
d76c62 |
|
|
|
d76c62 |
if (def->format)
|
|
|
d76c62 |
- virBufferAsprintf(&driverBuf, " format='%s'",
|
|
|
d76c62 |
+ virBufferAsprintf(&driverAttrBuf, " format='%s'",
|
|
|
d76c62 |
virStorageFileFormatTypeToString(def->format));
|
|
|
d76c62 |
|
|
|
d76c62 |
/* Don't generate anything if wrpolicy is set to default */
|
|
|
d76c62 |
if (def->wrpolicy)
|
|
|
d76c62 |
- virBufferAsprintf(&driverBuf, " wrpolicy='%s'", wrpolicy);
|
|
|
d76c62 |
+ virBufferAsprintf(&driverAttrBuf, " wrpolicy='%s'", wrpolicy);
|
|
|
d76c62 |
|
|
|
d76c62 |
}
|
|
|
d76c62 |
|
|
|
d76c62 |
- virDomainVirtioOptionsFormat(&driverBuf, def->virtio);
|
|
|
d76c62 |
+ virDomainVirtioOptionsFormat(&driverAttrBuf, def->virtio);
|
|
|
d76c62 |
|
|
|
d76c62 |
- if (virBufferUse(&driverBuf)) {
|
|
|
d76c62 |
- virBufferAddLit(buf, "
|
|
|
d76c62 |
- virBufferAddBuffer(buf, &driverBuf);
|
|
|
d76c62 |
- virBufferAddLit(buf, "/>\n");
|
|
|
d76c62 |
- }
|
|
|
d76c62 |
+ virXMLFormatElement(buf, "driver", &driverAttrBuf, NULL);
|
|
|
d76c62 |
|
|
|
d76c62 |
switch (def->type) {
|
|
|
d76c62 |
case VIR_DOMAIN_FS_TYPE_MOUNT:
|
|
|
d76c62 |
--
|
|
|
d76c62 |
2.25.1
|
|
|
d76c62 |
|