ZFSPoolPlugin: fix #2662 get volume size correctly

Getting the volume sizes as byte values instead of converted to human
readable units helps to avoid rounding errors in the further processing
if the volume size is more on the odd side.

The `zfs list` command supports the -p(arseable) flag since a few years
now.
When returning the size in bytes there is no  calculation performed and
thus we need to explicitly cast the size to an integer before returning
it.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
This commit is contained in:
Aaron Lauterer
2020-04-07 14:25:35 +02:00
committed by Fabian Grünbichler
parent 8baa5ea994
commit d99de0f898

View File

@ -81,7 +81,7 @@ sub zfs_parse_size {
$size = ceil($size);
}
return $size;
return $size + 0;
}
@ -400,7 +400,7 @@ sub zfs_delete_zvol {
sub zfs_list_zvol {
my ($class, $scfg) = @_;
my $text = $class->zfs_request($scfg, 10, 'list', '-o', 'name,volsize,origin,type,refquota', '-t', 'volume,filesystem', '-Hr');
my $text = $class->zfs_request($scfg, 10, 'list', '-o', 'name,volsize,origin,type,refquota', '-t', 'volume,filesystem', '-Hrp');
my $zvols = zfs_parse_zvol_list($text);
return undef if !$zvols;