[PATCH 2/4] storage: gluster: Report error if no volumes were found in pool lookup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux