all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
	Friedrich Weber <f.weber@proxmox.com>
Subject: [pve-devel] applied: [PATCH guest-common v3 1/5] guest helpers: add helper to abort active guest tasks of a certain type
Date: Wed, 17 Apr 2024 20:44:33 +0200	[thread overview]
Message-ID: <ae3d090d-7a54-431f-9429-fe3611fbf542@proxmox.com> (raw)
In-Reply-To: <20240412141553.430554-2-f.weber@proxmox.com>

Am 12/04/2024 um 16:15 schrieb Friedrich Weber:
> 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>
> ---
> 
> Notes:
>     As the computation of `$can_abort_task` essentially duplicates logic
>     from PVE/API2/Tasks.pm, I considered reusing that, but this would have
>     required moving it to one of the dependencies of pve-guest-common
>     (Thomas suggested pve-access-control off-list). Seeing that the logic
>     boils down to 4 lines in `abort_guest_tasks`, I didn't consider it
>     worth the trouble in the end. Happy to reconsider, though.
>     
>     changes v2 -> v3:
>     - improved readability: renamed subroutine to describe what it does,
>       renamed return value, added comment, clarified commit message (thx
>       Thomas)
>     - better align logic with current permission model for stopping tasks:
>       - allow users with Sys.Modify to abort *any* task (thx Thomas)
>       - allow users to abort tasks of their tokens
>     
>     no changes v1 -> v2
> 
>  src/PVE/GuestHelpers.pm | 35 +++++++++++++++++++++++++++++++++++
>  1 file changed, 35 insertions(+)
> 
>

applied, with some (very) tiny efficiency improvement as follow-up, thanks!


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


  reply	other threads:[~2024-04-17 18:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-12 14:15 [pve-devel] [PATCH guest-common/container/qemu-server/manager v3 0/5] fix #4474: stop tasks may overrule shutdown tasks Friedrich Weber
2024-04-12 14:15 ` [pve-devel] [PATCH guest-common v3 1/5] guest helpers: add helper to abort active guest tasks of a certain type Friedrich Weber
2024-04-17 18:44   ` Thomas Lamprecht [this message]
2024-04-12 14:15 ` [pve-devel] [PATCH container v3 2/5] fix #4474: lxc api: add overrule-shutdown parameter to stop endpoint Friedrich Weber
2024-04-17 18:44   ` [pve-devel] applied: " Thomas Lamprecht
2024-04-12 14:15 ` [pve-devel] [PATCH qemu-server v3 3/5] fix #4474: qemu " Friedrich Weber
2024-04-17 18:44   ` [pve-devel] applied: " Thomas Lamprecht
2024-04-12 14:15 ` [pve-devel] [PATCH manager v3 4/5] ui: fix typo to make pve-cluster-tasks store globally available Friedrich Weber
2024-04-17 18:45   ` [pve-devel] applied: " Thomas Lamprecht
2024-04-12 14:15 ` [pve-devel] [PATCH manager v3 5/5] fix #4474: ui: guest stop: offer to overrule active shutdown tasks Friedrich Weber
2024-04-19 10:17   ` Dominik Csapak
2024-04-21  8:28     ` Thomas Lamprecht
2024-04-20 18:34   ` [pve-devel] applied: " Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ae3d090d-7a54-431f-9429-fe3611fbf542@proxmox.com \
    --to=t.lamprecht@proxmox.com \
    --cc=f.weber@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal