[libvirt] Correct a check for capacity arg of storageVolumeResize()

Zeeshan Ali (Khattak) zeeshanak at gnome.org
Sat Mar 3 03:18:59 UTC 2012


From: "Zeeshan Ali (Khattak)" <zeeshanak at gnome.org>

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 |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index 9130a40..66811ce 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -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;
     }
-- 
1.7.7.6




More information about the libvir-list mailing list