From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id A62B01FF0C1 for ; Fri, 18 Sep 2026 18:12:10 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id AAE6121889; Fri, 18 Sep 2026 18:09:16 +0200 (CEST) From: Fiona Ebner To: pve-devel@lists.proxmox.com Subject: [PATCH qemu-server v3 17/21] migration: intra-cluster: check config can be parsed on target node Date: Fri, 18 Sep 2026 18:08:23 +0200 Message-ID: <20260918160841.128088-18-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: 1789747730502 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.573 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: DD2VS6JL3PARPZ2CYE2ZBED5TW6IAHQF X-Message-ID-Hash: DD2VS6JL3PARPZ2CYE2ZBED5TW6IAHQF 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 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/Qemu.pm | 10 ++++++++++ src/PVE/QemuMigrate.pm | 24 +++++++++++++++++++++++ src/test/MigrationTest/QemuMigrateMock.pm | 11 ++++++++++- 3 files changed, 44 insertions(+), 1 deletion(-) diff --git a/src/PVE/API2/Qemu.pm b/src/PVE/API2/Qemu.pm index 56b6c500..937f8cae 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 080490f0..fff57eab 100644 --- a/src/PVE/QemuMigrate.pm +++ b/src/PVE/QemuMigrate.pm @@ -359,6 +359,30 @@ 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 = $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 $@; + + 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"); + } } return $running; diff --git a/src/test/MigrationTest/QemuMigrateMock.pm b/src/test/MigrationTest/QemuMigrateMock.pm index 3a483817..ac198acb 100644 --- a/src/test/MigrationTest/QemuMigrateMock.pm +++ b/src/test/MigrationTest/QemuMigrateMock.pm @@ -65,6 +65,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"; }, @@ -73,7 +77,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