storage: gluster: Report error if no volumes were found in pool lookup

Similarly to the 'netfs' pool, return an error if the host does not have
any volumes.
This commit is contained in:
Peter Krempa 2017-01-10 18:35:03 +01:00
parent 7bdb4b8fda
commit ce5055d7bc

View 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;