For qcow2, this is required and for raw, the qmp command aligns to 512 
implicitly anyways

Signed-off-by: Fabian Ebner <f.eb...@proxmox.com>
---
 PVE/QemuServer.pm | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 2b68d81..922f9b0 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -4672,6 +4672,11 @@ sub qemu_block_resize {
 
     return if !$running;
 
+    # for qcow2 images 'qmp block_resize' requires that the size is
+    # aligned to 512 and for raw images it happens implicitly anyways
+    my $padding = (512 - $size % 512) % 512;
+    $size = $size + $padding;
+
     mon_cmd($vmid, "block_resize", device => $deviceid, size => int($size));
 
 }
-- 
2.20.1


_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to