From nobody Sun Feb 8 21:27:02 2026 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; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1532976466487675.0757478626908; Mon, 30 Jul 2018 11:47:46 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5099230832EA; Mon, 30 Jul 2018 18:47:33 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1BF9D10D7C3E; Mon, 30 Jul 2018 18:47:33 +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 B47854A469; Mon, 30 Jul 2018 18:47:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6UIl3r2000482 for ; Mon, 30 Jul 2018 14:47:03 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3CA6AD0FC2; Mon, 30 Jul 2018 18:47:03 +0000 (UTC) Received: from unknown4CEB42C824F4.redhat.com (ovpn-116-84.phx2.redhat.com [10.3.116.84]) by smtp.corp.redhat.com (Postfix) with ESMTP id 749D5D0CE4 for ; Mon, 30 Jul 2018 18:46:54 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Mon, 30 Jul 2018 14:46:38 -0400 Message-Id: <20180730184648.5059-2-jferlan@redhat.com> In-Reply-To: <20180730184648.5059-1-jferlan@redhat.com> References: <20180730184648.5059-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.27 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 01/11] conf: Add @flags to Storage Pool Def processing 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.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Mon, 30 Jul 2018 18:47:44 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Add a @flags argument when parsing the storage pool definition via the virStoragePoolDefParse{XML|Node|String|File} API's as this will allow us to in the future make parsing decisions based on the @flags. Signed-off-by: John Ferlan --- src/conf/domain_conf.c | 2 +- src/conf/storage_conf.c | 25 ++++++++++++++++--------- src/conf/storage_conf.h | 12 ++++++++---- src/conf/virstorageobj.c | 4 ++-- src/phyp/phyp_driver.c | 2 +- src/storage/storage_driver.c | 4 ++-- src/test/test_driver.c | 6 +++--- tests/storagebackendsheepdogtest.c | 4 ++-- tests/storagepoolxml2xmltest.c | 2 +- tests/storagevolxml2argvtest.c | 4 ++-- tests/storagevolxml2xmltest.c | 2 +- 11 files changed, 39 insertions(+), 28 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index eff8af20e7..42b55f01d4 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -30183,7 +30183,7 @@ virDomainDiskTranslateSourcePool(virDomainDiskDefPt= r def) if (!(poolxml =3D virStoragePoolGetXMLDesc(pool, 0))) goto cleanup; =20 - if (!(pooldef =3D virStoragePoolDefParseString(poolxml))) + if (!(pooldef =3D virStoragePoolDefParseString(poolxml, 0))) goto cleanup; =20 def->src->srcpool->pooltype =3D pooldef->type; diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c index 5036ab9ef8..e5d35cd254 100644 --- a/src/conf/storage_conf.c +++ b/src/conf/storage_conf.c @@ -671,7 +671,8 @@ virStorageDefParsePerms(xmlXPathContextPtr ctxt, =20 =20 virStoragePoolDefPtr -virStoragePoolDefParseXML(xmlXPathContextPtr ctxt) +virStoragePoolDefParseXML(xmlXPathContextPtr ctxt, + unsigned int flags) { virStoragePoolOptionsPtr options; virStoragePoolDefPtr ret; @@ -680,6 +681,8 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt) char *uuid =3D NULL; char *target_path =3D NULL; =20 + virCheckFlags(0, NULL); + if (VIR_ALLOC(ret) < 0) return NULL; =20 @@ -818,7 +821,8 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt) =20 virStoragePoolDefPtr virStoragePoolDefParseNode(xmlDocPtr xml, - xmlNodePtr root) + xmlNodePtr root, + unsigned int flags) { xmlXPathContextPtr ctxt =3D NULL; virStoragePoolDefPtr def =3D NULL; @@ -838,7 +842,7 @@ virStoragePoolDefParseNode(xmlDocPtr xml, } =20 ctxt->node =3D root; - def =3D virStoragePoolDefParseXML(ctxt); + def =3D virStoragePoolDefParseXML(ctxt, flags); cleanup: xmlXPathFreeContext(ctxt); return def; @@ -847,13 +851,14 @@ virStoragePoolDefParseNode(xmlDocPtr xml, =20 static virStoragePoolDefPtr virStoragePoolDefParse(const char *xmlStr, - const char *filename) + const char *filename, + unsigned int flags) { virStoragePoolDefPtr ret =3D NULL; xmlDocPtr xml; =20 if ((xml =3D virXMLParse(filename, xmlStr, _("(storage_pool_definition= )")))) { - ret =3D virStoragePoolDefParseNode(xml, xmlDocGetRootElement(xml)); + ret =3D virStoragePoolDefParseNode(xml, xmlDocGetRootElement(xml),= flags); xmlFreeDoc(xml); } =20 @@ -862,16 +867,18 @@ virStoragePoolDefParse(const char *xmlStr, =20 =20 virStoragePoolDefPtr -virStoragePoolDefParseString(const char *xmlStr) +virStoragePoolDefParseString(const char *xmlStr, + unsigned int flags) { - return virStoragePoolDefParse(xmlStr, NULL); + return virStoragePoolDefParse(xmlStr, NULL, flags); } =20 =20 virStoragePoolDefPtr -virStoragePoolDefParseFile(const char *filename) +virStoragePoolDefParseFile(const char *filename, + unsigned int flags) { - return virStoragePoolDefParse(NULL, filename); + return virStoragePoolDefParse(NULL, filename, flags); } =20 =20 diff --git a/src/conf/storage_conf.h b/src/conf/storage_conf.h index 15dfd8becf..d6886ad6ca 100644 --- a/src/conf/storage_conf.h +++ b/src/conf/storage_conf.h @@ -236,17 +236,21 @@ struct _virStoragePoolSourceList { }; =20 virStoragePoolDefPtr -virStoragePoolDefParseXML(xmlXPathContextPtr ctxt); +virStoragePoolDefParseXML(xmlXPathContextPtr ctxt, + unsigned int flags); =20 virStoragePoolDefPtr -virStoragePoolDefParseString(const char *xml); +virStoragePoolDefParseString(const char *xml, + unsigned int flags); =20 virStoragePoolDefPtr -virStoragePoolDefParseFile(const char *filename); +virStoragePoolDefParseFile(const char *filename, + unsigned int flags); =20 virStoragePoolDefPtr virStoragePoolDefParseNode(xmlDocPtr xml, - xmlNodePtr root); + xmlNodePtr root, + unsigned int flags); =20 char * virStoragePoolDefFormat(virStoragePoolDefPtr def); diff --git a/src/conf/virstorageobj.c b/src/conf/virstorageobj.c index e66b2ebfb2..47209fae96 100644 --- a/src/conf/virstorageobj.c +++ b/src/conf/virstorageobj.c @@ -1110,7 +1110,7 @@ virStoragePoolObjLoad(virStoragePoolObjListPtr pools, virStoragePoolDefPtr def; virStoragePoolObjPtr obj; =20 - if (!(def =3D virStoragePoolDefParseFile(path))) + if (!(def =3D virStoragePoolDefParseFile(path, 0))) return NULL; =20 if (!virFileMatchesNameSuffix(file, def->name, ".xml")) { @@ -1172,7 +1172,7 @@ virStoragePoolObjLoadState(virStoragePoolObjListPtr p= ools, } =20 ctxt->node =3D node; - if (!(def =3D virStoragePoolDefParseXML(ctxt))) + if (!(def =3D virStoragePoolDefParseXML(ctxt, 0))) goto error; =20 if (STRNEQ(name, def->name)) { diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c index d78de83231..99d5dedd81 100644 --- a/src/phyp/phyp_driver.c +++ b/src/phyp/phyp_driver.c @@ -2635,7 +2635,7 @@ phypStoragePoolCreateXML(virConnectPtr conn, virStoragePoolPtr dup_sp =3D NULL; virStoragePoolPtr sp =3D NULL; =20 - if (!(def =3D virStoragePoolDefParseString(xml))) + if (!(def =3D virStoragePoolDefParseString(xml, 0))) goto err; =20 /* checking if this name already exists on this system */ diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index 8070d159ea..491c4fab9b 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -699,7 +699,7 @@ storagePoolCreateXML(virConnectPtr conn, VIR_EXCLUSIVE_FLAGS_RET(VIR_STORAGE_POOL_BUILD_OVERWRITE, VIR_STORAGE_POOL_BUILD_NO_OVERWRITE, NULL); =20 - if (!(newDef =3D virStoragePoolDefParseString(xml))) + if (!(newDef =3D virStoragePoolDefParseString(xml, 0))) goto cleanup; =20 if (virStoragePoolCreateXMLEnsureACL(conn, newDef) < 0) @@ -790,7 +790,7 @@ storagePoolDefineXML(virConnectPtr conn, =20 virCheckFlags(0, NULL); =20 - if (!(newDef =3D virStoragePoolDefParseString(xml))) + if (!(newDef =3D virStoragePoolDefParseString(xml, 0))) goto cleanup; =20 if (virXMLCheckIllegalChars("name", newDef->name, "\n") < 0) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index dfca95c981..1a42a4f74b 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -1104,7 +1104,7 @@ testParseStorage(testDriverPtr privconn, if (!node) goto error; =20 - def =3D virStoragePoolDefParseNode(ctxt->doc, node); + def =3D virStoragePoolDefParseNode(ctxt->doc, node, 0); if (!def) goto error; =20 @@ -4519,7 +4519,7 @@ testStoragePoolCreateXML(virConnectPtr conn, virCheckFlags(0, NULL); =20 testDriverLock(privconn); - if (!(newDef =3D virStoragePoolDefParseString(xml))) + if (!(newDef =3D virStoragePoolDefParseString(xml, 0))) goto cleanup; =20 if (virStoragePoolObjIsDuplicate(privconn->pools, newDef, true) < 0) @@ -4589,7 +4589,7 @@ testStoragePoolDefineXML(virConnectPtr conn, virCheckFlags(0, NULL); =20 testDriverLock(privconn); - if (!(newDef =3D virStoragePoolDefParseString(xml))) + if (!(newDef =3D virStoragePoolDefParseString(xml, 0))) goto cleanup; =20 newDef->capacity =3D defaultPoolCap; diff --git a/tests/storagebackendsheepdogtest.c b/tests/storagebackendsheep= dogtest.c index cc7b163241..c9b80127b8 100644 --- a/tests/storagebackendsheepdogtest.c +++ b/tests/storagebackendsheepdogtest.c @@ -65,7 +65,7 @@ test_node_info_parser(const void *opaque) char *output =3D NULL; virStoragePoolDefPtr pool =3D NULL; =20 - if (!(pool =3D virStoragePoolDefParseFile(data->poolxml))) + if (!(pool =3D virStoragePoolDefParseFile(data->poolxml, 0))) goto cleanup; =20 if (VIR_STRDUP(output, test.output) < 0) @@ -100,7 +100,7 @@ test_vdi_list_parser(const void *opaque) virStoragePoolDefPtr pool =3D NULL; virStorageVolDefPtr vol =3D NULL; =20 - if (!(pool =3D virStoragePoolDefParseFile(data->poolxml))) + if (!(pool =3D virStoragePoolDefParseFile(data->poolxml, 0))) goto cleanup; =20 if (!(vol =3D virStorageVolDefParseFile(pool, data->volxml, 0))) diff --git a/tests/storagepoolxml2xmltest.c b/tests/storagepoolxml2xmltest.c index 974f0afe39..84f2bfb9ec 100644 --- a/tests/storagepoolxml2xmltest.c +++ b/tests/storagepoolxml2xmltest.c @@ -23,7 +23,7 @@ testCompareXMLToXMLFiles(const char *inxml, const char *o= utxml) int ret =3D -1; virStoragePoolDefPtr dev =3D NULL; =20 - if (!(dev =3D virStoragePoolDefParseFile(inxml))) + if (!(dev =3D virStoragePoolDefParseFile(inxml, 0))) goto fail; =20 if (!(actual =3D virStoragePoolDefFormat(dev))) diff --git a/tests/storagevolxml2argvtest.c b/tests/storagevolxml2argvtest.c index b795f83aee..aa55e4dbad 100644 --- a/tests/storagevolxml2argvtest.c +++ b/tests/storagevolxml2argvtest.c @@ -53,7 +53,7 @@ testCompareXMLToArgvFiles(bool shouldFail, virStoragePoolDefPtr inputpool =3D NULL; virStoragePoolObjPtr obj =3D NULL; =20 - if (!(def =3D virStoragePoolDefParseFile(poolxml))) + if (!(def =3D virStoragePoolDefParseFile(poolxml, 0))) goto cleanup; =20 if (!(obj =3D virStoragePoolObjNew())) { @@ -63,7 +63,7 @@ testCompareXMLToArgvFiles(bool shouldFail, virStoragePoolObjSetDef(obj, def); =20 if (inputpoolxml) { - if (!(inputpool =3D virStoragePoolDefParseFile(inputpoolxml))) + if (!(inputpool =3D virStoragePoolDefParseFile(inputpoolxml, 0))) goto cleanup; } =20 diff --git a/tests/storagevolxml2xmltest.c b/tests/storagevolxml2xmltest.c index 7bac4974ae..0ff25451bc 100644 --- a/tests/storagevolxml2xmltest.c +++ b/tests/storagevolxml2xmltest.c @@ -25,7 +25,7 @@ testCompareXMLToXMLFiles(const char *poolxml, const char = *inxml, virStoragePoolDefPtr pool =3D NULL; virStorageVolDefPtr dev =3D NULL; =20 - if (!(pool =3D virStoragePoolDefParseFile(poolxml))) + if (!(pool =3D virStoragePoolDefParseFile(poolxml, 0))) goto fail; =20 if (!(dev =3D virStorageVolDefParseFile(pool, inxml, flags))) --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list