[libvirt] [PATCH 09/11] Fix error codes returned when a storage pool is inactive

2010-11-12 Thread Daniel P. Berrange
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,
 }
 
   

Re: [libvirt] [PATCH 09/11] Fix error codes returned when a storage pool is inactive

2010-11-19 Thread Eric Blake
On 11/12/2010 09:22 AM, Daniel P. Berrange wrote:
> 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

ACK.

-- 
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list