public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Jakob Klocker <j.klocker@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH pve-container 1/2] api: refuse moving volumes if container is protected
Date: Mon, 21 Sep 2026 17:35:44 +0200	[thread overview]
Message-ID: <20260921153545.406664-2-j.klocker@proxmox.com> (raw)
In-Reply-To: <20260921153545.406664-1-j.klocker@proxmox.com>

According to the documentation, a protected container will prevent
volume remove/update operations.
Refuse moving a volume if either the target or the source container is
protected.

Signed-off-by: Jakob Klocker <j.klocker@proxmox.com>
---
 src/PVE/API2/LXC.pm | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm
index 88067dd..677eff3 100644
--- a/src/PVE/API2/LXC.pm
+++ b/src/PVE/API2/LXC.pm
@@ -2601,6 +2601,11 @@ __PACKAGE__->register_method({
                     die "cannot move volumes of a running container\n"
                         if PVE::LXC::check_running($vmid);
 
+                    PVE::LXC::Config->check_protection(
+                        $conf,
+                        "cannot move volumes of a protected container\n",
+                    );
+
                     if ($mpkey =~ m/^unused\d+$/) {
                         die
                             "cannot move volume '$mpkey', only configured volumes can be moved to "
@@ -2748,6 +2753,15 @@ __PACKAGE__->register_method({
                 PVE::LXC::Config->check_lock($target_conf);
             }
 
+            PVE::LXC::Config->check_protection(
+                $source_conf,
+                "cannot move volumes of a protected container\n",
+            );
+            PVE::LXC::Config->check_protection(
+                $target_conf,
+                "cannot move volumes to a protected container\n",
+            );
+
             die "Can't move volumes from or to template CT\n"
                 if ($source_conf->{template} || $target_conf->{template});
 
-- 
2.47.3




  reply	other threads:[~2026-09-21 15:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-21 15:35 [PATCH container/qemu-server 0/2] qemu: lxc: refuse moving disks/volumes of protected VMs/CTs Jakob Klocker
2026-09-21 15:35 ` Jakob Klocker [this message]
2026-09-21 15:35 ` [PATCH qemu-server 2/2] api: refuse moving disks if source VM is protected Jakob Klocker

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=20260921153545.406664-2-j.klocker@proxmox.com \
    --to=j.klocker@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