all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Rusovac <d.rusovac@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH pve-manager v5 03/10] ui: ha: status: show spinner while maintenance mode request is queued
Date: Thu, 19 Nov 2026 10:59:24 +0100	[thread overview]
Message-ID: <20261119095931.1748970-4-d.rusovac@proxmox.com> (raw)
In-Reply-To: <20261119095931.1748970-1-d.rusovac@proxmox.com>

the CRM only processes a node maintenance request on its next round, so
until then, there is no feedback whether the request is still being
processed, and the menu still offers the same action again

show a spinner on the lrm entry of the node and keep the menu disabled
for it while the request is queued, like it is done when disarming HA.
this also ends the spinner if the CRM ignores the request, e.g. if the
node went offline in the meantime

as the request might not be reported as queued by a status load that was
already running, the node is also considered pending from the successful
request until a status load that started afterwards

Signed-off-by: Dominik Rusovac <d.rusovac@proxmox.com>
---

Notes:
    new in v5, changes w.r.t. v4:
    * show the spinner while the request is queued for the CRM, so that
      it also ends if the CRM ignores the request, as pointed out in the
      v4 review
    * only initialize the per-node pending state in initComponent

 www/manager6/ha/Status.js     | 11 +++++++++-
 www/manager6/ha/StatusView.js | 41 ++++++++++++++++++++++++++++++++++-
 2 files changed, 50 insertions(+), 2 deletions(-)

