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

Alexandre Derumier aderumier at odiso.com
Tue Jan 29 17:13:45 CET 2013


if files (raw,qcow2) are a template, we forbid vm_start.

note : the readonly protection do already the job, but we need a clear message for users

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 efd90e9..0ccfd30 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -2933,6 +2933,8 @@ sub vm_start {
     lock_config($vmid, sub {
 	my $conf = load_config($vmid, $migratedfrom);
 
+	die "you can't start a vm if it's a template" if is_template($conf);
+
 	check_lock($conf) if !$skiplock;
 
 	die "VM $vmid already running\n" if check_running($vmid, undef, $migratedfrom);
-- 
1.7.10.4




More information about the pve-devel mailing list