From: Peter Krempa Date: Tue, 10 Jan 2017 17:35:03 +0000 (+0100) Subject: storage: gluster: Report error if no volumes were found in pool lookup X-Git-Tag: CVE-2017-2635~285 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ce5055d7bcd98ea3689e7cdf07d2a8bb1dbb8ba8;p=thirdparty%2Flibvirt.git storage: gluster: Report error if no volumes were found in pool lookup Similarly to the 'netfs' pool, return an error if the host does not have any volumes. --- diff --git a/src/storage/storage_backend_gluster.c b/src/storage/storage_backend_gluster.c index ae0611543c..0bd40f742b 100644 --- a/src/storage/storage_backend_gluster.c +++ b/src/storage/storage_backend_gluster.c @@ -490,6 +490,7 @@ virStorageBackendGlusterFindPoolSources(virConnectPtr conn ATTRIBUTE_UNUSED, }; virStoragePoolSourcePtr source = NULL; char *ret = NULL; + int rc; size_t i; virCheckFlags(0, NULL); @@ -510,11 +511,18 @@ virStorageBackendGlusterFindPoolSources(virConnectPtr conn ATTRIBUTE_UNUSED, goto cleanup; } - if (virStorageBackendFindGlusterPoolSources(source->hosts[0].name, - 0, /* currently ignored */ - &list) < 0) + if ((rc = virStorageBackendFindGlusterPoolSources(source->hosts[0].name, + 0, /* currently ignored */ + &list)) < 0) goto cleanup; + if (rc == 0) { + virReportError(VIR_ERR_OPERATION_FAILED, + _("no storage pools were found on host '%s'"), + source->hosts[0].name); + goto cleanup; + } + if (!(ret = virStoragePoolSourceListFormat(&list))) goto cleanup;