all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: "Daniel Kral" <d.kral@proxmox.com>
To: "Proxmox VE development discussion" <pve-devel@lists.proxmox.com>
Cc: pve-devel <pve-devel-bounces@lists.proxmox.com>,
	Thomas Skinner <thomas@atskinner.net>
Subject: Re: [pve-devel] [PATCH manager v2 1/2] add api setter for node maintenance mode
Date: Thu, 02 Oct 2025 13:47:19 +0200	[thread overview]
Message-ID: <DD7T8WKGMJ37.2MH4E5COM8VXB@proxmox.com> (raw)
In-Reply-To: <20250920182050.1657928-3-thomas@atskinner.net>

Only two small notes inline, otherwise looks good to me, also if we
support putting the node itself in maintenance or need other maintenance
mode than just enabling/disabling them.

On Sat Sep 20, 2025 at 8:20 PM CEST, Thomas Skinner wrote:
> Signed-off-by: Thomas Skinner <thomas@atskinner.net>
> ---
>  PVE/API2/Nodes.pm | 38 ++++++++++++++++++++++++++++++++++++++
>  1 file changed, 38 insertions(+)
>
> diff --git a/PVE/API2/Nodes.pm b/PVE/API2/Nodes.pm
> index 48898045..3f31ac6c 100644
> --- a/PVE/API2/Nodes.pm
> +++ b/PVE/API2/Nodes.pm
> @@ -275,6 +275,7 @@ __PACKAGE__->register_method({
>              { name => 'hosts' },
>              { name => 'journal' },
>              { name => 'lxc' },
> +            { name => 'maintenance' },
>              { name => 'migrateall' },
>              { name => 'netstat' },
>              { name => 'network' },
> @@ -2663,6 +2664,43 @@ __PACKAGE__->register_method({
>      },
>  });
>  
> +__PACKAGE__->register_method({
> +    name => 'maintenance_set',
> +    protected => 1,
> +    path => 'maintenance',
> +    method => 'PUT',
> +    description =>
> +        "Set the maintenance parameters for the node. Currently only supports HA maintenance mode for the LRM on a node.",
> +    permissions => {
> +        check => ['perm', '/', ['Sys.Console']],

Hm, if we align that API endpoint to the PBS datastore's one (where
there is also a enumerated maintenande mode), then this should probably
be

        check => ['perm', '/nodes/{node}', ['Sys.Modify']],

There's also 'Sys.PowerMgmt', but I don't really see this as a power
management-related thing.

> +    },
> +    parameters => {
> +        additionalProperties => 0,
> +        properties => {
> +            node => get_standard_option('pve-node'),
> +            'maintenance-mode' => {
> +                description => "Enables or disabled maintenance mode for the HA LRM.",

nit: s/disabled/disables/

> +                type => 'string',
> +                enum => ['enable', 'disable'],
> +            },
> +        },
> +    },
> +    returns => { type => 'null' },
> +    code => sub {
> +        my ($param) = @_;
> +
> +        PVE::Cluster::check_node_exists($param->{node});
> +
> +        my $cmd =
> +            $param->{'maintenance-mode'} eq 'enable'
> +            ? 'enable-node-maintenance'
> +            : 'disable-node-maintenance';
> +        PVE::HA::Config::queue_crm_commands("$cmd $param->{node}");
> +
> +        return undef;
> +    },
> +});
> +


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


  reply	other threads:[~2025-10-02 11:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-20 18:20 [pve-devel] [PATCH SERIES docs/ha-manager/manager v2] close #6144: add ui button + api " Thomas Skinner
2025-09-20 18:20 ` [pve-devel] [PATCH ha-manager v2 1/1] add additional api field for lrm_mode in status check Thomas Skinner
2025-09-20 18:20 ` [pve-devel] [PATCH manager v2 1/2] add api setter for node maintenance mode Thomas Skinner
2025-10-02 11:47   ` Daniel Kral [this message]
2025-09-20 18:20 ` [pve-devel] [PATCH docs v2 1/1] add docs for maintenance mode buttons in UI Thomas Skinner
2025-09-20 18:20 ` [pve-devel] [PATCH manager v2 2/2] add UI for node maintenance enable/disable Thomas Skinner
2025-10-02 11:53 ` [pve-devel] [PATCH SERIES docs/ha-manager/manager v2] close #6144: add ui button + api for node maintenance mode Daniel Kral

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=DD7T8WKGMJ37.2MH4E5COM8VXB@proxmox.com \
    --to=d.kral@proxmox.com \
    --cc=pve-devel-bounces@lists.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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal