From ce5055d7bcd98ea3689e7cdf07d2a8bb1dbb8ba8 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Tue, 10 Jan 2017 18:35:03 +0100 Subject: [PATCH] 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. --- src/storage/storage_backend_gluster.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) 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; -- GitLab