diff --git a/www/manager6/ha/Status.js b/www/manager6/ha/Status.js
index 42e9aefb..44f95d61 100644
--- a/www/manager6/ha/Status.js
+++ b/www/manager6/ha/Status.js
@@ -14,10 +14,13 @@ Ext.define('PVE.ha.Status', {
             selectedLrmNode: null,
             // maintenance state of the selected LRM node
             maintenanceRequested: false,
+            maintenancePending: false,
         },
         formulas: {
             noMaintenanceAction: (get) =>
-                !get('selectedLrmNode') || !Ext.state.Manager.get('GuiCap').nodes['Sys.Modify'],
+                !get('selectedLrmNode') ||
+                get('maintenancePending') ||
+                !Ext.state.Manager.get('GuiCap').nodes['Sys.Modify'],
             // the CRM ignores requests to enable maintenance mode while HA is disarmed
             noMaintenanceEnable: (get) => get('maintenanceRequested') || get('haDisarmed'),
         },
@@ -70,6 +73,7 @@ Ext.define('PVE.ha.Status', {
 
             vm.set('selectedLrmNode', isLrm ? rec.get('node') : null);
             vm.set('maintenanceRequested', isLrm && rec.get('maintenance-requested'));
+            vm.set('maintenancePending', isLrm && sv.isMaintenancePending(rec));
         },
 
         handleMaintenanceButton: function (menuItem) {
@@ -115,6 +119,11 @@ Ext.define('PVE.ha.Status', {
                     url: `/nodes/${node}/maintenance`,
                     params: { 'maintenance-mode': menuItem.maintenanceMode },
                     method: 'PUT',
+                    success: function () {
+                        let sv = me.getView().down('pveHAStatusView');
+                        sv.setMaintenancePending(node);
+                        me.updateMaintenanceState();
+                    },
                     failure: (response) => Ext.Msg.alert(gettext('Error'), response.htmlStatus),
                 });
             });
diff --git a/www/manager6/ha/StatusView.js b/www/manager6/ha/StatusView.js
index d08534b4..cf8677e4 100644
--- a/www/manager6/ha/StatusView.js
+++ b/www/manager6/ha/StatusView.js
@@ -23,6 +23,19 @@ Ext.define(
             me.getView().refresh();
         },
 
+        setMaintenancePending: function (node) {
+            let me = this;
+            me.maintenanceRequestTime[node] = Date.now();
+            me.getView().refresh();
+        },
+
+        isMaintenancePending: function (rec) {
+            return (
+                rec.get('maintenance-request-queued') ||
+                this.maintenanceRequestTime[rec.get('node')] !== undefined
+            );
+        },
+
         initComponent: function () {
             var me = this;
 
@@ -30,6 +43,10 @@ Ext.define(
                 throw 'no rstore given';
             }
 
+            // maps node names to the time of their last maintenance request, until a status load
+            // that started afterwards reports whether the request is still queued for the CRM
+            me.maintenanceRequestTime = {};
+
             Proxmox.Utils.monStoreErrors(me, me.rstore);
 
             var store = Ext.create('Proxmox.data.DiffStore', {
@@ -51,7 +68,22 @@ Ext.define(
                 },
             });
 
+            me.rstore.on('beforeload', () => {
+                me.lastLoadStart = Date.now();
+            });
+
             me.rstore.on('load', function () {
+                let pendingCleared = false;
+                for (const [node, requestTime] of Object.entries(me.maintenanceRequestTime)) {
+                    if (requestTime < me.lastLoadStart) {
+                        delete me.maintenanceRequestTime[node];
+                        pendingCleared = true;
+                    }
+                }
+                if (pendingCleared) {
+                    me.getView().refresh();
+                }
+
                 let fencing = store.findRecord('type', 'fencing');
                 let disarmed = fencing && fencing.get('armed-state') === 'disarmed';
 
@@ -76,7 +108,10 @@ Ext.define(
                         flex: 1,
                         dataIndex: 'status',
                         renderer: function (value, _metaData, rec) {
-                            if (rec.data.type === 'fencing' && me.pending) {
+                            if (
+                                (rec.data.type === 'fencing' && me.pending) ||
+                                (rec.data.type === 'lrm' && me.isMaintenancePending(rec))
+                            ) {
                                 return value + ' <i class="fa fa-spinner fa-spin"></i>';
                             }
                             return value;
@@ -136,6 +171,10 @@ Ext.define(
                     name: 'maintenance-requested',
                     type: 'boolean',
                 },
+                {
+                    name: 'maintenance-request-queued',
+                    type: 'boolean',
+                },
             ],
             idProperty: 'id',
         });
-- 
2.47.3





  parent reply	other threads:[~2026-11-19  9:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19  9:59 [PATCH-SERIES docs/ha-manager/manager v5 00/10] fix #6144: add api and ui for node maintenance mode Dominik Rusovac
2026-11-19  9:59 ` [PATCH pve-manager v5 01/10] fix #6144: api: nodes: add endpoint to set " Dominik Rusovac
2026-11-19  9:59 ` [PATCH pve-manager v5 02/10] fix #6144: ui: ha: status: allow toggling " Dominik Rusovac
2026-11-19  9:59 ` Dominik Rusovac [this message]
2026-11-19  9:59 ` [PATCH pve-ha-manager v5 04/10] test: add test for ignoring maintenance mode request Dominik Rusovac
2026-11-19  9:59 ` [PATCH pve-ha-manager v5 05/10] manager: standardize log messages for " Dominik Rusovac
2026-11-19  9:59 ` [PATCH pve-ha-manager v5 06/10] manager: factor out check " Dominik Rusovac
2026-11-19  9:59 ` [PATCH pve-ha-manager v5 07/10] cli: reject maintenance mode requests rejected by crm Dominik Rusovac
2026-11-19  9:59 ` [PATCH pve-ha-manager v5 08/10] api: status: report maintenance mode request for lrm entries Dominik Rusovac
2026-11-19  9:59 ` [PATCH pve-ha-manager v5 09/10] api: status: report queued " Dominik Rusovac
2026-11-19  9:59 ` [PATCH pve-docs v5 10/10] ha-manager: maintenance mode: mention web ui menu Dominik Rusovac
2026-11-19 22:28 ` applied: [PATCH-SERIES docs/ha-manager/manager v5 00/10] fix #6144: add api and ui for node maintenance mode Thomas Lamprecht

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=20261119095931.1748970-4-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal