From nobody Sat May 4 00:32:14 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1510152441587555.7580953424166; Wed, 8 Nov 2017 06:47:21 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 191A4804E3; Wed, 8 Nov 2017 14:47:20 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E3D835EDFF; Wed, 8 Nov 2017 14:47:19 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 9BCBF1800BDD; Wed, 8 Nov 2017 14:47:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vA8ElIc2001605 for ; Wed, 8 Nov 2017 09:47:18 -0500 Received: by smtp.corp.redhat.com (Postfix) id B12366BF7E; Wed, 8 Nov 2017 14:47:18 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 10F9A6BF81; Wed, 8 Nov 2017 14:47:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 191A4804E3 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 8 Nov 2017 15:46:56 +0100 Message-Id: <35f2b726d96661e4a207218d2fc20c09eca2e131.1510152416.git.pkrempa@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH] conf: Properly parse X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 08 Nov 2017 14:47:20 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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=3D1509110 Reviewed-by: John Ferlan --- 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 c= txt, char *idx =3D NULL; int ret =3D -1; - if (!(ctxt->node =3D virXPathNode("./backingStore[*]", ctxt))) { + if (!(ctxt->node =3D virXPathNode("./backingStore", ctxt))) { ret =3D 0; goto cleanup; } - if (!(type =3D 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 =3D virXMLPropString(ctxt->node, "type"))) { + VIR_STEAL_PTR(src->backingStore, backingStore); ret =3D 0; goto cleanup; } - if (VIR_ALLOC(backingStore) < 0) - goto cleanup; - if (!(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE) && (idx =3D virXMLPropString(ctxt->node, "index")) && virStrToLong_uip(idx, NULL, 10, &backingStore->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-ac= tive.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-backing-chains-acti= ve.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-labels= kip.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 @@ +
--=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list