[pve-devel] [PATCH v3 qemu-server] qemu_block_resize: volume_resize now uses KiB instead of bytes

Dominik Csapak d.csapak at proxmox.com
Tue Feb 18 16:09:41 CET 2020


one comment inline

On 2/17/20 12:41 PM, Fabian Ebner wrote:
> Also gets rid of an error with qmp block_resize, which expects
> that the size is a multiple of 512 bytes for qcow2 volumes.
> 
> Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
> ---
>   PVE/QemuServer.pm | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
> index 23176dd..d2f0ff6 100644
> --- a/PVE/QemuServer.pm
> +++ b/PVE/QemuServer.pm
> @@ -4652,11 +4652,13 @@ sub qemu_block_resize {
>   
>       my $running = check_running($vmid);
>   
> +    my $size = PVE::Tools::convert_size($size, "b" => "kb");

this my produces a warning that it shadows the previous definition
(from the parameters)

> +
>       $size = 0 if !PVE::Storage::volume_resize($storecfg, $volid, $size, $running);
>   
>       return if !$running;
>   
> -    mon_cmd($vmid, "block_resize", device => $deviceid, size => int($size));
> +    mon_cmd($vmid, "block_resize", device => $deviceid, size => int($size) * 1024);
>   
>   }
>   
> 





More information about the pve-devel mailing list