From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 692771FF183 for ; Wed, 30 Jul 2025 20:01:43 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id F0FFC17504; Wed, 30 Jul 2025 20:00:46 +0200 (CEST) From: Daniel Kral To: pve-devel@lists.proxmox.com Date: Wed, 30 Jul 2025 19:59:48 +0200 Message-ID: <20250730175957.386674-22-d.kral@proxmox.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250730175957.386674-1-d.kral@proxmox.com> References: <20250730175957.386674-1-d.kral@proxmox.com> MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1753898389521 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.014 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [RFC ha-manager v5 21/23] api: resources: exclude group property in reading endpoints if migrated X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" The group property is removed during the HA groups migration, but if there is any reason that it still is in the file, exclude it from output as soon as the HA groups have been fully migrated. Signed-off-by: Daniel Kral --- should we die here? src/PVE/API2/HA/Resources.pm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/PVE/API2/HA/Resources.pm b/src/PVE/API2/HA/Resources.pm index 26ef9e33..cdd62ec9 100644 --- a/src/PVE/API2/HA/Resources.pm +++ b/src/PVE/API2/HA/Resources.pm @@ -22,13 +22,14 @@ use base qw(PVE::RESTHandler); my $resource_type_enum = PVE::HA::Resources->lookup_types(); my $api_copy_config = sub { - my ($cfg, $sid) = @_; + my ($cfg, $sid, $exclude_group_property) = @_; die "no such resource '$sid'\n" if !$cfg->{ids}->{$sid}; my $scfg = dclone($cfg->{ids}->{$sid}); $scfg->{sid} = $sid; $scfg->{digest} = $cfg->{digest}; + delete $scfg->{group} if $exclude_group_property; return $scfg; }; @@ -77,10 +78,11 @@ __PACKAGE__->register_method({ my $cfg = PVE::HA::Config::read_resources_config(); my $groups = PVE::HA::Config::read_group_config(); + my $exclude_group_property = PVE::HA::Config::have_groups_been_migrated($groups); my $res = []; foreach my $sid (keys %{ $cfg->{ids} }) { - my $scfg = &$api_copy_config($cfg, $sid); + my $scfg = &$api_copy_config($cfg, $sid, $exclude_group_property); next if $param->{type} && $param->{type} ne $scfg->{type}; if ($scfg->{group} && !$groups->{ids}->{ $scfg->{group} }) { $scfg->{errors}->{group} = "group '$scfg->{group}' does not exist"; @@ -160,10 +162,11 @@ __PACKAGE__->register_method({ my ($param) = @_; my $cfg = PVE::HA::Config::read_resources_config(); + my $exclude_group_property = PVE::HA::Config::have_groups_been_migrated(); my $sid = PVE::HA::Config::parse_sid($param->{sid}); - return &$api_copy_config($cfg, $sid); + return &$api_copy_config($cfg, $sid, $exclude_group_property); }, }); -- 2.47.2 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel