[pve-devel] [PATCH 03/11] forbid snapshot delete if it's a template

Alexandre Derumier aderumier at odiso.com
Tue Dec 18 10:14:52 CET 2012


Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/QemuServer.pm |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index b0511fb..7a47e3c 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -2865,6 +2865,10 @@ sub qemu_volume_snapshot {
 sub qemu_volume_snapshot_delete {
     my ($vmid, $deviceid, $storecfg, $volid, $snap) = @_;
 
+    my $conf = PVE::QemuServer::load_config($vmid);
+
+    die "you can't delete a snapshot if it's a template" if is_template($conf, $snap);
+
     my $running = PVE::QemuServer::check_running($vmid);
 
     return if !PVE::Storage::volume_snapshot_delete($storecfg, $volid, $snap, $running);
-- 
1.7.10.4




More information about the pve-devel mailing list