Because of alignment and rounding in the storage backend, the effective
size might not match the 'newsize' parameter we passed along.

Signed-off-by: Fabian Ebner <f.eb...@proxmox.com>
---

Turns out that this happens in basically every storage backend that has
'volume_resize': LVM and RBD round down, ZFS and DIR for '.raw' align

 PVE/API2/Qemu.pm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index 5bae513..b83ce07 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -3607,7 +3607,8 @@ __PACKAGE__->register_method({
 
            PVE::QemuServer::qemu_block_resize($vmid, "drive-$disk", $storecfg, 
$volid, $newsize);
 
-           $drive->{size} = $newsize;
+           my $effective_size = eval { 
PVE::Storage::volume_size_info($storecfg, $volid, 3); };
+           $drive->{size} = $effective_size // $newsize;
            $conf->{$disk} = PVE::QemuServer::print_drive($drive);
 
            PVE::QemuConfig->write_config($vmid, $conf);
-- 
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