From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 732AF1FF0C0 for ; Wed, 18 Nov 2026 15:27:00 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 48852217BE; Wed, 18 Nov 2026 15:26:15 +0100 (CET) From: Daniel Kral To: pve-devel@lists.proxmox.com Subject: [PATCH ha-manager v3 09/17] lrm: catch and report dies while the LRM is in maintenance state Date: Wed, 18 Nov 2026 15:25:48 +0100 Message-ID: <20261118142556.218589-10-d.kral@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261118142556.218589-1-d.kral@proxmox.com> References: <20261118142556.218589-1-d.kral@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1795011969617 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.534 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: AY65EKDMSUYMSPQ5YOQWL74XGZX6GLLW X-Message-ID-Hash: AY65EKDMSUYMSPQ5YOQWL74XGZX6GLLW 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: This is similar in scope to the eval block in the active work branch, where dies in watchdog releases, lock releases and manage_resources() are caught and logged instead of making the LRM itself exit because of these. Furthermore, this prevents the LRM from exiting if a transient manager_status read error in update_service_status() causes the whole LRM to shut down with the watchdog armed and its HA agent lock held. Best viewed with --ignore-all-space. Signed-off-by: Daniel Kral --- src/PVE/HA/LRM.pm | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/src/PVE/HA/LRM.pm b/src/PVE/HA/LRM.pm index 5ecd41cf..d09316dd 100644 --- a/src/PVE/HA/LRM.pm +++ b/src/PVE/HA/LRM.pm @@ -601,27 +601,35 @@ sub work { } elsif ($state eq 'maintenance') { my $startime = $haenv->get_time(); - return if !$self->update_service_status(); - - # wait until all active services moved away - my $service_count = $self->active_service_count(); my $exit_lrm = 0; - if ($service_count == 0 && $self->run_workers() == 0) { - # safety: going into maintenance and all active services got moved -> OK - give_up_watchdog_protection($self); + eval { + # if we could not get the current service status there's no point + # in doing anything, try again next round. + return if !$self->update_service_status(); - if ($self->{shutdown_request}) { - $exit_lrm = 1; + # wait until all active services moved away + my $service_count = $self->active_service_count(); + + if ($service_count == 0 && $self->run_workers() == 0) { + # safety: going into maintenance and all active services got moved -> OK + give_up_watchdog_protection($self); + + if ($self->{shutdown_request}) { + $exit_lrm = 1; + } + + # maintenance mode with no or only frozen services anymore, release the lock + $haenv->release_ha_agent_lock(); } - # maintenance mode with no or only frozen services anymore, release the lock - $haenv->release_ha_agent_lock(); + $self->manage_resources() if !$exit_lrm; + }; + if (my $err = $@) { + $haenv->log('err', "got unexpected error - $err"); } - $self->manage_resources() if !$exit_lrm; - $self->update_lrm_status(); return 0 if $exit_lrm; -- 2.47.3