[pve-devel] [PATCH 25/44] sheepdog : free_image : parse volname

Alexandre Derumier aderumier at odiso.com
Tue Feb 5 12:55:52 CET 2013


Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/Storage/SheepdogPlugin.pm |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/PVE/Storage/SheepdogPlugin.pm b/PVE/Storage/SheepdogPlugin.pm
index deafe47..2a06ac1 100644
--- a/PVE/Storage/SheepdogPlugin.pm
+++ b/PVE/Storage/SheepdogPlugin.pm
@@ -253,15 +253,18 @@ sub alloc_image {
 sub free_image {
     my ($class, $storeid, $scfg, $volname, $isBase) = @_;
 
-    my $snapshots = sheepdog_snapshot_ls($scfg, $volname);
+    my ($vtype, $name, $vmid, undef, undef, undef) =
+	$class->parse_volname($volname);
+
+    my $snapshots = sheepdog_snapshot_ls($scfg, $name);
     while (my ($snapname) = each %$snapshots) {
-	my $cmd = &$collie_cmd($scfg, 'vdi', 'delete' , '-s', $snapname, $volname);
-	run_command($cmd, errmsg => "sheepdog delete snapshot $snapname $volname' error");
+	my $cmd = &$collie_cmd($scfg, 'vdi', 'delete' , '-s', $snapname, $name);
+	run_command($cmd, errmsg => "sheepdog delete snapshot $snapname $name' error");
     }
 
-    my $cmd = &$collie_cmd($scfg, 'vdi', 'delete' , $volname);
+    my $cmd = &$collie_cmd($scfg, 'vdi', 'delete' , $name);
 
-    run_command($cmd, errmsg => "sheepdog delete $volname' error");
+    run_command($cmd, errmsg => "sheepdog delete $name' error");
 
     return undef;
 }
-- 
1.7.10.4




More information about the pve-devel mailing list