[pve-devel] [PATCH 33/44] nexenta : nexenta_list_zvol : parse base volumes

Alexandre Derumier aderumier at odiso.com
Tue Feb 5 12:56:00 CET 2013


Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/Storage.pm               |    2 --
 PVE/Storage/NexentaPlugin.pm |   11 ++++++++---
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/PVE/Storage.pm b/PVE/Storage.pm
index b625fa0..41c593c 100755
--- a/PVE/Storage.pm
+++ b/PVE/Storage.pm
@@ -525,7 +525,6 @@ sub vdisk_free {
 
 	my ($vtype, $name, $vmid, undef, undef, $isBase) = 
 	    $plugin->parse_volname($volname);
-
 	if ($isBase) {
 	    my $vollist = $plugin->list_images($storeid, $scfg);
 	    foreach my $info (@$vollist) {
@@ -544,7 +543,6 @@ sub vdisk_free {
 		}
 	    }
 	}
-
 	my $cleanup_worker = $plugin->free_image($storeid, $scfg, $volname, $isBase);
     });
 
diff --git a/PVE/Storage/NexentaPlugin.pm b/PVE/Storage/NexentaPlugin.pm
index 4a5f66d..b24a8e0 100644
--- a/PVE/Storage/NexentaPlugin.pm
+++ b/PVE/Storage/NexentaPlugin.pm
@@ -109,16 +109,21 @@ sub nexenta_list_zvol {
 	my $pool = $values[0];
 	my $image = $values[1];
 	my $owner;
-	if ($image =~ m/^(vm-(\d+)-\S+)$/) {
-	    $owner = $2;
+
+	if ($image =~ m/^((vm|base)-(\d+)-\S+)$/) {
+	    $owner = $3;
 	}
 
 	my $props = nexenta_get_zvol_props($scfg, $zvol);
+	my $parent = $props->{origin};
+	if($parent && $parent =~ m/^$scfg->{pool}\/(\S+)$/){
+	    $parent = $1;
+	}
 
 	$list->{$pool}->{$image} = {
 	    name => $image,
 	    size => $props->{size_bytes},
-	    parent => $props->{origin},
+	    parent => $parent,
 	    format => 'raw',
 	    vmid => $owner
 	};
-- 
1.7.10.4




More information about the pve-devel mailing list