[pve-devel] [PATCH 2/9] zfs: move code

Wolfgang Link w.link at proxmox.com
Fri Jan 23 10:32:38 CET 2015


move parse_volume from ZFSPlugin to ZFSDirPlugin, to avoid duplication

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

diff --git a/PVE/Storage/ZFSDirPlugin.pm b/PVE/Storage/ZFSDirPlugin.pm
index 9960d3a..da53525 100644
--- a/PVE/Storage/ZFSDirPlugin.pm
+++ b/PVE/Storage/ZFSDirPlugin.pm
@@ -120,6 +120,16 @@ sub zfs_parse_zvol_list {
     return $list;
 }
 
+sub parse_volname {
+    my ($class, $volname) = @_;
+
+    if ($volname =~ m/^(((base|vm)-(\d+)-\S+)\/)?((base)?(vm)?-(\d+)-\S+)$/) {
+	return ('images', $5, $8, $2, $4, $6);
+    }
+
+    die "unable to parse zfs volume name '$volname'\n";
+}
+
 # virtual zfs methods (subclass can overwrite them)
 
 sub zfs_request {
diff --git a/PVE/Storage/ZFSPlugin.pm b/PVE/Storage/ZFSPlugin.pm
index d47e07e..f17d2a9 100644
--- a/PVE/Storage/ZFSPlugin.pm
+++ b/PVE/Storage/ZFSPlugin.pm
@@ -207,16 +207,6 @@ sub options {
 
 # Storage implementation
 
-sub parse_volname {
-    my ($class, $volname) = @_;
-
-    if ($volname =~ m/^(((base|vm)-(\d+)-\S+)\/)?((base)?(vm)?-(\d+)-\S+)$/) {
-	return ('images', $5, $8, $2, $4, $6);
-    }
-
-    die "unable to parse zfs volume name '$volname'\n";
-}
-
 sub path {
     my ($class, $scfg, $volname) = @_;
 
-- 
1.7.10.4





More information about the pve-devel mailing list