]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Correct a check for capacity arg of storageVolumeResize()
authorZeeshan Ali (Khattak) <zeeshanak@gnome.org>
Sat, 3 Mar 2012 03:18:59 +0000 (05:18 +0200)
committerEric Blake <eblake@redhat.com>
Sat, 3 Mar 2012 04:52:02 +0000 (21:52 -0700)
Lets say I got a volume with '1G' allocation and '10G' capacity. The
available space in the parent pool is '5G'. With the current check for
overcapacity, I can only try to resize to <= '6G'. You see the problem?

src/storage/storage_driver.c

index 9130a40f5c3138fd664e02b1416083a167085229..66811ce24c30f8519a13bc56b67dc015a2a3c981 100644 (file)
@@ -1758,8 +1758,8 @@ storageVolumeResize(virStorageVolPtr obj,
         goto out;
     }
 
-    if (abs_capacity > vol->allocation + pool->def->available) {
-        virStorageReportError(VIR_ERR_INVALID_ARG,
+    if (abs_capacity > vol->capacity + pool->def->available) {
+        virStorageReportError(VIR_ERR_OPERATION_FAILED,
                               _("Not enough space left on storage pool"));
         goto out;
     }