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

Friedrich Weber f.weber at proxmox.com
Fri Apr 12 16:15:48 CEST 2024


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 for
  the given VMID that are visible for the user, and abort them before attempting
  to stop the VM/CT. Users/tokens with `Sys.Modify` can abort any guest task,
  users can abort their own guest tasks (including the ones by their tokens),
  and tokens can only abort their own guest tasks.
- Frontend: Issuing a stop command shows a confirmation message box that, if an
  active shutdown task for that guest is detected, shows a default-on checkbox
  that offers to overrule active shutdown tasks. If it is checked, the API
  request is sent with `overrule-shutdown=1`.

Tested with a hung CentOS 7 container and a SeaBIOS VM without a bootable disk.

Changes v2 -> v3:
- dropped pve-container patch that was already applied in v2
- incorporated suggestions by Thomas, see individual patches for details

Changes v1 -> v2:
- fixed patch ordering, as suggested by Wolfgang on v1
- added a pve-container patch that moves config locking from API handlers
  into workers for start/stop/shutdown/suspend, as suggested by Wolfgang on v1
- instead of showing a second modal dialog when stopping a guest, show a "guest
  stop" message box that has an optional checkbox offering to overrule shutdown
  tasks
- split pve-manager patch in two

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

guest-common:

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

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


container:

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

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


qemu-server:

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

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


manager:

Friedrich Weber (2):
  ui: fix typo to make pve-cluster-tasks store globally available
  fix #4474: ui: guest stop: offer to overrule active shutdown tasks

 www/manager6/Makefile            |  1 +
 www/manager6/dc/Tasks.js         |  2 +-
 www/manager6/lxc/CmdMenu.js      |  8 +++-
 www/manager6/lxc/Config.js       |  8 ++--
 www/manager6/qemu/CmdMenu.js     |  8 +++-
 www/manager6/qemu/Config.js      |  8 ++--
 www/manager6/window/GuestStop.js | 79 ++++++++++++++++++++++++++++++++
 7 files changed, 105 insertions(+), 9 deletions(-)
 create mode 100644 www/manager6/window/GuestStop.js


Summary over all repositories:
  10 files changed, 177 insertions(+), 0 deletions(-)

-- 
Generated by git-murpp 0.5.0




More information about the pve-devel mailing list