mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
Fix error codes for missing storage pools
The storage pool driver is mistakenly using the error code VIR_ERR_INVALID_STORAGE_POOL which is for diagnosing invalid pointers. This patch switches it to use VIR_ERR_NO_STORAGE_POOL which is the correct code for cases where the storage pool does not exist * src/storage/storage_driver.c: Replace VIR_ERR_INVALID_STORAGE_POOL with VIR_ERR_NO_STORAGE_POOL
This commit is contained in:
parent
e9364d9f2a
commit
627409d1f4
@ -605,7 +605,7 @@ storagePoolUndefine(virStoragePoolPtr obj) {
|
|||||||
storageDriverLock(driver);
|
storageDriverLock(driver);
|
||||||
pool = virStoragePoolObjFindByUUID(&driver->pools, obj->uuid);
|
pool = virStoragePoolObjFindByUUID(&driver->pools, obj->uuid);
|
||||||
if (!pool) {
|
if (!pool) {
|
||||||
virStorageReportError(VIR_ERR_INVALID_STORAGE_POOL,
|
virStorageReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||||
"%s", _("no storage pool with matching uuid"));
|
"%s", _("no storage pool with matching uuid"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -659,7 +659,7 @@ storagePoolStart(virStoragePoolPtr obj,
|
|||||||
storageDriverUnlock(driver);
|
storageDriverUnlock(driver);
|
||||||
|
|
||||||
if (!pool) {
|
if (!pool) {
|
||||||
virStorageReportError(VIR_ERR_INVALID_STORAGE_POOL,
|
virStorageReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||||
"%s", _("no storage pool with matching uuid"));
|
"%s", _("no storage pool with matching uuid"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -704,7 +704,7 @@ storagePoolBuild(virStoragePoolPtr obj,
|
|||||||
storageDriverUnlock(driver);
|
storageDriverUnlock(driver);
|
||||||
|
|
||||||
if (!pool) {
|
if (!pool) {
|
||||||
virStorageReportError(VIR_ERR_INVALID_STORAGE_POOL,
|
virStorageReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||||
"%s", _("no storage pool with matching uuid"));
|
"%s", _("no storage pool with matching uuid"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -741,7 +741,7 @@ storagePoolDestroy(virStoragePoolPtr obj) {
|
|||||||
pool = virStoragePoolObjFindByUUID(&driver->pools, obj->uuid);
|
pool = virStoragePoolObjFindByUUID(&driver->pools, obj->uuid);
|
||||||
|
|
||||||
if (!pool) {
|
if (!pool) {
|
||||||
virStorageReportError(VIR_ERR_INVALID_STORAGE_POOL,
|
virStorageReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||||
"%s", _("no storage pool with matching uuid"));
|
"%s", _("no storage pool with matching uuid"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -797,7 +797,7 @@ storagePoolDelete(virStoragePoolPtr obj,
|
|||||||
storageDriverUnlock(driver);
|
storageDriverUnlock(driver);
|
||||||
|
|
||||||
if (!pool) {
|
if (!pool) {
|
||||||
virStorageReportError(VIR_ERR_INVALID_STORAGE_POOL,
|
virStorageReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||||
"%s", _("no storage pool with matching uuid"));
|
"%s", _("no storage pool with matching uuid"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -846,7 +846,7 @@ storagePoolRefresh(virStoragePoolPtr obj,
|
|||||||
pool = virStoragePoolObjFindByUUID(&driver->pools, obj->uuid);
|
pool = virStoragePoolObjFindByUUID(&driver->pools, obj->uuid);
|
||||||
|
|
||||||
if (!pool) {
|
if (!pool) {
|
||||||
virStorageReportError(VIR_ERR_INVALID_STORAGE_POOL,
|
virStorageReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||||
"%s", _("no storage pool with matching uuid"));
|
"%s", _("no storage pool with matching uuid"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -902,7 +902,7 @@ storagePoolGetInfo(virStoragePoolPtr obj,
|
|||||||
storageDriverUnlock(driver);
|
storageDriverUnlock(driver);
|
||||||
|
|
||||||
if (!pool) {
|
if (!pool) {
|
||||||
virStorageReportError(VIR_ERR_INVALID_STORAGE_POOL,
|
virStorageReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||||
"%s", _("no storage pool with matching uuid"));
|
"%s", _("no storage pool with matching uuid"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -938,7 +938,7 @@ storagePoolDumpXML(virStoragePoolPtr obj,
|
|||||||
storageDriverUnlock(driver);
|
storageDriverUnlock(driver);
|
||||||
|
|
||||||
if (!pool) {
|
if (!pool) {
|
||||||
virStorageReportError(VIR_ERR_INVALID_STORAGE_POOL,
|
virStorageReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||||
"%s", _("no storage pool with matching uuid"));
|
"%s", _("no storage pool with matching uuid"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -963,7 +963,7 @@ storagePoolGetAutostart(virStoragePoolPtr obj,
|
|||||||
storageDriverUnlock(driver);
|
storageDriverUnlock(driver);
|
||||||
|
|
||||||
if (!pool) {
|
if (!pool) {
|
||||||
virStorageReportError(VIR_ERR_INVALID_STORAGE_POOL,
|
virStorageReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||||
"%s", _("no pool with matching uuid"));
|
"%s", _("no pool with matching uuid"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -992,13 +992,13 @@ storagePoolSetAutostart(virStoragePoolPtr obj,
|
|||||||
pool = virStoragePoolObjFindByUUID(&driver->pools, obj->uuid);
|
pool = virStoragePoolObjFindByUUID(&driver->pools, obj->uuid);
|
||||||
|
|
||||||
if (!pool) {
|
if (!pool) {
|
||||||
virStorageReportError(VIR_ERR_INVALID_STORAGE_POOL,
|
virStorageReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||||
"%s", _("no pool with matching uuid"));
|
"%s", _("no pool with matching uuid"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pool->configFile) {
|
if (!pool->configFile) {
|
||||||
virStorageReportError(VIR_ERR_INVALID_ARG,
|
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("pool has no config file"));
|
"%s", _("pool has no config file"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -1054,7 +1054,7 @@ storagePoolNumVolumes(virStoragePoolPtr obj) {
|
|||||||
storageDriverUnlock(driver);
|
storageDriverUnlock(driver);
|
||||||
|
|
||||||
if (!pool) {
|
if (!pool) {
|
||||||
virStorageReportError(VIR_ERR_INVALID_STORAGE_POOL,
|
virStorageReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||||
"%s", _("no storage pool with matching uuid"));
|
"%s", _("no storage pool with matching uuid"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -1087,7 +1087,7 @@ storagePoolListVolumes(virStoragePoolPtr obj,
|
|||||||
storageDriverUnlock(driver);
|
storageDriverUnlock(driver);
|
||||||
|
|
||||||
if (!pool) {
|
if (!pool) {
|
||||||
virStorageReportError(VIR_ERR_INVALID_STORAGE_POOL,
|
virStorageReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||||
"%s", _("no storage pool with matching uuid"));
|
"%s", _("no storage pool with matching uuid"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -1132,7 +1132,7 @@ storageVolumeLookupByName(virStoragePoolPtr obj,
|
|||||||
storageDriverUnlock(driver);
|
storageDriverUnlock(driver);
|
||||||
|
|
||||||
if (!pool) {
|
if (!pool) {
|
||||||
virStorageReportError(VIR_ERR_INVALID_STORAGE_POOL,
|
virStorageReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||||
"%s", _("no storage pool with matching uuid"));
|
"%s", _("no storage pool with matching uuid"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -1186,7 +1186,7 @@ storageVolumeLookupByKey(virConnectPtr conn,
|
|||||||
storageDriverUnlock(driver);
|
storageDriverUnlock(driver);
|
||||||
|
|
||||||
if (!ret)
|
if (!ret)
|
||||||
virStorageReportError(VIR_ERR_INVALID_STORAGE_VOL,
|
virStorageReportError(VIR_ERR_NO_STORAGE_VOL,
|
||||||
"%s", _("no storage vol with matching key"));
|
"%s", _("no storage vol with matching key"));
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@ -1237,7 +1237,7 @@ storageVolumeLookupByPath(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!ret)
|
if (!ret)
|
||||||
virStorageReportError(VIR_ERR_INVALID_STORAGE_VOL,
|
virStorageReportError(VIR_ERR_NO_STORAGE_VOL,
|
||||||
"%s", _("no storage vol with matching path"));
|
"%s", _("no storage vol with matching path"));
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
@ -1263,7 +1263,7 @@ storageVolumeCreateXML(virStoragePoolPtr obj,
|
|||||||
storageDriverUnlock(driver);
|
storageDriverUnlock(driver);
|
||||||
|
|
||||||
if (!pool) {
|
if (!pool) {
|
||||||
virStorageReportError(VIR_ERR_INVALID_STORAGE_POOL,
|
virStorageReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||||
"%s", _("no storage pool with matching uuid"));
|
"%s", _("no storage pool with matching uuid"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -1282,7 +1282,7 @@ storageVolumeCreateXML(virStoragePoolPtr obj,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (virStorageVolDefFindByName(pool, voldef->name)) {
|
if (virStorageVolDefFindByName(pool, voldef->name)) {
|
||||||
virStorageReportError(VIR_ERR_INVALID_STORAGE_POOL,
|
virStorageReportError(VIR_ERR_NO_STORAGE_VOL,
|
||||||
"%s", _("storage vol already exists"));
|
"%s", _("storage vol already exists"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -1384,7 +1384,7 @@ storageVolumeCreateXMLFrom(virStoragePoolPtr obj,
|
|||||||
}
|
}
|
||||||
storageDriverUnlock(driver);
|
storageDriverUnlock(driver);
|
||||||
if (!pool) {
|
if (!pool) {
|
||||||
virStorageReportError(VIR_ERR_INVALID_STORAGE_POOL,
|
virStorageReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||||
"%s", _("no storage pool with matching uuid"));
|
"%s", _("no storage pool with matching uuid"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -1424,7 +1424,7 @@ storageVolumeCreateXMLFrom(virStoragePoolPtr obj,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (virStorageVolDefFindByName(pool, newvol->name)) {
|
if (virStorageVolDefFindByName(pool, newvol->name)) {
|
||||||
virStorageReportError(VIR_ERR_INVALID_STORAGE_POOL,
|
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("storage volume name '%s' already in use."),
|
_("storage volume name '%s' already in use."),
|
||||||
newvol->name);
|
newvol->name);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -1688,7 +1688,7 @@ storageVolumeWipe(virStorageVolPtr obj,
|
|||||||
storageDriverUnlock(driver);
|
storageDriverUnlock(driver);
|
||||||
|
|
||||||
if (!pool) {
|
if (!pool) {
|
||||||
virStorageReportError(VIR_ERR_INVALID_STORAGE_POOL,
|
virStorageReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||||
"%s", _("no storage pool with matching uuid"));
|
"%s", _("no storage pool with matching uuid"));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -1745,7 +1745,7 @@ storageVolumeDelete(virStorageVolPtr obj,
|
|||||||
storageDriverUnlock(driver);
|
storageDriverUnlock(driver);
|
||||||
|
|
||||||
if (!pool) {
|
if (!pool) {
|
||||||
virStorageReportError(VIR_ERR_INVALID_STORAGE_POOL,
|
virStorageReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||||
"%s", _("no storage pool with matching uuid"));
|
"%s", _("no storage pool with matching uuid"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -1824,7 +1824,7 @@ storageVolumeGetInfo(virStorageVolPtr obj,
|
|||||||
storageDriverUnlock(driver);
|
storageDriverUnlock(driver);
|
||||||
|
|
||||||
if (!pool) {
|
if (!pool) {
|
||||||
virStorageReportError(VIR_ERR_INVALID_STORAGE_POOL,
|
virStorageReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||||
"%s", _("no storage pool with matching uuid"));
|
"%s", _("no storage pool with matching uuid"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -1877,7 +1877,7 @@ storageVolumeGetXMLDesc(virStorageVolPtr obj,
|
|||||||
storageDriverUnlock(driver);
|
storageDriverUnlock(driver);
|
||||||
|
|
||||||
if (!pool) {
|
if (!pool) {
|
||||||
virStorageReportError(VIR_ERR_INVALID_STORAGE_POOL,
|
virStorageReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||||
"%s", _("no storage pool with matching uuid"));
|
"%s", _("no storage pool with matching uuid"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -1924,7 +1924,7 @@ storageVolumeGetPath(virStorageVolPtr obj) {
|
|||||||
pool = virStoragePoolObjFindByName(&driver->pools, obj->pool);
|
pool = virStoragePoolObjFindByName(&driver->pools, obj->pool);
|
||||||
storageDriverUnlock(driver);
|
storageDriverUnlock(driver);
|
||||||
if (!pool) {
|
if (!pool) {
|
||||||
virStorageReportError(VIR_ERR_INVALID_STORAGE_POOL,
|
virStorageReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||||
"%s", _("no storage pool with matching uuid"));
|
"%s", _("no storage pool with matching uuid"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user