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

Alexandre Derumier aderumier at odiso.com
Thu Feb 14 11:58:52 CET 2013


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 9f2b997..028df19 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -4168,6 +4168,8 @@ sub snapshot_rollback {
 
 	my $conf = load_config($vmid);
 
+	die "you can't rollback if vm is a template" if is_template($conf);
+
 	$snap = $conf->{snapshots}->{$snapname};
 
 	die "snapshot '$snapname' does not exist\n" if !defined($snap); 
-- 
1.7.10.4




More information about the pve-devel mailing list