From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
Fiona Ebner <f.ebner@proxmox.com>
Subject: Re: [pve-devel] [PATCH storage 2/2] rbd: volume resize: avoid passing floating point value to rbd
Date: Tue, 6 Jun 2023 19:37:00 +0200 [thread overview]
Message-ID: <adba68af-a3b0-360f-1d41-988a92198e16@proxmox.com> (raw)
In-Reply-To: <20230428123209.124097-4-f.ebner@proxmox.com>
Am 28/04/2023 um 14:32 schrieb Fiona Ebner:
> which causes an error "the argument for option '--size' is invalid".
> Just round up to the nearest integer to have at least the requested
> size. This is similar to what is done for ZFS with d3e3e5d ("When
> resizing a ZFS volume, align size to 1M") and makes commands like 'qm
> resize 102 scsi1 +0.01G' work.
>
> Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
> ---
> PVE/Storage/RBDPlugin.pm | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/PVE/Storage/RBDPlugin.pm b/PVE/Storage/RBDPlugin.pm
> index 9d59a14..c9e70a2 100644
> --- a/PVE/Storage/RBDPlugin.pm
> +++ b/PVE/Storage/RBDPlugin.pm
> @@ -7,6 +7,7 @@ use Cwd qw(abs_path);
> use IO::File;
> use JSON;
> use Net::IP;
> +use POSIX qw(ceil);
>
> use PVE::CephConfig;
> use PVE::Cluster qw(cfs_read_file);;
> @@ -779,7 +780,7 @@ sub volume_resize {
>
> my ($vtype, $name, $vmid) = $class->parse_volname($volname);
>
> - my $cmd = $rbd_cmd->($scfg, $storeid, 'resize', '--size', ($size/1024/1024), $name);
> + my $cmd = $rbd_cmd->($scfg, $storeid, 'resize', '--size', ceil($size/1024/1024), $name);
Hmm, but POSIX ceil is also returning a double `double ceil(double x)`, maybe wrap
that into an int(), hedging against (future) perl is often a relatively good idea ^^
FWIW: we often to something like int(($size + 1023)/1024/1024); (untested for this
specific case).
> run_rbd_command($cmd, errmsg => "rbd resize '$volname' error");
> return undef;
> }
next prev parent reply other threads:[~2023-06-06 17:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-28 12:32 [pve-devel] [PATCH-SERIES qemu-server/storage] improve RBD resize Fiona Ebner
2023-04-28 12:32 ` [pve-devel] [PATCH qemu-server 1/1] block resize: avoid passing zero size to QMP command Fiona Ebner
2023-04-28 12:32 ` [pve-devel] [PATCH storage 1/2] rbd: don't specify allow-shrink flag Fiona Ebner
2023-04-28 12:32 ` [pve-devel] [PATCH storage 2/2] rbd: volume resize: avoid passing floating point value to rbd Fiona Ebner
2023-06-06 17:37 ` Thomas Lamprecht [this message]
2023-06-07 8:51 ` Fiona Ebner
2023-06-06 17:45 ` [pve-devel] applied-series: [PATCH-SERIES qemu-server/storage] improve RBD resize Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=adba68af-a3b0-360f-1d41-988a92198e16@proxmox.com \
--to=t.lamprecht@proxmox.com \
--cc=f.ebner@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox