From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 446E41FF13B for ; Wed, 25 Feb 2026 16:19:35 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 5D25B7C1F; Wed, 25 Feb 2026 16:20:03 +0100 (CET) From: Fiona Ebner To: pve-devel@lists.proxmox.com Subject: [PATCH container v2 14/14] migration: intra-cluster: check config can be parsed on target node Date: Wed, 25 Feb 2026 16:18:37 +0100 Message-ID: <20260225151931.176335-15-f.ebner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260225151931.176335-1-f.ebner@proxmox.com> References: <20260225151931.176335-1-f.ebner@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1772032765120 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.009 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: AJK7SAJ22Q6RYBRUEW6GSQ4PFNKIUNUF X-Message-ID-Hash: AJK7SAJ22Q6RYBRUEW6GSQ4PFNKIUNUF X-MailFrom: f.ebner@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: For remote migration, we already check that the config can be parsed on the target. Do the same for intra-cluster migration, to avoid issues with future new settings unexpectedly being ignored if the target is too old. For example, migrating a container with a mountpoint with 'keepattrs' to a node with a too old pve-container version, results in the mountpoint not being mounted on the target. Signed-off-by: Fiona Ebner --- Dependency bump for guest-common needed! New in v2. src/PVE/API2/LXC.pm | 11 +++++++++++ src/PVE/LXC/Migrate.pm | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm index 7841215..ec0b815 100644 --- a/src/PVE/API2/LXC.pm +++ b/src/PVE/API2/LXC.pm @@ -1618,6 +1618,14 @@ __PACKAGE__->register_method({ minimum => '0', default => 'migrate limit from datacenter or storage config', }, + force => { + type => 'boolean', + description => + "For intra-cluster migration: allow migration even if there are configuration" + . " options not understood by the target. Only root may use this option.", + optional => 1, + default => 0, + }, }, }, returns => { @@ -1644,6 +1652,9 @@ __PACKAGE__->register_method({ my $vmid = extract_param($param, 'vmid'); + raise_param_exc({ force => "Only root may use this option." }) + if $param->{force} && $authuser ne 'root@pam'; + # test if VM exists PVE::LXC::Config->load_config($vmid); diff --git a/src/PVE/LXC/Migrate.pm b/src/PVE/LXC/Migrate.pm index d243d90..1786e15 100644 --- a/src/PVE/LXC/Migrate.pm +++ b/src/PVE/LXC/Migrate.pm @@ -159,6 +159,43 @@ sub prepare { my $cmd = [@{ $self->{rem_ssh} }, '/bin/true']; eval { $self->cmd_quiet($cmd); }; die "Can't connect to destination address using public key\n" if $@; + + if (!$self->{opts}->{force}) { + my $skip; + + # TODO PVE 10 - simplify by assuming that 'pct mtunnel' command is supported + my $log_and_check_supported = sub { + my ($level, $msg) = @_; + # Skip if the target is too old to support 'pct mtunnel' and avoid printing the + # whole 'pct' usage output + return if $skip; + if ($msg =~ m/unknown command 'pct mtunnel'/) { + $skip = 1; + return; + } + $self->log($level, $msg); + }; + + my $tunnel = eval { + PVE::Tunnel::fork_ssh_tunnel( + $self->{rem_ssh}, ['pct', 'mtunnel'], undef, $log_and_check_supported); + }; + my $err = $@; + if ($skip) { + $self->log('info', "skipping strict configuration check - target too old"); + } else { + die $err if $err; + + my $nodename = PVE::INotify::nodename(); + eval { PVE::Tunnel::write_tunnel($tunnel, 10, "config $vmid $nodename"); }; + if (my $err = $@) { + chomp($err); + die "$err - use --force to migrate regardless\n"; + } + eval { PVE::Tunnel::finish_tunnel($tunnel); }; + $self->log('warn', "failed to finish tunnel in prepare() - $@") if $@; + } + } } # in restart mode, we shutdown the container before migrating -- 2.47.3