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 ae0611543..0bd40f742 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;
--
2.11.0