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
Cc: Thomas Skinner <thomas@atskinner.net>
Subject: [PATCH pve-ha-manager v4 3/4] api: status: report node maintenance request for lrm entries
Date: Fri, 13 Nov 2026 16:26:19 +0100	[thread overview]
Message-ID: <20261113152620.2662417-4-d.rusovac@proxmox.com> (raw)
In-Reply-To: <20261113152620.2662417-1-d.rusovac@proxmox.com>

expose whether maintenance mode was manually requested for a node, as
recorded by the CRM

Originally-by: Thomas Skinner <thomas@atskinner.net>
Signed-off-by: Dominik Rusovac <d.rusovac@proxmox.com>
---

Notes:
    changes since v3:
    * reword commit subject and body
    * replace the lrm_mode field with maintenance-requested, which
      reflects the manual maintenance request recorded by the CRM
      instead of the mode the LRM reports, as the LRM might also go to
      maintenance with the 'migrate' shutdown policy without a manual
      request
    * drop 'unknown' values

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

diff --git a/src/PVE/API2/HA/Status.pm b/src/PVE/API2/HA/Status.pm
index aecef0f..2622ec1 100644
--- a/src/PVE/API2/HA/Status.pm
+++ b/src/PVE/API2/HA/Status.pm
@@ -107,6 +107,12 @@ __PACKAGE__->register_method({
                     type => "integer",
                     optional => 1,
                 },
+                'maintenance-requested' => {
+                    description => "For type 'lrm'. Whether maintenance mode was manually"
+                        . " requested for the node.",
+                    type => "boolean",
+                    optional => 1,
+                },
                 crm_state => {
                     description => "For type 'service'. Service state as seen by the CRM.",
                     type => "string",
@@ -265,6 +271,8 @@ __PACKAGE__->register_method({
                 PVE::HA::Tools::count_active_services($status->{service_status}, $node);
             my $lrm_status = PVE::HA::Config::read_lrm_status($node);
             my $id = "lrm:$node";
+            my $node_request = $status->{node_request} // {};
+            my $maintenance_requested = $node_request->{$node}->{maintenance} ? 1 : 0;
             if (!$lrm_status->{timestamp}) {
                 push @$res,
                     {
@@ -272,6 +280,7 @@ __PACKAGE__->register_method({
                         type => 'lrm',
                         node => $node,
                         status => "$node (unable to read lrm status)",
+                        'maintenance-requested' => $maintenance_requested,
                     };
             } else {
                 my $status_str = &$timestamp_to_status($ctime, $lrm_status->{timestamp});
@@ -315,6 +324,7 @@ __PACKAGE__->register_method({
                         node => $node,
                         status => $status_text,
                         timestamp => $lrm_status->{timestamp},
+                        'maintenance-requested' => $maintenance_requested,
                     };
             }
         }
-- 
2.47.3





  parent reply	other threads:[~2026-11-13 15:26 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13 15:26 [PATCH-SERIES docs/ha-manager/manager v4 0/4] fix #6144: add api and ui for node maintenance mode Dominik Rusovac
2026-11-13 15:26 ` [PATCH pve-manager v4 1/4] api: nodes: add endpoint to set " Dominik Rusovac
2026-11-16 11:57   ` Daniel Kral
2026-11-17  8:58     ` Dominik Rusovac
2026-11-17  9:21       ` Daniel Kral
2026-11-17  9:40         ` Dominik Rusovac
2026-11-13 15:26 ` [PATCH pve-manager v4 2/4] fix #6144: ui: ha: status: allow toggling " Dominik Rusovac
2026-11-17  9:07   ` Daniel Kral
2026-11-17 11:02     ` Dominik Rusovac
2026-11-13 15:26 ` Dominik Rusovac [this message]
2026-11-16 12:02   ` [PATCH pve-ha-manager v4 3/4] api: status: report node maintenance request for lrm entries Daniel Kral
2026-11-13 15:26 ` [PATCH pve-docs v4 4/4] ha-manager: maintenance mode: mention web ui menu Dominik Rusovac
2026-11-19 10:05 ` [PATCH-SERIES docs/ha-manager/manager v4 0/4] fix #6144: add api and ui for node maintenance mode 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=20261113152620.2662417-4-d.rusovac@proxmox.com \
    --to=d.rusovac@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    --cc=thomas@atskinner.net \
    /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