From: Dominik Rusovac <d.rusovac@proxmox.com>
To: pve-devel@lists.proxmox.com
Cc: Thomas Skinner <thomas@atskinner.net>
Subject: [PATCH pve-manager v5 02/10] fix #6144: ui: ha: status: allow toggling maintenance mode
Date: Thu, 19 Nov 2026 10:59:23 +0100 [thread overview]
Message-ID: <20261119095931.1748970-3-d.rusovac@proxmox.com> (raw)
In-Reply-To: <20261119095931.1748970-1-d.rusovac@proxmox.com>
maintenance mode could only be enabled or disabled through the HA
manager's CLI
add a 'Node Maintenance' menu to the HA status panel, which requests
enabling/disabling maintenance mode for the node of the selected lrm
entry
enabling is not offered while HA is disarmed, as the CRM ignores such
requests in that state. menu is disabled for users lacking the
Sys.Modify privilege on nodes
the LRM also enters maintenance mode on shutdown with the 'migrate'
shutdown policy, which a disable request would not undo
'fa fa-check' icon was chosen for 'Disable' option to be consistent
with which icon a node gets when coming back from maintenance mode
Originally-by: Thomas Skinner <thomas@atskinner.net>
Signed-off-by: Dominik Rusovac <d.rusovac@proxmox.com>
---
Notes:
changes since v4:
* rename maintenanceNode to selectedLrmNode and comment which node
the other maintenance field of the view model refers to
* throw on unknown maintenance modes instead of defaulting to enable
* split out the spinner into a separate patch
* reword commit body accordingly
www/manager6/ha/Status.js | 98 +++++++++++++++++++++++++++++++++++
www/manager6/ha/StatusView.js | 4 ++
2 files changed, 102 insertions(+)
diff --git a/www/manager6/ha/Status.js b/www/manager6/ha/Status.js
index c01bd737..42e9aefb 100644
--- a/www/manager6/ha/Status.js
+++ b/www/manager6/ha/Status.js
@@ -11,6 +11,15 @@ Ext.define('PVE.ha.Status', {
viewModel: {
data: {
haDisarmed: false,
+ selectedLrmNode: null,
+ // maintenance state of the selected LRM node
+ maintenanceRequested: false,
+ },
+ formulas: {
+ noMaintenanceAction: (get) =>
+ !get('selectedLrmNode') || !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'),
},
},
@@ -52,6 +61,65 @@ Ext.define('PVE.ha.Status', {
);
},
+ updateMaintenanceState: function () {
+ let me = this;
+ let vm = me.getViewModel();
+ let sv = me.getView().down('pveHAStatusView');
+ let rec = sv.getSelection()[0];
+ let isLrm = rec?.get('type') === 'lrm';
+
+ vm.set('selectedLrmNode', isLrm ? rec.get('node') : null);
+ vm.set('maintenanceRequested', isLrm && rec.get('maintenance-requested'));
+ },
+
+ handleMaintenanceButton: function (menuItem) {
+ let me = this;
+ let node = me.getViewModel().get('selectedLrmNode');
+ if (!node) {
+ return;
+ }
+
+ let msg;
+ if (menuItem.maintenanceMode === 'disable') {
+ msg = Ext.String.format(
+ gettext("Are you sure you want to disable maintenance mode for node '{0}'?"),
+ node,
+ );
+ if (me.getViewModel().get('haDisarmed')) {
+ msg +=
+ '<br><br>' +
+ Ext.String.format(
+ gettext(
+ "HA resources will be migrated back to node '{0}' once HA is re-armed.",
+ ),
+ node,
+ );
+ }
+ } else if (menuItem.maintenanceMode === 'enable') {
+ msg = Ext.String.format(
+ gettext("Are you sure you want to enable maintenance mode for node '{0}'?"),
+ node,
+ );
+ msg +=
+ '<br><br>' +
+ gettext('HA resources on the node will be migrated to other nodes.');
+ } else {
+ throw `unknown maintenance mode '${menuItem.maintenanceMode}'`;
+ }
+
+ Ext.Msg.confirm(gettext('Confirm'), msg, function (btn) {
+ if (btn !== 'yes') {
+ return;
+ }
+ Proxmox.Utils.API2Request({
+ url: `/nodes/${node}/maintenance`,
+ params: { 'maintenance-mode': menuItem.maintenanceMode },
+ method: 'PUT',
+ failure: (response) => Ext.Msg.alert(gettext('Error'), response.htmlStatus),
+ });
+ });
+ },
+
openCRSOptions: function () {
Ext.create('PVE.form.CRSOptions', {
autoShow: true,
@@ -121,6 +189,34 @@ Ext.define('PVE.ha.Status', {
},
],
},
+ '-',
+ {
+ text: gettext('Node Maintenance'),
+ iconCls: 'fa fa-wrench',
+ bind: {
+ disabled: '{noMaintenanceAction}',
+ },
+ menu: [
+ {
+ text: gettext('Enable'),
+ iconCls: 'fa fa-wrench',
+ maintenanceMode: 'enable',
+ bind: {
+ disabled: '{noMaintenanceEnable}',
+ },
+ handler: 'handleMaintenanceButton',
+ },
+ {
+ text: gettext('Disable'),
+ iconCls: 'fa fa-check',
+ maintenanceMode: 'disable',
+ bind: {
+ disabled: '{!maintenanceRequested}',
+ },
+ handler: 'handleMaintenanceButton',
+ },
+ ],
+ },
'->',
{
text: gettext('CRS Settings'),
@@ -153,11 +249,13 @@ Ext.define('PVE.ha.Status', {
collapsible: true,
padding: '0 0 20 0',
listeners: {
+ selectionchange: () => me.getController().updateMaintenanceState(),
hastatuschange: function (isDisarmed) {
let vm = me.getViewModel();
let sv = me.query('pveHAStatusView')[0];
vm.set('haDisarmed', isDisarmed);
+ me.getController().updateMaintenanceState();
if (sv.isDisarmedPendingState === null) {
return;
diff --git a/www/manager6/ha/StatusView.js b/www/manager6/ha/StatusView.js
index f260bc0d..d08534b4 100644
--- a/www/manager6/ha/StatusView.js
+++ b/www/manager6/ha/StatusView.js
@@ -132,6 +132,10 @@ Ext.define(
},
},
'armed-state',
+ {
+ name: 'maintenance-requested',
+ type: 'boolean',
+ },
],
idProperty: 'id',
});
--
2.47.3
next prev 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 ` Dominik Rusovac [this message]
2026-11-19 9:59 ` [PATCH pve-manager v5 03/10] ui: ha: status: show spinner while maintenance mode request is queued Dominik Rusovac
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-3-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 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.