[pve-devel] [PATCH pve-storage 2/2] refactor volunme_resize to differentiate subvol and zvol

Wolfgang Link w.link at proxmox.com
Wed Oct 7 14:14:14 CEST 2015


---
 PVE/Storage/ZFSPoolPlugin.pm | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/PVE/Storage/ZFSPoolPlugin.pm b/PVE/Storage/ZFSPoolPlugin.pm
index 72dfd0f..b8bd509 100644
--- a/PVE/Storage/ZFSPoolPlugin.pm
+++ b/PVE/Storage/ZFSPoolPlugin.pm
@@ -577,11 +577,30 @@ sub volume_resize {
 
     my $new_size = ($size/1024);
 
+    if ($volname =~ m/^vm-\d\d\d+-disk-\d+$/) {
+	return $class->zfs_zvol_resize($new_size, $scfg, $volname);
+    } elsif ($volname =~ m/^subvol-\d\d\d+-disk-\d+$/) {
+	return $class->zfs_subvol_resize($new_size, $scfg, $volname);
+    }
+
+}
+
+sub zfs_zvol_resize {
+    my ($class, $new_size, $scfg, $volname) = @_;
+
     $class->zfs_request($scfg, undef, 'set', 'volsize=' . $new_size . 'k', "$scfg->{pool}/$volname");
 
     return $new_size;
 }
 
+sub zfs_subvol_resize {
+    my ($class, $new_size, $scfg, $volname) = @_;
+
+    $class->zfs_request($scfg, undef, 'set',  'refquota=' . $new_size . 'k', "$scfg->{pool}/$volname");
+
+    return $new_size;
+}
+
 sub volume_has_feature {
     my ($class, $scfg, $feature, $storeid, $volname, $snapname, $running) = @_;
 
-- 
2.1.4





More information about the pve-devel mailing list