[pve-devel] [PATCH 4/7] rbd: unprotect snapshots before deletion

Stefan Priebe s.priebe at profihost.ag
Thu Feb 6 14:04:55 CET 2014


Signed-off-by: Stefan Priebe <s.priebe at profihost.ag>
---
 PVE/Storage/RBDPlugin.pm |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/PVE/Storage/RBDPlugin.pm b/PVE/Storage/RBDPlugin.pm
index 0e94e13..b811b49 100644
--- a/PVE/Storage/RBDPlugin.pm
+++ b/PVE/Storage/RBDPlugin.pm
@@ -539,6 +539,12 @@ sub volume_snapshot_delete {
 
     my ($vtype, $name, $vmid) = $class->parse_volname($volname);
 
+    my (undef, undef, undef, $protected) = rbd_volume_info($scfg, $storeid, $name, $snap);
+    if ($protected){
+	my $cmd = &$rbd_cmd($scfg, $storeid, 'snap', 'unprotect', $name, '--snap', $snap);
+	run_rbd_command($cmd, errmsg => "rbd unprotect $name snap $snap' error");
+    }
+
     my $cmd = &$rbd_cmd($scfg, $storeid, 'snap', 'rm', '--snap', $snap, $name);
 
     run_rbd_command($cmd, errmsg => "rbd snapshot '$volname' error");
-- 
1.7.10.4




More information about the pve-devel mailing list