From c72155735dc20066d609d9202b0ea11bc28349e0 Mon Sep 17 00:00:00 2001 From: Fabian Ebner Date: Wed, 19 Feb 2020 11:31:31 +0100 Subject: [PATCH] volume_resize: align size to 1 KiB 1. Avoids the error qemu-img: The new size must be a multiple of 512 for qcow2 disks. 2. Because volume_import expects disk sizes to be a multiple of 1 KiB. Signed-off-by: Fabian Ebner --- PVE/Storage.pm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/PVE/Storage.pm b/PVE/Storage.pm index 2a5295f..a46550c 100755 --- a/PVE/Storage.pm +++ b/PVE/Storage.pm @@ -209,6 +209,9 @@ sub volume_size_info { sub volume_resize { my ($cfg, $volid, $size, $running) = @_; + my $padding = (1024 - $size % 1024) % 1024; + $size = $size + $padding; + my ($storeid, $volname) = parse_volume_id($volid, 1); if ($storeid) { my $scfg = storage_config($cfg, $storeid); -- 2.39.2