rbd: volume resize: avoid passing floating point value to rbd
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>
This commit is contained in:
committed by
Thomas Lamprecht
parent
4ff0f451bd
commit
93e34f7259
@ -7,6 +7,7 @@ use Cwd qw(abs_path);
|
|||||||
use IO::File;
|
use IO::File;
|
||||||
use JSON;
|
use JSON;
|
||||||
use Net::IP;
|
use Net::IP;
|
||||||
|
use POSIX qw(ceil);
|
||||||
|
|
||||||
use PVE::CephConfig;
|
use PVE::CephConfig;
|
||||||
use PVE::Cluster qw(cfs_read_file);;
|
use PVE::Cluster qw(cfs_read_file);;
|
||||||
@ -779,7 +780,7 @@ sub volume_resize {
|
|||||||
|
|
||||||
my ($vtype, $name, $vmid) = $class->parse_volname($volname);
|
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);
|
||||||
run_rbd_command($cmd, errmsg => "rbd resize '$volname' error");
|
run_rbd_command($cmd, errmsg => "rbd resize '$volname' error");
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user