]> git.proxmox.com Git - pve-storage.git/commitdiff
allow subvolume selection in ZPool storage
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Thu, 27 Aug 2015 12:53:12 +0000 (14:53 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 28 Aug 2015 08:56:55 +0000 (10:56 +0200)
PVE/Storage.pm

index 23780d0891e099911f07dfbf86d960fa705ec1bb..9a313b083f29b1d84929df5e2266f1efe11491a4 100755 (executable)
@@ -986,17 +986,17 @@ sub scan_nfs {
 
 sub scan_zfs {
 
-    my $cmd = ['zpool',  'list', '-H', '-o', 'name,size,free'];
+    my $cmd = ['zfs',  'list', '-t', 'filesystem', '-H', '-o', 'name,avail,used'];
 
     my $res = [];
     run_command($cmd, outfunc => sub {
        my $line = shift;
 
        if ($line =~m/^(\S+)\s+(\S+)\s+(\S+)$/) {
-           my ($pool, $size_str, $free_str) = ($1, $2, $3);
+           my ($pool, $size_str, $used_str) = ($1, $2, $3);
            my $size = PVE::Storage::ZFSPoolPlugin::zfs_parse_size($size_str);
-           my $free = PVE::Storage::ZFSPoolPlugin::zfs_parse_size($free_str);
-           push @$res, { pool => $pool, size => $size, free => $free };
+           my $used = PVE::Storage::ZFSPoolPlugin::zfs_parse_size($used_str);
+           push @$res, { pool => $pool, size => $size, free => $size-$used };
        }
     });