ZFS: use -p flag and remove zfs_parse_size
ZFS supports the -p flag in the list command since a few years now. Let us use the real byte values and avoid the error prone calculation from human readable numbers that can lead to incorrect numbers if the reported human readable value is a rounded number. Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
This commit is contained in:
committed by
Fabian Grünbichler
parent
d99de0f898
commit
3881e68025
@ -1210,7 +1210,7 @@ sub scan_cifs {
|
||||
|
||||
sub scan_zfs {
|
||||
|
||||
my $cmd = ['zfs', 'list', '-t', 'filesystem', '-H', '-o', 'name,avail,used'];
|
||||
my $cmd = ['zfs', 'list', '-t', 'filesystem', '-Hp', '-o', 'name,avail,used'];
|
||||
|
||||
my $res = [];
|
||||
run_command($cmd, outfunc => sub {
|
||||
@ -1218,8 +1218,8 @@ sub scan_zfs {
|
||||
|
||||
if ($line =~m/^(\S+)\s+(\S+)\s+(\S+)$/) {
|
||||
my ($pool, $size_str, $used_str) = ($1, $2, $3);
|
||||
my $size = PVE::Storage::ZFSPoolPlugin::zfs_parse_size($size_str);
|
||||
my $used = PVE::Storage::ZFSPoolPlugin::zfs_parse_size($used_str);
|
||||
my $size = $size_str + 0;
|
||||
my $used = $used_str + 0;
|
||||
# ignore subvolumes generated by our ZFSPoolPlugin
|
||||
return if $pool =~ m!/subvol-\d+-[^/]+$!;
|
||||
return if $pool =~ m!/basevol-\d+-[^/]+$!;
|
||||
|
||||
Reference in New Issue
Block a user