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 486721FF09C for ; Mon, 19 Oct 2026 13:49:40 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 4768D2162B; Mon, 19 Oct 2026 13:49:37 +0200 (CEST) Message-ID: Date: Mon, 19 Oct 2026 13:49:25 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH ha-manager v4 11/27] resources: add migrate_json_properties() method To: Daniel Kral , pve-devel@lists.proxmox.com References: <20261015125112.174954-1-f.ebner@proxmox.com> <20261015125112.174954-12-f.ebner@proxmox.com> Content-Language: en-US From: Fiona Ebner In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1792410569887 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.386 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: DACOG7PQFMIJGWVIBZGVYN6QITJJ7HMO X-Message-ID-Hash: DACOG7PQFMIJGWVIBZGVYN6QITJJ7HMO 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: Am 16.10.26 um 11:51 AM schrieb Daniel Kral: > On Thu Oct 15, 2026 at 2:50 PM CEST, Fiona Ebner wrote: >> 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, > > missing 'use PVE::Cluster' statement Good catch! >> + 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; >> +} > > Not a serious blocker at all, but since we use migrate_json_properties() > in Manager as well now and the return value won't change within one > runtime, this could be a static variable initialized at startup whose > reference is returned here, so we don't need to create a new hash for > every dependent HA resource type in queue_resource_motion() in the next > patch. Yes, that's nicer, will do!