From: Thomas Skinner <thomas@atskinner.net>
To: pve-devel@lists.proxmox.com
Cc: Thomas Skinner <thomas@atskinner.net>
Subject: [pve-devel] [PATCH manager v2 1/2] add api setter for node maintenance mode
Date: Sat, 20 Sep 2025 13:20:48 -0500 [thread overview]
Message-ID: <20250920182050.1657928-3-thomas@atskinner.net> (raw)
In-Reply-To: <20250920182050.1657928-1-thomas@atskinner.net>
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']],
+ },
+ parameters => {
+ additionalProperties => 0,
+ properties => {
+ node => get_standard_option('pve-node'),
+ 'maintenance-mode' => {
+ description => "Enables or disabled maintenance mode for the HA LRM.",
+ 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;
+ },
+});
+
# bash completion helper
sub complete_templet_repo {
--
2.47.2
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next prev parent reply other threads:[~2025-09-20 18:27 UTC|newest]
Thread overview: 5+ 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 ` Thomas Skinner [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
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=20250920182050.1657928-3-thomas@atskinner.net \
--to=thomas@atskinner.net \
--cc=pve-devel@lists.proxmox.com \
/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