[pve-devel] [PATCH] zfspoolplugin: fix volume_resize

Wolfgang Link w.link at proxmox.com
Tue Feb 10 12:24:26 CET 2015


copy methode volume_resize form ZFSPlugin.pm to ZFSPoolPlugin.pm
refactor volume_resize

Signed-off-by: Wolfgang Link <w.link at proxmox.com>
---
 PVE/Storage/ZFSPlugin.pm     |    7 ++++---
 PVE/Storage/ZFSPoolPlugin.pm |   10 ++++++++++
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/PVE/Storage/ZFSPlugin.pm b/PVE/Storage/ZFSPlugin.pm
index 43cfcd8..77394b9 100644
--- a/PVE/Storage/ZFSPlugin.pm
+++ b/PVE/Storage/ZFSPlugin.pm
@@ -299,11 +299,12 @@ sub free_image {
 
 sub volume_resize {
     my ($class, $scfg, $storeid, $volname, $size, $running) = @_;
+    
+    my $new_size = $class->SUPER::volume_resize($scfg, $storeid, $volname, $size, $running);
 
-    my $new_size = ($size/1024);
-
-    $class->zfs_request($scfg, undef, 'set', 'volsize=' . $new_size . 'k', "$scfg->{pool}/$volname");
     $class->zfs_resize_lu($scfg, $volname, $new_size);
+
+    return $new_size;
 }
 
 sub volume_snapshot_rollback {
diff --git a/PVE/Storage/ZFSPoolPlugin.pm b/PVE/Storage/ZFSPoolPlugin.pm
index 83dbc7f..754f29f 100644
--- a/PVE/Storage/ZFSPoolPlugin.pm
+++ b/PVE/Storage/ZFSPoolPlugin.pm
@@ -489,6 +489,16 @@ sub create_base {
     return $newvolname;
 }
 
+sub volume_resize {
+    my ($class, $scfg, $storeid, $volname, $size, $running) = @_;
+
+    my $new_size = ($size/1024);
+
+    $class->zfs_request($scfg, undef, 'set', 'volsize=' . $new_size . 'k', "$scfg->{pool}/$volname");
+
+    return $new_size;
+}
+
 sub volume_has_feature {
     my ($class, $scfg, $feature, $storeid, $volname, $snapname, $running) = @_;
 
-- 
1.7.10.4





More information about the pve-devel mailing list