From f90a0a20e78787d9daf7c1060c2903992506d2be Mon Sep 17 00:00:00 2001 From: Stefan Priebe Date: Fri, 4 Jul 2014 10:30:55 +0200 Subject: [PATCH] rbd: unprotect snapshots before deletion Signed-off-by: Stefan Priebe --- PVE/Storage/RBDPlugin.pm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/PVE/Storage/RBDPlugin.pm b/PVE/Storage/RBDPlugin.pm index 3250c70..56930af 100644 --- a/PVE/Storage/RBDPlugin.pm +++ b/PVE/Storage/RBDPlugin.pm @@ -542,6 +542,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"); -- 2.39.2