Re: [libvirt] [PATCH] conf: Properly parse

2017-11-09 Thread John Ferlan


On 11/08/2017 09:46 AM, Peter Krempa wrote:
> The terminator would not be parsed properly since the XPath selector was
> looking for an populated element, and also the code did not bother
> assigning the terminating virStorageSourcePtr to the backingStore
> property of the parent.
> 
> Some tests would catch it if there wasn't bigger fallout from the change
> to backing store termination in a693fdba0111. Fix them properly now.
> 
> Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1509110
> ---
>  src/conf/domain_conf.c | 14 
> ++
>  .../qemuxml2xmlout-disk-active-commit.xml  |  1 +
>  .../qemuxml2xmlout-disk-backing-chains-active.xml  |  3 +++
>  .../qemuxml2xmlout-disk-mirror-active.xml  |  4 
>  .../qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-old.xml  |  4 
>  .../qemuxml2xmlout-seclabel-static-labelskip.xml   |  1 +
>  6 files changed, 19 insertions(+), 8 deletions(-)
> 

FAIL: qemuhotplugtest
44) base-live+disk-scsi-wwn ATTACH disk-scsi-duplicate-wwn...
In
'/home/jferlan/git/libvirt.work/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-scsi-wwn+disk-scsi-duplicate-wwn.xml':
Offset 693
Expect [t]
Actual [backingStore/>
  

John

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


[libvirt] [PATCH] conf: Properly parse

2017-11-08 Thread Peter Krempa
The terminator would not be parsed properly since the XPath selector was
looking for an populated element, and also the code did not bother
assigning the terminating virStorageSourcePtr to the backingStore
property of the parent.

Some tests would catch it if there wasn't bigger fallout from the change
to backing store termination in a693fdba0111. Fix them properly now.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1509110
---
 src/conf/domain_conf.c | 14 ++
 .../qemuxml2xmlout-disk-active-commit.xml  |  1 +
 .../qemuxml2xmlout-disk-backing-chains-active.xml  |  3 +++
 .../qemuxml2xmlout-disk-mirror-active.xml  |  4 
 .../qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-old.xml  |  4 
 .../qemuxml2xmlout-seclabel-static-labelskip.xml   |  1 +
 6 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 7dfd7b54e..a1ca307c4 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -8545,23 +8545,21 @@ virDomainDiskBackingStoreParse(xmlXPathContextPtr ctxt,
 char *idx = NULL;
 int ret = -1;

-if (!(ctxt->node = virXPathNode("./backingStore[*]", ctxt))) {
+if (!(ctxt->node = virXPathNode("./backingStore", ctxt))) {
 ret = 0;
 goto cleanup;
 }

-if (!(type = virXMLPropString(ctxt->node, "type"))) {
-/* terminator does not have a type */
-if (VIR_ALLOC(backingStore) < 0)
-goto cleanup;
+if (VIR_ALLOC(backingStore) < 0)
+goto cleanup;

+/* terminator does not have a type */
+if (!(type = virXMLPropString(ctxt->node, "type"))) {
+VIR_STEAL_PTR(src->backingStore, backingStore);
 ret = 0;
 goto cleanup;
 }

-if (VIR_ALLOC(backingStore) < 0)
-goto cleanup;
-
 if (!(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE) &&
 (idx = virXMLPropString(ctxt->node, "index")) &&
 virStrToLong_uip(idx, NULL, 10, >id) < 0) {
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-active-commit.xml 
b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-active-commit.xml
index 5766e4aea..cc26af109 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-active-commit.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-active-commit.xml
@@ -20,6 +20,7 @@
   
 
 
+
   
   
 
diff --git 
a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-backing-chains-active.xml 
b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-backing-chains-active.xml
index 828defcc2..d1fd2442c 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-backing-chains-active.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-backing-chains-active.xml
@@ -49,6 +49,7 @@
 
   
   
+  
 
   
 
@@ -63,6 +64,7 @@
   
 
   
+  
   
   
 
@@ -79,6 +81,7 @@
   
 
 
+
   
   
   
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-active.xml 
b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-active.xml
index 252bde338..c1e8a33ec 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-active.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-active.xml
@@ -16,6 +16,7 @@
 /usr/bin/qemu-system-i686
 
   
+  
   
 
   
@@ -24,12 +25,14 @@
 
 
   
+  
   
   
   
 
 
   
+  
   
 
 
@@ -39,6 +42,7 @@
 
 
   
+  
   
 
 
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-old.xml 
b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-old.xml
index f4bd39a58..e390bc02f 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-old.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-old.xml
@@ -16,6 +16,7 @@
 /usr/bin/qemu-system-i686
 
   
+  
   
 
   
@@ -24,12 +25,14 @@
 
 
   
+  
   
   
   
 
 
   
+  
   
 
 
@@ -39,6 +42,7 @@
 
 
   
+  
   
   
 
diff --git 
a/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-static-labelskip.xml 
b/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-static-labelskip.xml
index 91f573db7..d37b950cb 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-static-labelskip.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-static-labelskip.xml
@@ -18,6 +18,7 @@
   
 
   
+  
   
   
 
-- 
2.14.3

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