[pve-devel] [PATCH 4/6] forbid rollback if current config is a template.

Alexandre Derumier aderumier at odiso.com
Thu Nov 29 10:37:54 CET 2012


if a qcow2 current is a template, we can't rollback to a previous snapshot.

(note that file readonly protection do already the job, but we need a clear error message for user)

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

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 6b22b3e..9778f9c 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -3794,6 +3794,8 @@ my $snapshot_commit = sub {
 sub snapshot_rollback {
     my ($vmid, $snapname) = @_;
 
+    die "you can't rollback if current is a template" if is_template($vmid);
+
     my $snap;
 
     my $prepare = 1;
-- 
1.7.10.4




More information about the pve-devel mailing list