]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
storage: gluster: Report error if no volumes were found in pool lookup
authorPeter Krempa <pkrempa@redhat.com>
Tue, 10 Jan 2017 17:35:03 +0000 (18:35 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 18 Jan 2017 09:45:15 +0000 (10:45 +0100)
Similarly to the 'netfs' pool, return an error if the host does not have
any volumes.

src/storage/storage_backend_gluster.c

index ae0611543c9a733ce8108c58666f6210129b94d5..0bd40f742b5c5f0d70d5b4a94028fecab86bee8f 100644 (file)
@@ -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;