[libvirt] [PATCH] rbd: Allow shrinking and deltas when resizing RBD volumes

Wido den Hollander wido at widodh.nl
Sat Jan 30 15:15:32 UTC 2016


Modify virCheckFlags that it accepts both VIR_STORAGE_VOL_RESIZE_DELTA
and VIR_STORAGE_VOL_RESIZE_SHRINK as valid flags for resizing RBD
volumes.

This still does not solve the problem where RBD volumes can't be
shrinked using libvirt. The allocation and capacity of RBD volumes
are equal for a RBD volume and this makes libvirt think the volume
is fully allocated and therefor can't be shrinked.

Signed-off-by: Wido den Hollander <wido at widodh.nl>
---
 src/storage/storage_backend_rbd.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backend_rbd.c
index 80a1d33..88b613a 100644
--- a/src/storage/storage_backend_rbd.c
+++ b/src/storage/storage_backend_rbd.c
@@ -1041,7 +1041,8 @@ static int virStorageBackendRBDResizeVol(virConnectPtr conn ATTRIBUTE_UNUSED,
     int ret = -1;
     int r = 0;
 
-    virCheckFlags(0, -1);
+    virCheckFlags(VIR_STORAGE_VOL_RESIZE_DELTA |
+                  VIR_STORAGE_VOL_RESIZE_SHRINK, -1);
 
     if (virStorageBackendRBDOpenRADOSConn(&ptr, conn, &pool->def->source) < 0)
         goto cleanup;
-- 
1.9.1




More information about the libvir-list mailing list