From: Daniel Kral <d.kral@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH ha-manager 1/1] nodestate: do not write unknown node status in get_node_state
Date: Thu, 22 Jan 2026 10:19:35 +0100 [thread overview]
Message-ID: <20260122092240.118099-2-d.kral@proxmox.com> (raw)
In-Reply-To: <20260122092240.118099-1-d.kral@proxmox.com>
PVE::HA::NodeStatus->get_node_state($node) and its proxies are accessed
by many call sites with untrusted input data, e.g., migrate/relocate crm
commands, node maintenance commands, etc.
For example, if node 'node19' does not exist, and a user issues the
migrate command, 'node19' will be written to the node state and will
stay there until it is removed as a gone node (after ~60 min):
$ ha-manager migrate vm:100 node19
$ ha-manager status
unable to read file '/etc/pve/nodes/node19/lrm_status'
quorum OK
[...]
lrm node19 (unable to read lrm status)
[...]
As the transition between unknown/gone and other node states are already
handled by PVE::HA::NodeStatus->update(...), remove this side effect
from get_node_state(...).
Signed-off-by: Daniel Kral <d.kral@proxmox.com>
---
src/PVE/HA/NodeStatus.pm | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/src/PVE/HA/NodeStatus.pm b/src/PVE/HA/NodeStatus.pm
index e5dddf3b..381be7d0 100644
--- a/src/PVE/HA/NodeStatus.pm
+++ b/src/PVE/HA/NodeStatus.pm
@@ -33,10 +33,7 @@ my $valid_node_states = {
sub get_node_state {
my ($self, $node) = @_;
- $self->{status}->{$node} = 'unknown'
- if !$self->{status}->{$node};
-
- return $self->{status}->{$node};
+ return $self->{status}->{$node} // 'unknown';
}
sub node_is_operational {
--
2.47.3
_______________________________________________
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:[~2026-01-22 9:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-22 9:19 [pve-devel] [PATCH ha-manager 0/1] prevent adding possibly non-existent nodes Daniel Kral
2026-01-22 9:19 ` Daniel Kral [this message]
2026-01-22 10:25 ` [pve-devel] applied: " Fiona Ebner
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=20260122092240.118099-2-d.kral@proxmox.com \
--to=d.kral@proxmox.com \
--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 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.