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 A26811FF0BC for ; Thu, 15 Oct 2026 14:52:59 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 4D37A217A7; Thu, 15 Oct 2026 14:51:38 +0200 (CEST) From: Fiona Ebner To: pve-devel@lists.proxmox.com Subject: [PATCH ha-manager v4 11/27] resources: add migrate_json_properties() method Date: Thu, 15 Oct 2026 14:50:45 +0200 Message-ID: <20261015125112.174954-12-f.ebner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261015125112.174954-1-f.ebner@proxmox.com> References: <20261015125112.174954-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: 1792068676782 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.411 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: 462TV65BJ27MXTTVVANGAOSX2BLEPIK2 X-Message-ID-Hash: 462TV65BJ27MXTTVVANGAOSX2BLEPIK2 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: Will be used by the API schema for resource-type specific migration options. When migrating dependent resources, the migration options will be filtered according to the resource type, so the property schema is also needed there. Signed-off-by: Fiona Ebner --- Dependency bump for pve-container and qemu-server needed! Changes in v4: * Split out from other patch and turn into proper method, because this is needed for filtering properties when migrating a dependent resource. src/PVE/HA/Resources.pm | 20 ++++++++++++++++++++ src/PVE/HA/Resources/PVECT.pm | 11 +++++++++++ src/PVE/HA/Resources/PVEVM.pm | 11 +++++++++++ src/PVE/HA/Sim/Resources.pm | 6 ++++++ 4 files changed, 48 insertions(+) diff --git a/src/PVE/HA/Resources.pm b/src/PVE/HA/Resources.pm index 656cb19..57fde00 100644 --- a/src/PVE/HA/Resources.pm +++ b/src/PVE/HA/Resources.pm @@ -103,6 +103,20 @@ EODESC }, }; +our $common_migrate_json_properties = { + sid => get_standard_option( + 'pve-ha-resource-or-vm-id', + { completion => \&PVE::HA::Tools::complete_sid }, + ), + node => get_standard_option( + 'pve-node', + { + completion => \&PVE::Cluster::complete_migration_target, + description => "Target node.", + }, + ), +}; + sub verify_name { my ($class, $name) = @_; @@ -159,6 +173,12 @@ sub migrate { die "implement in subclass"; } +sub migrate_json_properties { + my ($class) = @_; + + die "implement in subclass"; +} + sub config_file { my ($class, $id, $nodename) = @_; diff --git a/src/PVE/HA/Resources/PVECT.pm b/src/PVE/HA/Resources/PVECT.pm index a8fe42e..67bab7a 100644 --- a/src/PVE/HA/Resources/PVECT.pm +++ b/src/PVE/HA/Resources/PVECT.pm @@ -174,4 +174,15 @@ sub get_static_stats_from_config { }; } +# FIXME: the extra properties are missing from the docs, since the PVE::API2::LXC module can't be +# included in the generating docs environment, because of cyclic dependencies.. +sub migrate_json_properties { + my ($class) = @_; + my $combined = { $PVE::HA::Resources::common_migrate_json_properties->%* }; + my $extra_migrate_props = eval { PVE::API2::LXC::ha_migrate_json_properties() } // {}; + die $@ if $@ && !$ENV{PVE_GENERATING_DOCS}; + $combined->{$_} = $extra_migrate_props->{$_} for keys $extra_migrate_props->%*; + return $combined; +} + 1; diff --git a/src/PVE/HA/Resources/PVEVM.pm b/src/PVE/HA/Resources/PVEVM.pm index 3b61113..76b927c 100644 --- a/src/PVE/HA/Resources/PVEVM.pm +++ b/src/PVE/HA/Resources/PVEVM.pm @@ -194,4 +194,15 @@ sub get_static_stats_from_config { }; } +# FIXME: the extra properties are missing from the docs, since the PVE::API2::QEMU module can't be +# included in the generating docs environment, because of cyclic dependencies.. +sub migrate_json_properties { + my ($class) = @_; + my $combined = { $PVE::HA::Resources::common_migrate_json_properties->%* }; + my $extra_migrate_props = eval { PVE::API2::Qemu::ha_migrate_json_properties() } // {}; + die $@ if $@ && !$ENV{PVE_GENERATING_DOCS}; + $combined->{$_} = $extra_migrate_props->{$_} for keys $extra_migrate_props->%*; + return $combined; +} + 1; diff --git a/src/PVE/HA/Sim/Resources.pm b/src/PVE/HA/Sim/Resources.pm index a464c62..730bfaa 100644 --- a/src/PVE/HA/Sim/Resources.pm +++ b/src/PVE/HA/Sim/Resources.pm @@ -122,6 +122,12 @@ sub migrate { return defined($ss->{$sid}) ? 0 : 1; } +sub migrate_json_properties { + my ($class) = @_; + + return $PVE::HA::Resources::common_migrate_json_properties; +} + sub remove_locks { my ($self, $haenv, $id, $locks, $service_node) = @_; -- 2.47.3