From nobody Tue Apr 23 15:13:16 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.zoho.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 1490793976044861.8704076942092; Wed, 29 Mar 2017 06:26:16 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3124E61BAD; Wed, 29 Mar 2017 13:26:14 +0000 (UTC) Received: from colo-mx.corp.redhat.com (unknown [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 026CFB23EC; Wed, 29 Mar 2017 13:26:14 +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 F173D5EC63; Wed, 29 Mar 2017 13:26:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2TDMiad014944 for ; Wed, 29 Mar 2017 09:22:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id D73FC189EB; Wed, 29 Mar 2017 13:22:44 +0000 (UTC) Received: from angien.brq.redhat.com (dhcp129-47.brq.redhat.com [10.34.129.47]) by smtp.corp.redhat.com (Postfix) with ESMTP id 355B318992; Wed, 29 Mar 2017 13:22:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3124E61BAD Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 3124E61BAD From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 29 Mar 2017 15:23:38 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 1/3] storage: util: Split out the gluster volume extraction code into new function 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 29 Mar 2017 13:26:15 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" To allow testing of the algorithm, split out the extractor into a separate helper. --- src/storage/storage_util.c | 93 +++++++++++++++++++++++++++---------------= ---- src/storage/storage_util.h | 4 ++ 2 files changed, 58 insertions(+), 39 deletions(-) diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c index 7687eb89a..8459e9d5b 100644 --- a/src/storage/storage_util.c +++ b/src/storage/storage_util.c @@ -2836,6 +2836,59 @@ virStorageBackendDeleteLocal(virConnectPtr conn ATTR= IBUTE_UNUSED, } +int +virStorageUtilGlusterExtractPoolSources(const char *host, + const char *xml, + int pooltype, + virStoragePoolSourceListPtr list) +{ + xmlDocPtr doc =3D NULL; + xmlXPathContextPtr ctxt =3D NULL; + xmlNodePtr *nodes =3D NULL; + virStoragePoolSource *src =3D NULL; + size_t i; + int nnodes; + int ret =3D -1; + + if (!(doc =3D virXMLParseStringCtxt(xml, _("(gluster_cli_output)"), &c= txt))) + goto cleanup; + + if ((nnodes =3D virXPathNodeSet("//volumes/volume", ctxt, &nodes)) < 0) + goto cleanup; + + for (i =3D 0; i < nnodes; i++) { + ctxt->node =3D nodes[i]; + + if (!(src =3D virStoragePoolSourceListNewSource(list))) + goto cleanup; + + if (!(src->dir =3D virXPathString("string(//name)", ctxt))) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("failed to extract gluster volume name")); + goto cleanup; + } + + if (VIR_ALLOC_N(src->hosts, 1) < 0) + goto cleanup; + src->nhost =3D 1; + + if (VIR_STRDUP(src->hosts[0].name, host) < 0) + goto cleanup; + + src->format =3D pooltype; + } + + ret =3D nnodes; + + cleanup: + VIR_FREE(nodes); + xmlXPathFreeContext(ctxt); + xmlFreeDoc(doc); + + return ret; +} + + /** * virStorageBackendFindGlusterPoolSources: * @host: host to detect volumes on @@ -2856,12 +2909,6 @@ virStorageBackendFindGlusterPoolSources(const char *= host, char *glusterpath =3D NULL; char *outbuf =3D NULL; virCommandPtr cmd =3D NULL; - xmlDocPtr doc =3D NULL; - xmlXPathContextPtr ctxt =3D NULL; - xmlNodePtr *nodes =3D NULL; - virStoragePoolSource *src =3D NULL; - size_t i; - int nnodes; int rc; int ret =3D -1; @@ -2892,41 +2939,9 @@ virStorageBackendFindGlusterPoolSources(const char *= host, goto cleanup; } - if (!(doc =3D virXMLParseStringCtxt(outbuf, _("(gluster_cli_output)"), - &ctxt))) - goto cleanup; - - if ((nnodes =3D virXPathNodeSet("//volumes/volume", ctxt, &nodes)) < 0) - goto cleanup; - - for (i =3D 0; i < nnodes; i++) { - ctxt->node =3D nodes[i]; - - if (!(src =3D virStoragePoolSourceListNewSource(list))) - goto cleanup; - - if (!(src->dir =3D virXPathString("string(//name)", ctxt))) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("failed to extract gluster volume name")); - goto cleanup; - } - - if (VIR_ALLOC_N(src->hosts, 1) < 0) - goto cleanup; - src->nhost =3D 1; - - if (VIR_STRDUP(src->hosts[0].name, host) < 0) - goto cleanup; - - src->format =3D pooltype; - } - - ret =3D nnodes; + ret =3D virStorageUtilGlusterExtractPoolSources(host, outbuf, pooltype= , list); cleanup: - VIR_FREE(nodes); - xmlXPathFreeContext(ctxt); - xmlFreeDoc(doc); VIR_FREE(outbuf); virCommandFree(cmd); VIR_FREE(glusterpath); diff --git a/src/storage/storage_util.h b/src/storage/storage_util.h index fa3b6522c..bf8424808 100644 --- a/src/storage/storage_util.h +++ b/src/storage/storage_util.h @@ -93,6 +93,10 @@ int virStorageBackendDeleteLocal(virConnectPtr conn, int virStorageBackendRefreshLocal(virConnectPtr conn, virStoragePoolObjPtr pool); +int virStorageUtilGlusterExtractPoolSources(const char *host, + const char *xml, + int pooltype, + virStoragePoolSourceListPtr li= st); int virStorageBackendFindGlusterPoolSources(const char *host, int pooltype, virStoragePoolSourceListPtr li= st, --=20 2.12.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Apr 23 15:13:16 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.zoho.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 1490793982294813.0884589130588; Wed, 29 Mar 2017 06:26:22 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 69D2D7E9CD; Wed, 29 Mar 2017 13:26: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 3640218992; Wed, 29 Mar 2017 13:26:20 +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 D748118523CA; Wed, 29 Mar 2017 13:26:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2TDMjjW014952 for ; Wed, 29 Mar 2017 09:22:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id CFA0C18992; Wed, 29 Mar 2017 13:22:45 +0000 (UTC) Received: from angien.brq.redhat.com (dhcp129-47.brq.redhat.com [10.34.129.47]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2FC1318993; Wed, 29 Mar 2017 13:22:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 69D2D7E9CD Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 69D2D7E9CD From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 29 Mar 2017 15:23:39 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 2/3] test: Introduce testing of virStorageUtilGlusterExtractPoolSources 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 29 Mar 2017 13:26:21 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Add a test program called virstorageutiltest and test the gluster pool detection code. --- tests/Makefile.am | 15 ++- .../virstorageutildata/gluster-parse-basic-dst.xml | 6 ++ .../virstorageutildata/gluster-parse-basic-src.xml | 47 ++++++++++ tests/virstorageutiltest.c | 102 +++++++++++++++++= ++++ 4 files changed, 167 insertions(+), 3 deletions(-) create mode 100644 tests/virstorageutildata/gluster-parse-basic-dst.xml create mode 100644 tests/virstorageutildata/gluster-parse-basic-src.xml create mode 100644 tests/virstorageutiltest.c diff --git a/tests/Makefile.am b/tests/Makefile.am index a6f189b8b..254c4c0ad 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -160,7 +160,9 @@ EXTRA_DIST =3D \ xlconfigdata \ xmconfigdata \ xml2sexprdata \ - xml2vmxdata + xml2vmxdata \ + virstorageutildata \ + $(NULL) test_helpers =3D commandhelper ssh test_programs =3D virshtest sockettest \ @@ -352,7 +354,7 @@ test_programs +=3D nwfilterxml2firewalltest endif WITH_NWFILTER if WITH_STORAGE -test_programs +=3D storagevolxml2argvtest +test_programs +=3D storagevolxml2argvtest virstorageutiltest endif WITH_STORAGE if WITH_STORAGE_FS @@ -859,6 +861,13 @@ genericxml2xmltest_LDADD =3D $(LDADDS) if WITH_STORAGE +virstorageutiltest_SOURCES =3D \ + virstorageutiltest.c testutils.c testutils.h +virstorageutiltest_LDADD =3D \ + ../src/libvirt_driver_storage_impl.la \ + $(LDADDS) \ + $(NULL) + storagevolxml2argvtest_SOURCES =3D \ storagevolxml2argvtest.c \ testutils.c testutils.h @@ -867,7 +876,7 @@ storagevolxml2argvtest_LDADD =3D \ ../src/libvirt_driver_storage_impl.la $(LDADDS) else ! WITH_STORAGE -EXTRA_DIST +=3D storagevolxml2argvtest.c +EXTRA_DIST +=3D storagevolxml2argvtest.c virstorageutiltest.c endif ! WITH_STORAGE storagevolxml2xmltest_SOURCES =3D \ diff --git a/tests/virstorageutildata/gluster-parse-basic-dst.xml b/tests/v= irstorageutildata/gluster-parse-basic-dst.xml new file mode 100644 index 000000000..fbde06f3b --- /dev/null +++ b/tests/virstorageutildata/gluster-parse-basic-dst.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/tests/virstorageutildata/gluster-parse-basic-src.xml b/tests/v= irstorageutildata/gluster-parse-basic-src.xml new file mode 100644 index 000000000..08f97cb72 --- /dev/null +++ b/tests/virstorageutildata/gluster-parse-basic-src.xml @@ -0,0 +1,47 @@ + + + 0 + 0 + + + + + vol0 + ac14dfa5-0b98-4593-a2aa-9fe2bb9b9ce3 + 1 + Started + 0 + 2 + 2 + 1 + 2 + 0 + 0 + 0 + 2 + Replicate + 0 + + virt-gluste= r-node1:/bricks/brick1/brickvirt-gluster-node1:/bricks/brick1/bricka6f5ddea-bc6a-44db-ae1d-5aa1db7434900<= /isArbiter> + virt-gluste= r-node2:/bricks/brick1/brickvirt-gluster-node2:/bricks/brick1/brickf4ab9fb1-44ec-443b-8783-e5f70ed78da30<= /isArbiter> + + 3 + + + + + + + 1 + + + diff --git a/tests/virstorageutiltest.c b/tests/virstorageutiltest.c new file mode 100644 index 000000000..0d4ede6c2 --- /dev/null +++ b/tests/virstorageutiltest.c @@ -0,0 +1,102 @@ +/* + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * . + */ + +#include + +#include + +#include "testutils.h" +#include "virerror.h" +#include "virfile.h" +#include "virlog.h" +#include "virstring.h" + +#include "storage/storage_util.h" + +#define VIR_FROM_THIS VIR_FROM_NONE + +VIR_LOG_INIT("tests.storageutiltest"); + + +static int +testGlusterLookupParse(const void *data) +{ + virStoragePoolSourceList list =3D { .type =3D VIR_STORAGE_POOL_GLUSTER, + .nsources =3D 0, + .sources =3D NULL + }; + const char *testname =3D data; + size_t i; + char *srcxml =3D NULL; + char *srcxmldata =3D NULL; + char *destxml =3D NULL; + char *actual =3D NULL; + int ret =3D -1; + + if (virAsprintf(&srcxml, + "%s/virstorageutildata/gluster-parse-%s-src.xml", + abs_srcdir, testname) < 0 || + virAsprintf(&destxml, + "%s/virstorageutildata/gluster-parse-%s-dst.xml", + abs_srcdir, testname) < 0) + goto cleanup; + + if (virTestLoadFile(srcxml, &srcxmldata) < 0) + goto cleanup; + + if (virStorageUtilGlusterExtractPoolSources("testhost", srcxmldata, + VIR_STORAGE_POOL_GLUSTER, + &list) < 0) + goto cleanup; + + if (!(actual =3D virStoragePoolSourceListFormat(&list))) + goto cleanup; + + ret =3D virTestCompareToFile(actual, destxml); + + cleanup: + VIR_FREE(srcxml); + VIR_FREE(srcxmldata); + VIR_FREE(destxml); + VIR_FREE(actual); + + for (i =3D 0; i < list.nsources; i++) + virStoragePoolSourceClear(&list.sources[i]); + VIR_FREE(list.sources); + + + return ret; +} + + +static int +mymain(void) +{ + int ret =3D 0; + +#define DO_TEST_GLUSTER_LOOKUP(testname) = \ + if (virTestRun("gluster lookup " testname, testGlusterLookupParse, = \ + testname) < 0) = \ + ret =3D -1 + + DO_TEST_GLUSTER_LOOKUP("basic"); + +#undef DO_TEST_GLUSTER_LOOKUP + + return ret =3D=3D 0 ? EXIT_SUCCESS : EXIT_FAILURE; +} + +VIRT_TEST_MAIN(mymain) --=20 2.12.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Apr 23 15:13:16 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.zoho.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 1490794148777341.2245721754407; Wed, 29 Mar 2017 06:29:08 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 164CA81129; Wed, 29 Mar 2017 13:29:07 +0000 (UTC) Received: from colo-mx.corp.redhat.com (unknown [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E09688386C; Wed, 29 Mar 2017 13:29:06 +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 9B7095EC64; Wed, 29 Mar 2017 13:29:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2TDMkOM014960 for ; Wed, 29 Mar 2017 09:22:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id E5BA48386E; Wed, 29 Mar 2017 13:22:46 +0000 (UTC) Received: from angien.brq.redhat.com (dhcp129-47.brq.redhat.com [10.34.129.47]) by smtp.corp.redhat.com (Postfix) with ESMTP id 296F88386C; Wed, 29 Mar 2017 13:22:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 164CA81129 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=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 164CA81129 From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 29 Mar 2017 15:23:40 +0200 Message-Id: <22f347113d04053e908fac64ddd20c9fcb531b09.1490793772.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 3/3] storage: Fix XPath for looking up gluster volume name 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 29 Mar 2017 13:29:07 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Use the relative lookup specifier rather than the global one. Otherwise only the first name would be looked up. Add a test case to cover the scenario. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1436574 --- src/storage/storage_util.c | 2 +- .../gluster-parse-multivol-dst.xml | 14 ++++++++++ .../gluster-parse-multivol-src.xml | 32 ++++++++++++++++++= ++++ tests/virstorageutiltest.c | 1 + 4 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 tests/virstorageutildata/gluster-parse-multivol-dst.xml create mode 100644 tests/virstorageutildata/gluster-parse-multivol-src.xml diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c index 8459e9d5b..e949fc3d4 100644 --- a/src/storage/storage_util.c +++ b/src/storage/storage_util.c @@ -2862,7 +2862,7 @@ virStorageUtilGlusterExtractPoolSources(const char *h= ost, if (!(src =3D virStoragePoolSourceListNewSource(list))) goto cleanup; - if (!(src->dir =3D virXPathString("string(//name)", ctxt))) { + if (!(src->dir =3D virXPathString("string(./name)", ctxt))) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("failed to extract gluster volume name")); goto cleanup; diff --git a/tests/virstorageutildata/gluster-parse-multivol-dst.xml b/test= s/virstorageutildata/gluster-parse-multivol-dst.xml new file mode 100644 index 000000000..d2d8fefc6 --- /dev/null +++ b/tests/virstorageutildata/gluster-parse-multivol-dst.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/tests/virstorageutildata/gluster-parse-multivol-src.xml b/test= s/virstorageutildata/gluster-parse-multivol-src.xml new file mode 100644 index 000000000..0c1f9d10e --- /dev/null +++ b/tests/virstorageutildata/gluster-parse-multivol-src.xml @@ -0,0 +1,32 @@ + + + + 0 + 0 + + + + + aaa + d0b219d4-4169-4907-8994-d2e2434854ed + 0 + Created + 0 + + + test + 32826068-2320-4b62-a825-2554edb7f020 + 1 + Started + 0 + + + test1 + dfa070f4-b12f-4166-8d68-041b73127abc + 0 + Created + + 3 + + + diff --git a/tests/virstorageutiltest.c b/tests/virstorageutiltest.c index 0d4ede6c2..90f86233d 100644 --- a/tests/virstorageutiltest.c +++ b/tests/virstorageutiltest.c @@ -93,6 +93,7 @@ mymain(void) ret =3D -1 DO_TEST_GLUSTER_LOOKUP("basic"); + DO_TEST_GLUSTER_LOOKUP("multivol"); #undef DO_TEST_GLUSTER_LOOKUP --=20 2.12.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list