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 12E611FF0C1 for ; Fri, 18 Sep 2026 18:09:50 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 7C4C5216B3; Fri, 18 Sep 2026 18:08:54 +0200 (CEST) From: Fiona Ebner To: pve-devel@lists.proxmox.com Subject: [PATCH ha-manager v3 05/21] lrm: resource migration: support extra migration options Date: Fri, 18 Sep 2026 18:08:11 +0200 Message-ID: <20260918160841.128088-6-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: 1789747729695 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.606 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: QUWQFWX24O76VEL6IZADM2ESHBRWDJOF X-Message-ID-Hash: QUWQFWX24O76VEL6IZADM2ESHBRWDJOF 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: The options will be passed from the guest API endpoints through the HA stack, all the way to the resource plugins. In a following commit, the resource plugins will forward parts of the schema of the resource-specific migration endpoint to the HA resource endpoint. In particular, forwarding the 'with-conntrack-state' option will be used to fix bug #7053. Signed-off-by: Fiona Ebner --- New in v3. src/PVE/HA/LRM.pm | 15 ++++++++++----- src/PVE/HA/Resources.pm | 2 +- src/PVE/HA/Resources/PVECT.pm | 5 ++++- src/PVE/HA/Resources/PVEVM.pm | 5 ++++- src/PVE/HA/Sim/Resources.pm | 2 +- src/PVE/HA/Sim/Resources/VirtCT.pm | 2 +- src/PVE/HA/Sim/Resources/VirtFail.pm | 2 +- 7 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/PVE/HA/LRM.pm b/src/PVE/HA/LRM.pm index 72e37e6..5fc66eb 100644 --- a/src/PVE/HA/LRM.pm +++ b/src/PVE/HA/LRM.pm @@ -749,14 +749,19 @@ sub manage_resources { # intermediate step for optional better node selection on stop -> start request state change next if $request_state eq 'request_start'; + my $params = { + 'target' => $sd->{target}, + 'timeout' => $sd->{timeout}, + }; + if (defined($sd->{'migrate-options'})) { + $params->{'migrate-options'} = $sd->{'migrate-options'}; + } + $self->queue_resource_command( $sid, $sd->{uid}, $request_state, - { - 'target' => $sd->{target}, - 'timeout' => $sd->{timeout}, - }, + $params, ); } @@ -1040,7 +1045,7 @@ sub exec_resource_agent { my $online = ($cmd eq 'migrate') ? 1 : 0; - my $res = $plugin->migrate($haenv, $id, $target, $online); + my $res = $plugin->migrate($haenv, $id, $target, $online, $params->{'migrate-options'}); # something went wrong if service is still on this node if (!$res) { diff --git a/src/PVE/HA/Resources.pm b/src/PVE/HA/Resources.pm index df7c1ff..656cb19 100644 --- a/src/PVE/HA/Resources.pm +++ b/src/PVE/HA/Resources.pm @@ -154,7 +154,7 @@ sub shutdown { } sub migrate { - my ($class, $haenv, $id, $target, $online) = @_; + my ($class, $haenv, $id, $target, $online, $migrate_options) = @_; die "implement in subclass"; } diff --git a/src/PVE/HA/Resources/PVECT.pm b/src/PVE/HA/Resources/PVECT.pm index 177b907..3d8a5b9 100644 --- a/src/PVE/HA/Resources/PVECT.pm +++ b/src/PVE/HA/Resources/PVECT.pm @@ -106,7 +106,7 @@ sub shutdown { } sub migrate { - my ($class, $haenv, $id, $target, $online) = @_; + my ($class, $haenv, $id, $target, $online, $migrate_options) = @_; my $nodename = $haenv->nodename(); @@ -117,6 +117,9 @@ sub migrate { online => 0, # we cannot migrate CT (yet) online, only relocate }; + $migrate_options //= {}; + $params->{$_} = $migrate_options->{$_} for sort keys $migrate_options->%*; + # always relocate container for now if ($class->check_running($haenv, $id)) { $class->shutdown($haenv, $id); diff --git a/src/PVE/HA/Resources/PVEVM.pm b/src/PVE/HA/Resources/PVEVM.pm index 8753271..964f374 100644 --- a/src/PVE/HA/Resources/PVEVM.pm +++ b/src/PVE/HA/Resources/PVEVM.pm @@ -107,7 +107,7 @@ sub shutdown { } sub migrate { - my ($class, $haenv, $id, $target, $online) = @_; + my ($class, $haenv, $id, $target, $online, $migrate_options) = @_; my $nodename = $haenv->nodename(); @@ -123,6 +123,9 @@ sub migrate { online => $online, }; + $migrate_options //= {}; + $params->{$_} = $migrate_options->{$_} for sort keys $migrate_options->%*; + # explicitly shutdown if $online isn't true (relocate) if (!$online && $class->check_running($haenv, $id)) { $class->shutdown($haenv, $id); diff --git a/src/PVE/HA/Sim/Resources.pm b/src/PVE/HA/Sim/Resources.pm index 9b2f3b6..a464c62 100644 --- a/src/PVE/HA/Sim/Resources.pm +++ b/src/PVE/HA/Sim/Resources.pm @@ -88,7 +88,7 @@ sub check_running { } sub migrate { - my ($class, $haenv, $id, $target, $online) = @_; + my ($class, $haenv, $id, $target, $online, $migrate_options) = @_; my $sid = $class->type() . ":$id"; my $nodename = $haenv->nodename(); diff --git a/src/PVE/HA/Sim/Resources/VirtCT.pm b/src/PVE/HA/Sim/Resources/VirtCT.pm index 3f6df85..ac61486 100644 --- a/src/PVE/HA/Sim/Resources/VirtCT.pm +++ b/src/PVE/HA/Sim/Resources/VirtCT.pm @@ -17,7 +17,7 @@ sub exists { } sub migrate { - my ($class, $haenv, $id, $target, $online) = @_; + my ($class, $haenv, $id, $target, $online, $migrate_options) = @_; my $sid = "ct:$id"; my $nodename = $haenv->nodename(); diff --git a/src/PVE/HA/Sim/Resources/VirtFail.pm b/src/PVE/HA/Sim/Resources/VirtFail.pm index ea7a87a..71bd282 100644 --- a/src/PVE/HA/Sim/Resources/VirtFail.pm +++ b/src/PVE/HA/Sim/Resources/VirtFail.pm @@ -84,7 +84,7 @@ sub shutdown { } sub migrate { - my ($class, $haenv, $id, $target, $online) = @_; + my ($class, $haenv, $id, $target, $online, $migrate_options) = @_; my ($migrate_failure_count, $limit_to_node) = ($decode_id->($id))[1, 4]; -- 2.47.3