From: "Dominik Rusovac" <d.rusovac@proxmox.com>
To: "Daniel Kral" <d.kral@proxmox.com>, <pve-devel@lists.proxmox.com>
Cc: Thomas Skinner <thomas@atskinner.net>
Subject: Re: [PATCH pve-manager v4 2/4] fix #6144: ui: ha: status: allow toggling maintenance mode
Date: Tue, 17 Nov 2026 12:02:15 +0100 [thread overview]
Message-ID: <DMXFOATI0RYT.3JYT34JP6294P@proxmox.com> (raw)
In-Reply-To: <DMXD8T4O2TS0.M2GXHXEB4GJB@proxmox.com>
thx for your review! will make the changes in v5
On Tue Nov 17, 2026 at 10:07 AM CET, Daniel Kral wrote:
> On Fri Nov 13, 2026 at 4:26 PM CET, Dominik Rusovac wrote:
>> maintenance mode could only be enabled or disabled through the HA
>> manager's CLI
>>
[snip]
>> diff --git a/www/manager6/ha/Status.js b/www/manager6/ha/Status.js
>> index c01bd737..c040c1b2 100644
>> --- a/www/manager6/ha/Status.js
>> +++ b/www/manager6/ha/Status.js
>> @@ -11,6 +11,17 @@ Ext.define('PVE.ha.Status', {
>> viewModel: {
>> data: {
>> haDisarmed: false,
>> + maintenanceNode: null,
>
> nit: 'selectedNode' describes the content a bit better; maybe even
> 'selectedLrmNode'
>
ack, will go with 'selectedLrmNode'
>> + maintenanceRequested: false,
>> + maintenancePending: false,
>
> These are also only true for the selectedLrmNode... But prefixing this
> would get rather long, so maybe just a comment, so it's clear?
true, will add a comment above the fields
>
>> + },
>> + formulas: {
>> + noMaintenanceAction: (get) =>
>> + !get('maintenanceNode') ||
>> + get('maintenancePending') ||
>> + !Ext.state.Manager.get('GuiCap').nodes['Sys.Modify'],
>
> AFAIK the formula will never update if the GuiCap changes, because
> formulas are only updated by get()'ing view model data...
>
> Though this is probably very minor, because the GuiCaps are only set
> roughly whenever the user logins. And if a user logs out and logs back
> in again in the same session, this component seems to be reloaded anyway
> and therefore the formula is reevaluated as well.
>
thx for the heads up
afaict this is consistent with the rest of the codebase, so I'd keep it
as is
>> + // the CRM ignores requests to enable maintenance mode while HA is disarmed
>> + noMaintenanceEnable: (get) => get('maintenanceRequested') || get('haDisarmed'),
>> },
>> },
>>
>> @@ -52,6 +63,67 @@ 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('maintenanceNode', isLrm ? rec.get('node') : null);
>> + vm.set('maintenanceRequested', isLrm && rec.get('maintenance-requested'));
>> + vm.set('maintenancePending', isLrm && sv.isMaintenancePending(rec.get('node')));
>> + },
>> +
>> + handleMaintenanceButton: function (menuItem) {
>
> AFAIK the handlers for tbar items have the signature
>
> function (menuItem, event, record) {}
>
> i.e., record would already contain the currently selected status grid
> item, which would then just need to be checked against whether it is an
> LRM.
>
> However, since these are already used to check whether the button should
> be disabled/enabled at all, it seems better to stick with the current
> solution.
ack, thx for the context, keeping it then
>
> Unfortunately, I didn't find the documentation (the tbar property is
> just documented as Object|Object[] in the ExtJS documentation ;-)), but
> we use it in some parts of our codebase.
>
>> + let me = this;
>> + let node = me.getViewModel().get('maintenanceNode');
>> + 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,
>> + );
>
> nit: could probably be factored out with another gettext parameter for
> maintenanceMode being either 'disable' or 'enable'.
>
the use of complete sentences for translatable strings is deliberate
here
>> + 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 {
>
> } else if (menuItem.maintenanceMode === 'enable') {
>
ack, thx
>> + 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 "Invalid maintenance mode '...'";
> }
>
> or something similar, so when another maintenance mode is added in the
> GUI this will be apparent on clicking it the first time.
>
ack, good point, thx
[snip]
>> diff --git a/www/manager6/ha/StatusView.js b/www/manager6/ha/StatusView.js
>> index f260bc0d..5e8f001e 100644
>> --- a/www/manager6/ha/StatusView.js
>> +++ b/www/manager6/ha/StatusView.js
>> @@ -23,6 +23,19 @@ Ext.define(
>> me.getView().refresh();
>> },
>>
>> + // maps node names to the expected value of their maintenance-requested field
>> + maintenancePending: null,
>
> This should already be initialized with {}
>
ack
[snip]
>>
>> me.rstore.on('load', function () {
>> + let maintenanceDone = false;
>
> nit: `maintenanceRequestAccepted` would be more accurate
>
not sure, but I agree that renaming makes sense
would go with `pendingCleared`
>> + for (const [node, requested] of Object.entries(me.maintenancePending)) {
>> + let rec = store.getById(`lrm:${node}`);
>> + if (!rec || rec.get('maintenance-requested') === requested) {
>> + delete me.maintenancePending[node];
>> + maintenanceDone = true;
>> + }
>> + }
>
> Found by automated review: the maintenancePending should also be removed
> if something hinders the maintenance request landing in the
> manager_status, e.g., LRM is already disarmed or offline.
>
> Even though the API handler can error and then take the error path,
> that's still racy because the disarm or offline node could just happen
> in the same exact HA Manager round... So this should be either handled
> additionally or check some other way whether the maintenance request is
> still pending.
>
I'm planning on making the HA status report for lrm entries whether
a maintenance request is still queued
will add a local pending state to the UI to cover the gap between status
polls, so it shows the spinner while the request is queued; also across
page reloads
[snip]
next prev parent reply other threads:[~2026-11-17 11:02 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 [this message]
2026-11-13 15:26 ` [PATCH pve-ha-manager v4 3/4] api: status: report node maintenance request for lrm entries Dominik Rusovac
2026-11-16 12:02 ` 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=DMXFOATI0RYT.3JYT34JP6294P@proxmox.com \
--to=d.rusovac@proxmox.com \
--cc=d.kral@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