|
|
3e5111 |
From 71aa3b75eb2f6e01c0c8e0d1bc5c0d29e310d3fd Mon Sep 17 00:00:00 2001
|
|
|
3e5111 |
Message-Id: <71aa3b75eb2f6e01c0c8e0d1bc5c0d29e310d3fd@dist-git>
|
|
|
3e5111 |
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
|
|
|
3e5111 |
Date: Fri, 9 Jun 2017 12:48:54 +0200
|
|
|
3e5111 |
Subject: [PATCH] Use a separate buffer for <filesystem><driver>
|
|
|
3e5111 |
MIME-Version: 1.0
|
|
|
3e5111 |
Content-Type: text/plain; charset=UTF-8
|
|
|
3e5111 |
Content-Transfer-Encoding: 8bit
|
|
|
3e5111 |
|
|
|
3e5111 |
Format the attributes in a separate buffer and only
|
|
|
3e5111 |
print the element if it's not empty.
|
|
|
3e5111 |
|
|
|
3e5111 |
(cherry picked from commit 8d704e6cf7da60156a0b25b165d4780e99a0fa2f)
|
|
|
3e5111 |
Signed-off-by: Ján Tomko <jtomko@redhat.com>
|
|
|
3e5111 |
|
|
|
3e5111 |
https://bugzilla.redhat.com/show_bug.cgi?id=1283251
|
|
|
3e5111 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
3e5111 |
---
|
|
|
3e5111 |
src/conf/domain_conf.c | 12 +++++++++---
|
|
|
3e5111 |
1 file changed, 9 insertions(+), 3 deletions(-)
|
|
|
3e5111 |
|
|
|
3e5111 |
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
|
|
3e5111 |
index 242a79a7e7..e004559f9f 100644
|
|
|
3e5111 |
--- a/src/conf/domain_conf.c
|
|
|
3e5111 |
+++ b/src/conf/domain_conf.c
|
|
|
3e5111 |
@@ -21504,6 +21504,7 @@ virDomainFSDefFormat(virBufferPtr buf,
|
|
|
3e5111 |
const char *fsdriver = virDomainFSDriverTypeToString(def->fsdriver);
|
|
|
3e5111 |
const char *wrpolicy = virDomainFSWrpolicyTypeToString(def->wrpolicy);
|
|
|
3e5111 |
const char *src = def->src->path;
|
|
|
3e5111 |
+ virBuffer driverBuf = VIR_BUFFER_INITIALIZER;
|
|
|
3e5111 |
|
|
|
3e5111 |
if (!type) {
|
|
|
3e5111 |
virReportError(VIR_ERR_INTERNAL_ERROR,
|
|
|
3e5111 |
@@ -21523,16 +21524,21 @@ virDomainFSDefFormat(virBufferPtr buf,
|
|
|
3e5111 |
type, accessmode);
|
|
|
3e5111 |
virBufferAdjustIndent(buf, 2);
|
|
|
3e5111 |
if (def->fsdriver) {
|
|
|
3e5111 |
- virBufferAsprintf(buf, "
|
|
|
3e5111 |
+ virBufferAsprintf(&driverBuf, " type='%s'", fsdriver);
|
|
|
3e5111 |
|
|
|
3e5111 |
if (def->format)
|
|
|
3e5111 |
- virBufferAsprintf(buf, " format='%s'",
|
|
|
3e5111 |
+ virBufferAsprintf(&driverBuf, " format='%s'",
|
|
|
3e5111 |
virStorageFileFormatTypeToString(def->format));
|
|
|
3e5111 |
|
|
|
3e5111 |
/* Don't generate anything if wrpolicy is set to default */
|
|
|
3e5111 |
if (def->wrpolicy)
|
|
|
3e5111 |
- virBufferAsprintf(buf, " wrpolicy='%s'", wrpolicy);
|
|
|
3e5111 |
+ virBufferAsprintf(&driverBuf, " wrpolicy='%s'", wrpolicy);
|
|
|
3e5111 |
|
|
|
3e5111 |
+ }
|
|
|
3e5111 |
+
|
|
|
3e5111 |
+ if (virBufferUse(&driverBuf)) {
|
|
|
3e5111 |
+ virBufferAddLit(buf, "
|
|
|
3e5111 |
+ virBufferAddBuffer(buf, &driverBuf);
|
|
|
3e5111 |
virBufferAddLit(buf, "/>\n");
|
|
|
3e5111 |
}
|
|
|
3e5111 |
|
|
|
3e5111 |
--
|
|
|
3e5111 |
2.13.1
|
|
|
3e5111 |
|