[pve-devel] [RFC manager/container/qemu-server/guest-common 0/4] fix #4474: stop tasks may overrule shutdown tasks

Friedrich Weber f.weber at proxmox.com
Thu Jan 26 09:32:10 CET 2023


As reported in #4474 [0], a user may attempt to shutdown a VM/CT,
realize that it is unresponsive, and decide to stop it instead. If the
shutdown task has not timed out yet, the stop task will fail. The user
needs to manually abort the shutdown task before stopping the VM,
which is inconvenient.

With this patch series, a stop task can optionally overrule active
shutdown tasks.

Summary of changes:

* Backend: We add a new optional `overrule-shutdown` parameter to
  VM/CT `/stop` endpoints. If it is 1, we query for active
  `qmshutdown`/`vzshutdown` tasks by the current user for the given
  VMID, and abort them before attempting to stop the VM/CT.
* Frontend: Before sending a stop command, we check whether there are
  active shutdown tasks. If yes, we ask the user whether they should
  be aborted, and send `overrule-shutdown=1` accordingly.

Tested with a hung CentOS 7 container and a Debian VM where I edited
/etc/systemd/logind.conf to set `HandlePowerKey=ignore`.

Sending this as RFC, to make a first proposal and iterate from there.
My most important questions:

* Does it make sense to have overruling optional? Or should "stop"
  generally overrule shutdown? This might lead to confusing
  interactions, as Thomas noted [0].
* Backend: Is there a more elegant way to overrule shutdown tasks,
  and a better place than pve-guest-common?
* Frontend: When stopping a VM/CT, we already ask for confirmation.
  Is an (occasional) second modal dialog with a lot of text a good user
  experience? Alternatively, I could imagine a checkbox in the first
  dialog saying "Overrule any active shutdown tasks".
* This patch series forbids `overrule-shutdown=1` for HA-managed VMs/CTs
  because I didn't know how overruling should work in a HA setting. Do
  you have any suggestions?

Since this is my first patch with more than a few lines, I'm especially
happy about feedback regarding coding style, naming, anything. :)

[0]: https://bugzilla.proxmox.com/show_bug.cgi?id=4474

pve-manager:

Friedrich Weber (1):
  fix #4474: ui: vm stop: ask if active shutdown tasks should be aborted

 www/manager6/Utils.js        | 27 +++++++++++++++++++++++++++
 www/manager6/dc/Tasks.js     |  2 +-
 www/manager6/lxc/CmdMenu.js  | 14 +++++++++++++-
 www/manager6/lxc/Config.js   |  6 +++++-
 www/manager6/qemu/CmdMenu.js | 14 +++++++++++++-
 www/manager6/qemu/Config.js  |  9 ++++++++-
 6 files changed, 67 insertions(+), 5 deletions(-)

pve-container:

Friedrich Weber (1):
  fix #4474: lxc api: add overrule-shutdown parameter to stop endpoint

 src/PVE/API2/LXC/Status.pm | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

qemu-server:

Friedrich Weber (1):
  fix #4474: qemu api: add overrule-shutdown parameter to stop endpoint

 PVE/API2/Qemu.pm | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

pve-guest-common:

Friedrich Weber (1):
  guest helpers: add helper to overrule active tasks of a specific type

 src/PVE/GuestHelpers.pm | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)


-- 
2.30.2






More information about the pve-devel mailing list