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 28BC61FF0B7 for ; Fri, 16 Oct 2026 11:51:32 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 968EA214CA; Fri, 16 Oct 2026 11:51:28 +0200 (CEST) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Fri, 16 Oct 2026 11:51:22 +0200 Message-Id: Subject: Re: [PATCH ha-manager v4 11/27] resources: add migrate_json_properties() method From: "Daniel Kral" To: "Fiona Ebner" , X-Mailer: aerc 0.22.0-10-g6373ac9d2179-dirty References: <20261015125112.174954-1-f.ebner@proxmox.com> <20261015125112.174954-12-f.ebner@proxmox.com> In-Reply-To: <20261015125112.174954-12-f.ebner@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1792144282270 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.782 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: 6GMKJQRPHPAXKSOKMZNCLWOMBE5XCEWG X-Message-ID-Hash: 6GMKJQRPHPAXKSOKMZNCLWOMBE5XCEWG X-MailFrom: d.kral@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: 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 > }, > }; > =20 > +our $common_migrate_json_properties =3D { > + sid =3D> get_standard_option( > + 'pve-ha-resource-or-vm-id', > + { completion =3D> \&PVE::HA::Tools::complete_sid }, > + ), > + node =3D> get_standard_option( > + 'pve-node', > + { > + completion =3D> \&PVE::Cluster::complete_migration_target, missing 'use PVE::Cluster' statement > + description =3D> "Target node.", > + }, > + ), > +}; > + > sub verify_name { > my ($class, $name) =3D @_; > =20 > @@ -159,6 +173,12 @@ sub migrate { > die "implement in subclass"; > } > =20 > +sub migrate_json_properties { > + my ($class) =3D @_; > + > + die "implement in subclass"; > +} > + > sub config_file { > my ($class, $id, $nodename) =3D @_; > =20 > diff --git a/src/PVE/HA/Resources/PVECT.pm b/src/PVE/HA/Resources/PVECT.p= m > 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 { > }; > } > =20 > +# 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 depende= ncies.. > +sub migrate_json_properties { > + my ($class) =3D @_; > + my $combined =3D { $PVE::HA::Resources::common_migrate_json_properti= es->%* }; > + my $extra_migrate_props =3D eval { PVE::API2::LXC::ha_migrate_json_p= roperties() } // {}; > + die $@ if $@ && !$ENV{PVE_GENERATING_DOCS}; > + $combined->{$_} =3D $extra_migrate_props->{$_} for keys $extra_migra= te_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. > + > 1; > diff --git a/src/PVE/HA/Resources/PVEVM.pm b/src/PVE/HA/Resources/PVEVM.p= m > 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 { > }; > } > =20 > +# 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 depende= ncies.. > +sub migrate_json_properties { > + my ($class) =3D @_; > + my $combined =3D { $PVE::HA::Resources::common_migrate_json_properti= es->%* }; > + my $extra_migrate_props =3D eval { PVE::API2::Qemu::ha_migrate_json_= properties() } // {}; > + die $@ if $@ && !$ENV{PVE_GENERATING_DOCS}; > + $combined->{$_} =3D $extra_migrate_props->{$_} for keys $extra_migra= te_props->%*; > + return $combined; > +} Same here > + > 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; > } > =20 > +sub migrate_json_properties { > + my ($class) =3D @_; > + > + return $PVE::HA::Resources::common_migrate_json_properties; > +} > + > sub remove_locks { > my ($self, $haenv, $id, $locks, $service_node) =3D @_; > =20