[libvirt] [PATCH 09/11] Fix error codes returned when a storage pool is inactive
Daniel P. Berrange
berrange at redhat.com
Fri Nov 12 16:22:42 UTC 2010
Many operations are not valid on inactive storage pools. The
storage driver is currently returning VIR_ERR_INTERNAL_ERROR
in these cases, rather than the more suitable error code
VIR_ERR_OPERATION_INVALID
* src/storage/storage_driver.c: Fix error code when pool
is not active
---
src/storage/storage_driver.c | 34 +++++++++++++++++-----------------
1 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index 9912429..f96068e 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -627,7 +627,7 @@ storagePoolUndefine(virStoragePoolPtr obj) {
}
if (virStoragePoolObjIsActive(pool)) {
- virStorageReportError(VIR_ERR_INTERNAL_ERROR,
+ virStorageReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("pool is still active"));
goto cleanup;
}
@@ -684,7 +684,7 @@ storagePoolStart(virStoragePoolPtr obj,
goto cleanup;
if (virStoragePoolObjIsActive(pool)) {
- virStorageReportError(VIR_ERR_INTERNAL_ERROR,
+ virStorageReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("pool already active"));
goto cleanup;
}
@@ -729,7 +729,7 @@ storagePoolBuild(virStoragePoolPtr obj,
goto cleanup;
if (virStoragePoolObjIsActive(pool)) {
- virStorageReportError(VIR_ERR_INTERNAL_ERROR,
+ virStorageReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("storage pool is already active"));
goto cleanup;
}
@@ -766,7 +766,7 @@ storagePoolDestroy(virStoragePoolPtr obj) {
goto cleanup;
if (!virStoragePoolObjIsActive(pool)) {
- virStorageReportError(VIR_ERR_INTERNAL_ERROR,
+ virStorageReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("storage pool is not active"));
goto cleanup;
}
@@ -822,7 +822,7 @@ storagePoolDelete(virStoragePoolPtr obj,
goto cleanup;
if (virStoragePoolObjIsActive(pool)) {
- virStorageReportError(VIR_ERR_INTERNAL_ERROR,
+ virStorageReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("storage pool is still active"));
goto cleanup;
}
@@ -871,7 +871,7 @@ storagePoolRefresh(virStoragePoolPtr obj,
goto cleanup;
if (!virStoragePoolObjIsActive(pool)) {
- virStorageReportError(VIR_ERR_INTERNAL_ERROR,
+ virStorageReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("storage pool is not active"));
goto cleanup;
}
@@ -1076,7 +1076,7 @@ storagePoolNumVolumes(virStoragePoolPtr obj) {
}
if (!virStoragePoolObjIsActive(pool)) {
- virStorageReportError(VIR_ERR_INTERNAL_ERROR,
+ virStorageReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("storage pool is not active"));
goto cleanup;
}
@@ -1109,7 +1109,7 @@ storagePoolListVolumes(virStoragePoolPtr obj,
}
if (!virStoragePoolObjIsActive(pool)) {
- virStorageReportError(VIR_ERR_INTERNAL_ERROR,
+ virStorageReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("storage pool is not active"));
goto cleanup;
}
@@ -1154,7 +1154,7 @@ storageVolumeLookupByName(virStoragePoolPtr obj,
}
if (!virStoragePoolObjIsActive(pool)) {
- virStorageReportError(VIR_ERR_INTERNAL_ERROR,
+ virStorageReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("storage pool is not active"));
goto cleanup;
}
@@ -1285,7 +1285,7 @@ storageVolumeCreateXML(virStoragePoolPtr obj,
}
if (!virStoragePoolObjIsActive(pool)) {
- virStorageReportError(VIR_ERR_INTERNAL_ERROR,
+ virStorageReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("storage pool is not active"));
goto cleanup;
}
@@ -1413,13 +1413,13 @@ storageVolumeCreateXMLFrom(virStoragePoolPtr obj,
}
if (!virStoragePoolObjIsActive(pool)) {
- virStorageReportError(VIR_ERR_INTERNAL_ERROR,
+ virStorageReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("storage pool is not active"));
goto cleanup;
}
if (origpool && !virStoragePoolObjIsActive(origpool)) {
- virStorageReportError(VIR_ERR_INTERNAL_ERROR,
+ virStorageReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("storage pool is not active"));
goto cleanup;
}
@@ -1708,7 +1708,7 @@ storageVolumeWipe(virStorageVolPtr obj,
}
if (!virStoragePoolObjIsActive(pool)) {
- virStorageReportError(VIR_ERR_INTERNAL_ERROR,
+ virStorageReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("storage pool is not active"));
goto out;
}
@@ -1765,7 +1765,7 @@ storageVolumeDelete(virStorageVolPtr obj,
}
if (!virStoragePoolObjIsActive(pool)) {
- virStorageReportError(VIR_ERR_INTERNAL_ERROR,
+ virStorageReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("storage pool is not active"));
goto cleanup;
}
@@ -1844,7 +1844,7 @@ storageVolumeGetInfo(virStorageVolPtr obj,
}
if (!virStoragePoolObjIsActive(pool)) {
- virStorageReportError(VIR_ERR_INTERNAL_ERROR,
+ virStorageReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("storage pool is not active"));
goto cleanup;
}
@@ -1897,7 +1897,7 @@ storageVolumeGetXMLDesc(virStorageVolPtr obj,
}
if (!virStoragePoolObjIsActive(pool)) {
- virStorageReportError(VIR_ERR_INTERNAL_ERROR,
+ virStorageReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("storage pool is not active"));
goto cleanup;
}
@@ -1944,7 +1944,7 @@ storageVolumeGetPath(virStorageVolPtr obj) {
}
if (!virStoragePoolObjIsActive(pool)) {
- virStorageReportError(VIR_ERR_INTERNAL_ERROR,
+ virStorageReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("storage pool is not active"));
goto cleanup;
}
--
1.7.2.3
More information about the libvir-list
mailing list