[pve-devel] [PATCH 05/11] config.js : disable start button if vm is a template on current (raw, qcow2)

Alexandre Derumier aderumier at odiso.com
Thu Feb 14 12:04:00 CET 2013


Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 www/manager/qemu/Config.js |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/www/manager/qemu/Config.js b/www/manager/qemu/Config.js
index e465062..efa4de5 100644
--- a/www/manager/qemu/Config.js
+++ b/www/manager/qemu/Config.js
@@ -189,6 +189,7 @@ Ext.define('PVE.qemu.Config', {
         me.statusStore.on('load', function(s, records, success) {
 	    var status;
 	    var qmpstatus;
+	    var template;
 
 	    if (!success) {
 		me.workspace.checkVmMigration(me.pveSelNode);
@@ -198,6 +199,10 @@ Ext.define('PVE.qemu.Config', {
 		status = rec ? rec.data.value : 'unknown';
 		rec = s.data.get('qmpstatus');
 		qmpstatus = rec ? rec.data.value : 'unknown';
+		rec = s.data.get('template');
+		if(rec.data.value){
+		    template = rec.data.value;
+		}
 	    }
 
 	    if (qmpstatus === 'prelaunch' || qmpstatus === 'paused') {
@@ -208,8 +213,8 @@ Ext.define('PVE.qemu.Config', {
 		resumeBtn.setVisible(false);
 	    }
 
-	    startBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status === 'running');
-	    resetBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status !== 'running');
+	    startBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status === 'running' || template);
+	    resetBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status !== 'running' || template);
 	    shutdownBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status !== 'running');
 	    stopBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status === 'stopped');
 	    removeBtn.setDisabled(!caps.vms['VM.Allocate'] || status !== 'stopped');
-- 
1.7.10.4




More information about the pve-devel mailing list