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 92DA61FF09C for ; Mon, 19 Oct 2026 16:50:03 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 4D42921915; Mon, 19 Oct 2026 16:47:38 +0200 (CEST) From: Fiona Ebner To: pve-devel@lists.proxmox.com Subject: [PATCH qemu-server v5 23/28] migration: intra-cluster: check config can be parsed on target node Date: Mon, 19 Oct 2026 16:46:05 +0200 Message-ID: <20261019144629.215541-24-f.ebner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261019144629.215541-1-f.ebner@proxmox.com> References: <20261019144629.215541-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: 1792421195023 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.359 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 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: TPCR4HTDU2P5CSZUE364CGOKE32KWTOB X-Message-ID-Hash: TPCR4HTDU2P5CSZUE364CGOKE32KWTOB 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 like [0] for future new settings, with lines being unexpectedly and relatively silently dropped (there are warnings in the target's system logs, but nothing else). Unfortunately, before commit "qm: mtunnel: reply when a command is unknown", which is part of the same patch series, when a command is unknown, mtunnel did not reply at all. Therefore, check that the target node is recent enough to support the new mtunnel command. [0]: https://bugzilla.proxmox.com/show_bug.cgi?id=7341 Signed-off-by: Fiona Ebner --- The pve-manager version in the check must be adapted upon applying! Changes in v5: * Bump required pve-manager version. src/PVE/API2/Qemu.pm | 10 +++++++++ src/PVE/QemuMigrate.pm | 27 +++++++++++++++++++++++ src/test/MigrationTest/QemuMigrateMock.pm | 11 ++++++++- 3 files changed, 47 insertions(+), 1 deletion(-) diff --git a/src/PVE/API2/Qemu.pm b/src/PVE/API2/Qemu.pm index 889f6aaf..244b1ea2 100644 --- a/src/PVE/API2/Qemu.pm +++ b/src/PVE/API2/Qemu.pm @@ -138,6 +138,15 @@ my $migrate_json_properties = { default => 0, description => 'Whether to migrate conntrack entries for running VMs.', }, + '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 dropped' + . ' 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 @@ -145,6 +154,7 @@ my $migrate_json_properties = { # HA migrations with many being hard-coded for the LRM invocation. my $ha_migrate_props = { 'with-conntrack-state' => 1, + 'skip-config-check' => 1, }; sub ha_migrate_json_properties { diff --git a/src/PVE/QemuMigrate.pm b/src/PVE/QemuMigrate.pm index 279ed70b..aba59475 100644 --- a/src/PVE/QemuMigrate.pm +++ b/src/PVE/QemuMigrate.pm @@ -359,6 +359,33 @@ 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, 23)) { + # Fork a short-lived tunnel for checking the config. Later, the proper tunnel with + # SSH forwarding info is forked. + my $tunnel = $self->fork_tunnel(); + # Compared to remote migration, which also does volume activation, this only + # strictly parses the config, so no too large timeout is needed. + 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 $@; + + if ($err) { + chomp($err); + die "$err - use 'skip-config-check' flag to migrate regardless\n"; + } + } else { + $self->log('info', "skipping config check - target pve-manager version < 9.2.23"); + } + } else { + $self->log('info', "skipping config check - override option is set"); + } } return $running; diff --git a/src/test/MigrationTest/QemuMigrateMock.pm b/src/test/MigrationTest/QemuMigrateMock.pm index c715a60e..a2e97315 100644 --- a/src/test/MigrationTest/QemuMigrateMock.pm +++ b/src/test/MigrationTest/QemuMigrateMock.pm @@ -66,6 +66,10 @@ $tunnel_module->mock( my $vmid = $1; die "resuming wrong VM '$vmid'\n" if $vmid ne $test_vmid; return; + } elsif ($command =~ m/^config (\d+) (\S+)$/) { + my ($vmid, $node) = ($1, $2); + die "check config for wrong VM '$vmid'\n" if $vmid ne $test_vmid; + return; } die "write_tunnel (mocked) - implement me: $command\n"; }, @@ -74,7 +78,12 @@ $tunnel_module->mock( my $qemu_migrate_module = Test::MockModule->new("PVE::QemuMigrate"); $qemu_migrate_module->mock( fork_tunnel => sub { - die "fork_tunnel (mocked) - implement me\n"; # currently no call should lead here + return { + writer => "mocked", + reader => "mocked", + pid => 123456, + version => 1, + }; }, start_remote_tunnel => sub { my ($self, $raddr, $rport, $ruri, $unix_socket_info) = @_; -- 2.47.3