From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 99C141FF17E for ; Thu, 2 Oct 2025 13:47:14 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 328CFDC8D; Thu, 2 Oct 2025 13:47:22 +0200 (CEST) Mime-Version: 1.0 Date: Thu, 02 Oct 2025 13:47:19 +0200 Message-Id: To: "Proxmox VE development discussion" From: "Daniel Kral" X-Mailer: aerc 0.20.0 References: <20250920182050.1657928-1-thomas@atskinner.net> <20250920182050.1657928-3-thomas@atskinner.net> In-Reply-To: <20250920182050.1657928-3-thomas@atskinner.net> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1759405616189 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.015 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: Re: [pve-devel] [PATCH manager v2 1/2] add api setter for node maintenance mode X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Cc: pve-devel , Thomas Skinner Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" 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 > --- > 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