[pve-devel] [PATCH v3 qemu-server] qemu_block_resize: volume_resize now uses KiB instead of bytes

Fabian Ebner f.ebner at proxmox.com
Mon Feb 17 12:41:25 CET 2020


Also gets rid of an error with qmp block_resize, which expects
that the size is a multiple of 512 bytes for qcow2 volumes.

Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---
 PVE/QemuServer.pm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 23176dd..d2f0ff6 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -4652,11 +4652,13 @@ sub qemu_block_resize {
 
     my $running = check_running($vmid);
 
+    my $size = PVE::Tools::convert_size($size, "b" => "kb");
+
     $size = 0 if !PVE::Storage::volume_resize($storecfg, $volid, $size, $running);
 
     return if !$running;
 
-    mon_cmd($vmid, "block_resize", device => $deviceid, size => int($size));
+    mon_cmd($vmid, "block_resize", device => $deviceid, size => int($size) * 1024);
 
 }
 
-- 
2.20.1





More information about the pve-devel mailing list