This is necessary if we use Container because they use subvol.
subvol has no size but a quota.
if return is 0 there is no quota set.
---
 PVE/Storage/ZFSPoolPlugin.pm | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/PVE/Storage/ZFSPoolPlugin.pm b/PVE/Storage/ZFSPoolPlugin.pm
index d3bb0fd..d7204b2 100644
--- a/PVE/Storage/ZFSPoolPlugin.pm
+++ b/PVE/Storage/ZFSPoolPlugin.pm
@@ -294,13 +294,21 @@ sub zfs_get_pool_stats {
 sub zfs_get_zvol_size {
     my ($class, $scfg, $zvol) = @_;
 
-    my $text = $class->zfs_request($scfg, undef, 'get', '-Hp', 'volsize', 
"$scfg->{pool}/$zvol");
+    my $param;
 
-    if ($text =~ /volsize\s(\d+)/) {
-       return $1;
+    if ($zvol =~ m/^vm-\d\d\d+-disk-\d+$/) {
+       $param = "volsize";
+    } elsif ($zvol =~ m/^subvol-\d\d\d+-rootfs$/) {
+       $param = "refquota";
     }
 
-    die "Could not get zvol size";
+    my $text = $class->zfs_request($scfg, undef, 'get', '-Hp', "$param", 
"$scfg->{pool}/$zvol");
+
+    if ($text =~ /^$scfg->{pool}\/$zvol\s$param\s(\d+)/) {
+       return $1;
+    } else {
+       die "Could not get zvol size";
+    }
 }
 
 sub zfs_create_zvol {
-- 
2.1.4


_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to