]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
storage: Report errors in FindPoolSources
authorCole Robinson <crobinso@redhat.com>
Thu, 8 Oct 2009 14:24:37 +0000 (10:24 -0400)
committerCole Robinson <crobinso@redhat.com>
Tue, 13 Oct 2009 14:56:42 +0000 (10:56 -0400)
src/storage/storage_driver.c

index 9ab53e14e2c446147fa60ef7df83f9e8f538eb93..4f8949b34c7c25452ace61471a6a3bcace598319 100644 (file)
@@ -440,15 +440,24 @@ storageFindPoolSources(virConnectPtr conn,
     char *ret = NULL;
 
     backend_type = virStoragePoolTypeFromString(type);
-    if (backend_type < 0)
+    if (backend_type < 0) {
+        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+                              _("unknown storage pool type %s"), type);
         goto cleanup;
+    }
 
     backend = virStorageBackendForType(backend_type);
     if (backend == NULL)
         goto cleanup;
 
-    if (backend->findPoolSources)
-        ret = backend->findPoolSources(conn, srcSpec, flags);
+    if (!backend->findPoolSources) {
+        virStorageReportError(conn, VIR_ERR_NO_SUPPORT,
+                              _("pool type '%s' does not support source "
+                                "discovery"), type);
+        goto cleanup;
+    }
+
+    ret = backend->findPoolSources(conn, srcSpec, flags);
 
 cleanup:
     return ret;