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 2EE681FF0DF for ; Thu, 19 Nov 2026 10:59:58 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id BB14B21715; Thu, 19 Nov 2026 10:59:41 +0100 (CET) From: Dominik Rusovac 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 Message-ID: <20261119095931.1748970-4-d.rusovac@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261119095931.1748970-1-d.rusovac@proxmox.com> References: <20261119095931.1748970-1-d.rusovac@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1795082375177 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.030 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: BLYKF7TLQS6HW7ZVZOAPHROMXDLSQ3GN X-Message-ID-Hash: BLYKF7TLQS6HW7ZVZOAPHROMXDLSQ3GN X-MailFrom: d.rusovac@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: 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 --- 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 + ' '; } return value; @@ -136,6 +171,10 @@ Ext.define( name: 'maintenance-requested', type: 'boolean', }, + { + name: 'maintenance-request-queued', + type: 'boolean', + }, ], idProperty: 'id', }); -- 2.47.3