public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Michael Köppl" <m.koeppl@proxmox.com>
To: "Jakob Klocker" <j.klocker@proxmox.com>, <pve-devel@lists.proxmox.com>
Subject: Re: [PATCH pve-container 1/2] api: refuse moving volumes if container is protected
Date: Thu, 22 Oct 2026 15:15:14 +0200	[thread overview]
Message-ID: <DMBE7YQQ8RR2.2FL7RD17XGYR3@proxmox.com> (raw)
In-Reply-To: <20260921153545.406664-2-j.klocker@proxmox.com>

On Mon Sep 21, 2026 at 5:35 PM CEST, Jakob Klocker wrote:
> 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",
> +            );

Doesn't this add a second check that was already added with c05243e4?
If the target CT is protected, the second check can never be reached.

> +
>              die "Can't move volumes from or to template CT\n"
>                  if ($source_conf->{template} || $target_conf->{template});
>






  reply	other threads:[~2026-10-22 13:15 UTC|newest]

Thread overview: 6+ 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 ` [PATCH pve-container 1/2] api: refuse moving volumes if container is protected Jakob Klocker
2026-10-22 13:15   ` Michael Köppl [this message]
2026-09-21 15:35 ` [PATCH qemu-server 2/2] api: refuse moving disks if source VM " Jakob Klocker
2026-10-22 13:15   ` Michael Köppl
2026-10-22 13:15 ` [PATCH container/qemu-server 0/2] qemu: lxc: refuse moving disks/volumes of protected VMs/CTs Michael Köppl

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=DMBE7YQQ8RR2.2FL7RD17XGYR3@proxmox.com \
    --to=m.koeppl@proxmox.com \
    --cc=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