]> git.proxmox.com Git - qemu-server.git/commitdiff
resize_vm: request new size from storage after resizing
authorFabian Ebner <f.ebner@proxmox.com>
Mon, 13 Jan 2020 10:47:43 +0000 (11:47 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 7 Feb 2020 12:37:54 +0000 (13:37 +0100)
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.ebner@proxmox.com>
PVE/API2/Qemu.pm

index d0dd2dcb5de0fc5fd169a24555c5d32ac7374c76..caca430a053b035561667585b206a9afc93f11a4 100644 (file)
@@ -3586,7 +3586,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);