[pve-devel] [PATCH v2 qemu-server 1/2] resize_vm: request new size from storage after resizing

Fabian Ebner f.ebner at proxmox.com
Mon Jan 13 11:47:43 CET 2020


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 at 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





More information about the pve-devel mailing list