ui: qemu: set correct disabled state for start button

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@proxmox.com>
This commit is contained in:
Stefan Reiter 2020-10-19 14:18:42 +02:00 committed by Thomas Lamprecht
parent 7828eef6f2
commit 6a073b92e9

View File

@ -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);