public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Rusovac <d.rusovac@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH pve-ha-manager 2/3] manager: set service config value in self
Date: Mon, 11 May 2026 17:57:33 +0200	[thread overview]
Message-ID: <20260511155734.149101-3-d.rusovac@proxmox.com> (raw)
In-Reply-To: <20260511155734.149101-1-d.rusovac@proxmox.com>

This is in preparation for the follow-up patch.

Reading the value of 'auto-rebalance'-flag in the service config of an
HA resource is required to perform proper resource bundling.

Signed-off-by: Dominik Rusovac <d.rusovac@proxmox.com>
---
 src/PVE/HA/Manager.pm | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/PVE/HA/Manager.pm b/src/PVE/HA/Manager.pm
index b69a6bb..2a4b31e 100644
--- a/src/PVE/HA/Manager.pm
+++ b/src/PVE/HA/Manager.pm
@@ -1003,6 +1003,7 @@ sub manage {
     $self->try_persistent_group_migration();
 
     my ($sc, $services_digest) = $haenv->read_service_config();
+    $self->{sc} = $sc;
 
     $self->{groups} = $haenv->read_group_config(); # update
 
@@ -1011,9 +1012,9 @@ sub manage {
     # skip service add/remove when disarmed - handle_disarm manages service status
     if (!$ms->{disarm}) {
         # add new service
-        foreach my $sid (sort keys %$sc) {
+        foreach my $sid (sort keys $self->{sc}->%*) {
             next if $ss->{$sid}; # already there
-            my $cd = $sc->{$sid};
+            my $cd = $self->{sc}->{$sid};
             next if $cd->{state} eq 'ignored';
 
             $haenv->log('info', "adding new service '$sid' on node '$cd->{node}'");
@@ -1028,9 +1029,9 @@ sub manage {
 
         # remove stale or ignored services from manager state
         foreach my $sid (keys %$ss) {
-            next if $sc->{$sid} && $sc->{$sid}->{state} ne 'ignored';
+            next if $self->{sc}->{$sid} && $self->{sc}->{$sid}->{state} ne 'ignored';
 
-            my $reason = defined($sc->{$sid}) ? 'ignored state requested' : 'no config';
+            my $reason = defined($self->{sc}->{$sid}) ? 'ignored state requested' : 'no config';
             $haenv->log('info', "removing stale service '$sid' ($reason)");
 
             # remove all service related state information
@@ -1088,7 +1089,7 @@ sub manage {
         foreach my $sid (sort keys %$ss) {
             next if $deferred_sids && !$deferred_sids->{$sid};
             my $sd = $ss->{$sid};
-            my $cd = $sc->{$sid} || { state => 'disabled' };
+            my $cd = $self->{sc}->{$sid} || { state => 'disabled' };
 
             my $lrm_res = $sd->{uid} ? $lrm_results->{ $sd->{uid} } : undef;
 
-- 
2.47.3





  parent reply	other threads:[~2026-05-11 15:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-11 15:57 [PATCH-SERIES ha-manager/manager 0/3] fix #7557: introduce 'auto-rebalance' property Dominik Rusovac
2026-05-11 15:57 ` [PATCH pve-manager 1/3] ui: ha: add auto-rebalance flag Dominik Rusovac
2026-05-12  9:05   ` Daniel Kral
2026-05-11 15:57 ` Dominik Rusovac [this message]
2026-05-12  9:06   ` [PATCH pve-ha-manager 2/3] manager: set service config value in self Daniel Kral
2026-05-12 11:55     ` Dominik Rusovac
2026-05-11 15:57 ` [PATCH pve-ha-manager 3/3] fix #7557: introduce 'auto-rebalance' property Dominik Rusovac
2026-05-12  9:07   ` Daniel Kral
2026-05-12 11:51     ` Dominik Rusovac
2026-05-12  9:21 ` [PATCH-SERIES ha-manager/manager 0/3] " Daniel Kral
2026-05-12 11:53   ` Dominik Rusovac

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260511155734.149101-3-d.rusovac@proxmox.com \
    --to=d.rusovac@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal