]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Fix error code for storage operations
authorDave Allan <dallan@redhat.com>
Fri, 15 Jul 2011 13:47:12 +0000 (09:47 -0400)
committerEric Blake <eblake@redhat.com>
Fri, 15 Jul 2011 14:35:25 +0000 (08:35 -0600)
Many volume operations will fail if the volume in question is being
allocated.  These operations were returning VIR_ERR_INTERNAL_ERROR
when they should be returning VIR_ERR_OPERATION_INVALID.

src/storage/storage_driver.c

index 4f35be0cb852db50f2d3be4ad906b4bd00b9b01b..997b876686015424aeb96179d604f6130d955143 100644 (file)
@@ -1486,7 +1486,7 @@ storageVolumeCreateXMLFrom(virStoragePoolPtr obj,
     }
 
     if (origvol->building) {
-        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_OPERATION_INVALID,
                               _("volume '%s' is still being allocated."),
                               origvol->name);
         goto cleanup;
@@ -1667,7 +1667,7 @@ storageVolumeUpload(virStorageVolPtr obj,
     }
 
     if (vol->building) {
-        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_OPERATION_INVALID,
                               _("volume '%s' is still being allocated."),
                               vol->name);
         goto out;
@@ -1876,7 +1876,7 @@ storageVolumeWipe(virStorageVolPtr obj,
     }
 
     if (vol->building) {
-        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_OPERATION_INVALID,
                               _("volume '%s' is still being allocated."),
                               vol->name);
         goto out;
@@ -1936,7 +1936,7 @@ storageVolumeDelete(virStorageVolPtr obj,
     }
 
     if (vol->building) {
-        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_OPERATION_INVALID,
                               _("volume '%s' is still being allocated."),
                               vol->name);
         goto cleanup;