[pve-devel] [RFC ha-manager v5 22/23] api: resources: disallow group prop in modifying endpoints if migrated

Daniel Kral d.kral at proxmox.com
Wed Jul 30 19:59:49 CEST 2025


Disallow creating or updating HA resources through the HA resource API
as soon as the HA groups have been fully migrated (i.e. no entries or
deleted), because HA groups are deprecated and new users are pushed to
not use them anymore.

Signed-off-by: Daniel Kral <d.kral at proxmox.com>
---
should we die here?

 src/PVE/API2/HA/Resources.pm | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/PVE/API2/HA/Resources.pm b/src/PVE/API2/HA/Resources.pm
index cdd62ec9..05848f51 100644
--- a/src/PVE/API2/HA/Resources.pm
+++ b/src/PVE/API2/HA/Resources.pm
@@ -195,6 +195,9 @@ __PACKAGE__->register_method({
             die "types does not match\n" if $param_type ne $type;
         }
 
+        die "invalid parameter 'group': ha groups have been migrated to rules\n"
+            if defined($param->{group}) && PVE::HA::Config::have_groups_been_migrated();
+
         my $plugin = PVE::HA::Resources->lookup($type);
         $plugin->verify_name($name);
 
@@ -250,6 +253,9 @@ __PACKAGE__->register_method({
         if (my $group = $param->{group}) {
             my $group_cfg = PVE::HA::Config::read_group_config();
 
+            die "invalid parameter 'group': ha groups have been migrated to rules\n"
+                if PVE::HA::Config::have_groups_been_migrated($group_cfg);
+
             die "HA group '$group' does not exist\n"
                 if !$group_cfg->{ids}->{$group};
         }
-- 
2.47.2





More information about the pve-devel mailing list