From: Ján Tomko Date: Fri, 26 May 2017 16:10:11 +0000 (+0200) Subject: conf: only format as a pair tag when needed X-Git-Tag: v3.5.0-rc1~162 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bb74c66e67485e12c239c13ea1be38ec6e0081ad;p=thirdparty%2Flibvirt.git conf: only format as a pair tag when needed Make the decision based on the usage of childBuf buffer. This fixes the oddity in the test case introduced by commit c1c4d0d where we would format an empty pair tag. --- diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 08c8116e1e..958a5b7cdf 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -21477,7 +21477,6 @@ virDomainControllerDefFormat(virBufferPtr buf, def->queues || def->cmd_per_lun || def->max_sectors || def->ioeventfd || def->iothread || virDomainDeviceInfoNeedsFormat(&def->info, flags) || pcihole64) { - virBufferAddLit(buf, ">\n"); if (pciModel) { modelName = virDomainControllerPCIModelNameTypeToString(def->opts.pciopts.modelName); @@ -21526,7 +21525,10 @@ virDomainControllerDefFormat(virBufferPtr buf, virBufferAsprintf(&childBuf, "%lu\n", def->opts.pciopts.pcihole64size); } + } + if (virBufferUse(&childBuf)) { + virBufferAddLit(buf, ">\n"); virBufferAddBuffer(buf, &childBuf); virBufferAddLit(buf, "\n"); } else { diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-defaultconsole.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-defaultconsole.xml index 882d0054fe..7eb1a765ab 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-defaultconsole.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-defaultconsole.xml @@ -14,8 +14,7 @@ destroy /usr/bin/qemu-system-s390x - - +