[libvirt] [PATCH 03/18] conf: only format as a pair tag when needed

2017-05-30 Thread Ján Tomko
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.
---
 src/conf/domain_conf.c  | 4 +++-
 tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-defaultconsole.xml | 3 +--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index fe0eaf2..57f52be 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -21464,7 +21464,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);
@@ -21513,7 +21512,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 882d005..7eb1a76 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
-
-
+
 
   
 
-- 
2.10.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH 03/18] conf: only format as a pair tag when needed

2017-06-03 Thread Pavel Hrdina
On Tue, May 30, 2017 at 02:50:26PM +0200, Ján Tomko wrote:
> 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.
> ---
>  src/conf/domain_conf.c  | 4 +++-
>  tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-defaultconsole.xml | 3 +--
>  2 files changed, 4 insertions(+), 3 deletions(-)

Reviewed-by: Pavel Hrdina 


signature.asc
Description: Digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list