[pve-devel] [PATCH v3 container] volume_resize now uses KiB instead of bytes

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


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

diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm
index 6652e2e..ebe8f18 100644
--- a/src/PVE/API2/LXC.pm
+++ b/src/PVE/API2/LXC.pm
@@ -1671,13 +1671,15 @@ __PACKAGE__->register_method({
 
 	    return if $size == $newsize;
 
+	    $newsize = PVE::Tools::convert_size($newsize, "b" => "kb");
+
 	    PVE::Cluster::log_msg('info', $authuser, "update CT $vmid: resize --disk $disk --size $sizestr");
 	    my $realcmd = sub {
 		# Note: PVE::Storage::volume_resize doesn't do anything if $running=1, so
 		# we pass 0 here (parameter only makes sense for qemu)
 		PVE::Storage::volume_resize($storage_cfg, $volid, $newsize, 0);
 
-		$mp->{size} = $newsize;
+		$mp->{size} = $newsize * 1024;
 		$conf->{$disk} = PVE::LXC::Config->print_ct_mountpoint($mp, $disk eq 'rootfs');
 
 		PVE::LXC::Config->write_config($vmid, $conf);
-- 
2.20.1





More information about the pve-devel mailing list