[pve-devel] [RFC pve-ha-manager 2/8] Hardware: change online computation of node slightly

Thomas Lamprecht t.lamprecht at proxmox.com
Fri Dec 11 20:01:39 CET 2015


Mark a node offline if it's network or power are off.
This allows us to add states like restart where we want to be seen
as online (=quorate) until we are really killed by power off.
This is preparation work for adding a shutdown and restart power
action to the hardware.

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 src/PVE/HA/Sim/Hardware.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/PVE/HA/Sim/Hardware.pm b/src/PVE/HA/Sim/Hardware.pm
index 24ef68b..87b692e 100644
--- a/src/PVE/HA/Sim/Hardware.pm
+++ b/src/PVE/HA/Sim/Hardware.pm
@@ -342,7 +342,7 @@ my $compute_node_info = sub {
     foreach my $node (keys %$cstatus) {
 	my $d = $cstatus->{$node};
 
-	my $online = ($d->{power} eq 'on' && $d->{network} eq 'on') ? 1 : 0;
+	my $online = !($d->{power} eq 'off' || $d->{network} eq 'off') ? 1 : 0;
 	$node_info->{$node}->{online} = $online;
 
 	$node_count++;
-- 
2.1.4




More information about the pve-devel mailing list