[pve-devel] [PATCH v2 storage 1/3] ZFSPoolPlugin: fix #2662 get volume size correctly
Aaron Lauterer
a.lauterer at proxmox.com
Tue Apr 7 14:25:35 CEST 2020
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 at proxmox.com>
---
v1->v2: made the -p flag more obvious in the commit msg by adding a dash
Removal of zfs_parse_size and using the -p flag where appropiate is done
in individual patches which I hope is okay.
PVE/Storage/ZFSPoolPlugin.pm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/PVE/Storage/ZFSPoolPlugin.pm b/PVE/Storage/ZFSPoolPlugin.pm
index b538e3b..cb3f2f0 100644
--- a/PVE/Storage/ZFSPoolPlugin.pm
+++ b/PVE/Storage/ZFSPoolPlugin.pm
@@ -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;
--
2.20.1
More information about the pve-devel
mailing list