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

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


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 9778f9c..710f6c8 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -2893,6 +2893,8 @@ sub qga_unfreezefs {
 sub vm_start {
     my ($storecfg, $vmid, $statefile, $skiplock, $migratedfrom) = @_;
 
+    die "you can't start a vm if current is a template" if is_template ($vmid);
+
     lock_config($vmid, sub {
 	my $conf = load_config($vmid, $migratedfrom);
 
-- 
1.7.10.4




More information about the pve-devel mailing list