[pve-devel] [PATCH 09/14] forbid snapshot create if current it's a template

Alexandre Derumier aderumier at odiso.com
Thu Jan 10 14:16:17 CET 2013


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 8d6979a..5e1f319 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -2895,6 +2895,10 @@ sub qemu_block_resize {
 sub qemu_volume_snapshot {
     my ($vmid, $deviceid, $storecfg, $volid, $snap) = @_;
 
+    my $conf = PVE::QemuServer::load_config($vmid);
+
+    die "you can't take a snapshot if it's a template" if is_template($conf);
+
     my $running = check_running($vmid);
 
     return if !PVE::Storage::volume_snapshot($storecfg, $volid, $snap, $running);
-- 
1.7.10.4




More information about the pve-devel mailing list