[pve-devel] [PATCH manager 7/7] ui: qemu: set correct disabled state for start button

Stefan Reiter s.reiter at proxmox.com
Thu Sep 3 10:58:51 CEST 2020


If a guest's QEMU process is 'running', but QMP says 'shutdown' or
'prelaunch', the VM is ready to be booted anew, so we can show the
button.

The 'shutdown' button is intentionally not touched, as we always want to
give the user the ability to 'stop' a VM (and thus kill any potentially
leftover processes).

Signed-off-by: Stefan Reiter <s.reiter at proxmox.com>
---
 www/manager6/qemu/Config.js | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/www/manager6/qemu/Config.js b/www/manager6/qemu/Config.js
index a13bf0c5..346c71a7 100644
--- a/www/manager6/qemu/Config.js
+++ b/www/manager6/qemu/Config.js
@@ -411,7 +411,10 @@ Ext.define('PVE.qemu.Config', {
 
 	    statusTxt.update({ lock: lock });
 
-	    startBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status === 'running' || template);
+	    let guest_running = status === 'running' &&
+		!(qmpstatus === "shutdown" || qmpstatus === "prelaunch");
+	    startBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || template || guest_running);
+
 	    shutdownBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status !== 'running');
 	    me.down('#removeBtn').setDisabled(!caps.vms['VM.Allocate'] || status !== 'stopped');
 	    consoleBtn.setDisabled(template);
-- 
2.20.1






More information about the pve-devel mailing list