]> git.proxmox.com Git - pve-guest-common.git/commit
guest helpers: add helper to abort active guest tasks of a certain type
authorFriedrich Weber <f.weber@proxmox.com>
Fri, 12 Apr 2024 14:15:49 +0000 (16:15 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 17 Apr 2024 15:24:11 +0000 (17:24 +0200)
commit253a2ea93d5ae1b8a3f2397dd88178727c6a6995
treeef9c21072b94585ce2c92ee734034058fcee73e7
parent58c48f3ef0a190724aaea5c5a34395f59e78dc80
guest helpers: add helper to abort active guest tasks of a certain type

Given a `(type, user, vmid)` tuple, the helper aborts all tasks of the
given `type` for guest `vmid` that `user` is allowed to abort:

- If `user` has `Sys.Modify` on the node, they can abort any task
- If `user` is an API token, it can abort any task it started itself
- If `user` is a user, they can abort any task started by themselves
  or one of their API tokens.

The helper is used to overrule any active qmshutdown/vzshutdown tasks
when attempting to stop a VM/CT (if requested).

Signed-off-by: Friedrich Weber <f.weber@proxmox.com>
src/PVE/GuestHelpers.pm