public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Maximiliano Sandoval <m.sandoval@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH qemu-server] api: create: check VM.PowerMgmt on the pool too
Date: Thu, 11 Jun 2026 16:24:25 +0200	[thread overview]
Message-ID: <20260611142427.495288-1-m.sandoval@proxmox.com> (raw)

If a VM is part of a resource pool, it is possible to start it with the
permission either in /pool or in /vm.

The upfront check done when creating a VM with --start=1 is extended
accordingly to look for the permission on the resource pool if
appropriate.

Fixes: 5086f472 ("api: create: check VM.PowerMgmt up front when starting after create")
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
 src/PVE/API2/Qemu.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/PVE/API2/Qemu.pm b/src/PVE/API2/Qemu.pm
index 54883f1e..4dd546ae 100644
--- a/src/PVE/API2/Qemu.pm
+++ b/src/PVE/API2/Qemu.pm
@@ -1272,7 +1272,7 @@ __PACKAGE__->register_method({
         # vm_start is invoked directly from the create/restore worker, so its
         # own permissions predicate doesn't fire here - check VM.PowerMgmt up
         # front whenever the caller asked us to start the VM after creation.
-        $rpcenv->check($authuser, "/vms/$vmid", ['VM.PowerMgmt'])
+        $rpcenv->check_vm_perm($authuser, $vmid, $pool, ['VM.PowerMgmt'])
             if $start_after_create;
 
         if ($rpcenv->check($authuser, "/vms/$vmid", ['VM.Allocate'], 1)) {
-- 
2.47.3





             reply	other threads:[~2026-06-11 14:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-11 14:24 Maximiliano Sandoval [this message]
2026-06-11 14:40 ` [PATCH qemu-server] api: create: check VM.PowerMgmt on the pool too Jonas Theisen

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=20260611142427.495288-1-m.sandoval@proxmox.com \
    --to=m.sandoval@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal