From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id 82D711FF09C for ; Mon, 21 Sep 2026 17:35:53 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id A59432158D; Mon, 21 Sep 2026 17:35:49 +0200 (CEST) From: Jakob Klocker 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 Message-ID: <20260921153545.406664-2-j.klocker@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260921153545.406664-1-j.klocker@proxmox.com> References: <20260921153545.406664-1-j.klocker@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 1 AWL -0.699 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) KAM_LAZY_DOMAIN_SECURITY 1 Sending domain does not have any anti-forgery methods RDNS_NONE 1.274 Delivered to internal network by a host with no rDNS SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_NONE 0.001 SPF: sender does not publish an SPF Record Message-ID-Hash: 6CIGET2HGQNJZEUP4DPOIQU5XHZTF5OC X-Message-ID-Hash: 6CIGET2HGQNJZEUP4DPOIQU5XHZTF5OC X-MailFrom: jklocker@dev.proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 --- 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