public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH ha-manager 0/1] prevent adding possibly non-existent nodes
@ 2026-01-22  9:19 Daniel Kral
  2026-01-22  9:19 ` [pve-devel] [PATCH ha-manager 1/1] nodestate: do not write unknown node status in get_node_state Daniel Kral
  2026-01-22 10:25 ` [pve-devel] applied: [PATCH ha-manager 0/1] prevent adding possibly non-existent nodes Fiona Ebner
  0 siblings, 2 replies; 3+ messages in thread
From: Daniel Kral @ 2026-01-22  9:19 UTC (permalink / raw)
  To: pve-devel

A small patch that removes the possibility to add possibly non-existent
nodes through get_node_state(...), node_is_online(...),
node_is_operational(...) and node_is_offline_delayed(...), which makes
the output of list_nodes() incorrect.

Most call sites will output an "node is not online" error to the
relevant log, but there is no output to the user, which is a possible
improvement for another patch series.


Daniel Kral (1):
  nodestate: do not write unknown node status in get_node_state

 src/PVE/HA/NodeStatus.pm | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

-- 
2.47.3



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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [pve-devel] [PATCH ha-manager 1/1] nodestate: do not write unknown node status in get_node_state
  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
  2026-01-22 10:25 ` [pve-devel] applied: [PATCH ha-manager 0/1] prevent adding possibly non-existent nodes Fiona Ebner
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Kral @ 2026-01-22  9:19 UTC (permalink / raw)
  To: pve-devel

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [pve-devel] applied: [PATCH ha-manager 0/1] prevent adding possibly non-existent nodes
  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 ` [pve-devel] [PATCH ha-manager 1/1] nodestate: do not write unknown node status in get_node_state Daniel Kral
@ 2026-01-22 10:25 ` Fiona Ebner
  1 sibling, 0 replies; 3+ messages in thread
From: Fiona Ebner @ 2026-01-22 10:25 UTC (permalink / raw)
  To: pve-devel, Daniel Kral

On Thu, 22 Jan 2026 10:19:34 +0100, Daniel Kral wrote:
> A small patch that removes the possibility to add possibly non-existent
> nodes through get_node_state(...), node_is_online(...),
> node_is_operational(...) and node_is_offline_delayed(...), which makes
> the output of list_nodes() incorrect.
> 
> Most call sites will output an "node is not online" error to the
> relevant log, but there is no output to the user, which is a possible
> improvement for another patch series.
> 
> [...]

Applied, thanks!

[1/1] nodestate: do not write unknown node status in get_node_state
      commit: 08c7f0b5863063bf2ee6cab154651be77a2c5aa7


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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-01-22 10:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [pve-devel] [PATCH ha-manager 1/1] nodestate: do not write unknown node status in get_node_state Daniel Kral
2026-01-22 10:25 ` [pve-devel] applied: [PATCH ha-manager 0/1] prevent adding possibly non-existent nodes Fiona Ebner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal