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 42DF81FF0C1 for ; Fri, 18 Sep 2026 18:11:25 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 393E5215EB; Fri, 18 Sep 2026 18:09:10 +0200 (CEST) From: Fiona Ebner To: pve-devel@lists.proxmox.com Subject: [PATCH container v3 21/21] migration: intra-cluster: check config can be parsed on target node Date: Fri, 18 Sep 2026 18:08:27 +0200 Message-ID: <20260918160841.128088-22-f.ebner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260918160841.128088-1-f.ebner@proxmox.com> References: <20260918160841.128088-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: 1789747730853 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.579 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) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust RCVD_IN_MSPIKE_H2 0.001 Average reputation (+2) 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: RETE5RLC7SNJE5QS2U3QACPWKNPBK72B X-Message-ID-Hash: RETE5RLC7SNJE5QS2U3QACPWKNPBK72B 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 --- The node version might need to be adapted when applying! Changes in v3: * add skip-config-check flag rather than re-using force. * check node version to decide if too old or not. src/PVE/API2/LXC.pm | 13 ++++++++++++- src/PVE/LXC/Migrate.pm | 30 ++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm index c89837e..c5e3b04 100644 --- a/src/PVE/API2/LXC.pm +++ b/src/PVE/API2/LXC.pm @@ -82,12 +82,23 @@ my $migrate_json_properties = { minimum => '0', default => 'migrate limit from datacenter or storage config', }, + 'skip-config-check' => { + type => 'boolean', + optional => 1, + default => 0, + description => + 'For intra-cluster migration. Skip checking if the configuration can be parsed' + . ' successfully by the target. Using this flag can lead to ignored' + . ' configuration options if the target is too old to parse them.', + }, }; # Properties that will be forwarded via the HA stack to the LRM, which will then use them for its # own invocation of the migration API endpoint. The other properties are not forwarded and lost for # HA migrations with many being hard-coded for the LRM invocation. -my $ha_migrate_props = {}; +my $ha_migrate_props = { + 'skip-config-check' => 1, +}; sub ha_migrate_json_properties { my $forwarded_props = {}; diff --git a/src/PVE/LXC/Migrate.pm b/src/PVE/LXC/Migrate.pm index d243d90..a8d3a3d 100644 --- a/src/PVE/LXC/Migrate.pm +++ b/src/PVE/LXC/Migrate.pm @@ -159,6 +159,36 @@ 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}->{'skip-config-check'}) { + if (PVE::Cluster::node_pvecfg_version_at_least($self->{node}, 9, 2, 21)) { + # Fork a short-lived tunnel for checking the config. Later, the proper tunnel with + # SSH forwarding info is forked. + my $tunnel = PVE::Tunnel::fork_ssh_tunnel( + $self->{rem_ssh}, + ['pct', 'mtunnel'], + undef, + sub { + my ($level, $msg) = @_; + $self->log($level, $msg); + }, + ); + eval { + my $nodename = PVE::INotify::nodename(); + PVE::Tunnel::write_tunnel($tunnel, 30, "config $vmid $nodename"); + }; + my $err = $@; + + eval { PVE::Tunnel::finish_tunnel($tunnel); }; + $self->log('warn', "failed to finish tunnel in prepare() - $@") if $@; + + die "$err - use 'skip-config-check' flag to migrate regardless\n" if $err; + } else { + $self->log('info', "skipping config check - target pve-manager version < 9.2.21"); + } + } else { + $self->log('info', "skipping config check - override option is set"); + } } # in restart mode, we shutdown the container before migrating -- 2.47.3