From: Cole Robinson Date: Thu, 8 Oct 2009 14:24:37 +0000 (-0400) Subject: storage: Report errors in FindPoolSources X-Git-Tag: v0.7.2~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e3f5dbcdf01040f44188fa9d32c1a1ead0216444;p=thirdparty%2Flibvirt.git storage: Report errors in FindPoolSources --- diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index 9ab53e14e2..4f8949b34c 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -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;