diff --git a/src/PVE/HA/LRM.pm b/src/PVE/HA/LRM.pm index 97aa1e0..b3074d5 100644 --- a/src/PVE/HA/LRM.pm +++ b/src/PVE/HA/LRM.pm @@ -242,13 +242,11 @@ sub active_service_count { my ($self) = @_; my $haenv = $self->{haenv}; - my $nodename = $haenv->nodename(); my $ss = $self->{service_status}; my $count = 0; - foreach my $sid (keys %$ss) { my $sd = $ss->{$sid}; next if !$sd->{node}; @@ -256,6 +254,7 @@ sub active_service_count { my $req_state = $sd->{state}; next if !defined($req_state); next if $req_state eq 'stopped'; + # NOTE: 'ignored' ones are already dropped by the manager from service_status next if $req_state eq 'freeze'; # erroneous services are not managed by HA, don't count them as active next if $req_state eq 'error'; diff --git a/src/test/test-service-ignore3/README b/src/test/test-service-ignore3/README new file mode 100644 index 0000000..489b1ce --- /dev/null +++ b/src/test/test-service-ignore3/README @@ -0,0 +1,2 @@ +A ignored service should not count towards active node services, so the LRM +should stay in the wait_for_agent_lock state. diff --git a/src/test/test-service-ignore3/cmdlist b/src/test/test-service-ignore3/cmdlist new file mode 100644 index 0000000..3bfad44 --- /dev/null +++ b/src/test/test-service-ignore3/cmdlist @@ -0,0 +1,3 @@ +[ + [ "power node1 on", "power node2 on", "power node3 on"] +] diff --git a/src/test/test-service-ignore3/hardware_status b/src/test/test-service-ignore3/hardware_status new file mode 100644 index 0000000..451beb1 --- /dev/null +++ b/src/test/test-service-ignore3/hardware_status @@ -0,0 +1,5 @@ +{ + "node1": { "power": "off", "network": "off" }, + "node2": { "power": "off", "network": "off" }, + "node3": { "power": "off", "network": "off" } +} diff --git a/src/test/test-service-ignore3/log.expect b/src/test/test-service-ignore3/log.expect new file mode 100644 index 0000000..586ea14 --- /dev/null +++ b/src/test/test-service-ignore3/log.expect @@ -0,0 +1,18 @@ +info 0 hardware: starting simulation +info 20 cmdlist: execute power node1 on +info 20 node1/crm: status change startup => wait_for_quorum +info 20 node1/lrm: status change startup => wait_for_agent_lock +info 20 cmdlist: execute power node2 on +info 20 node2/crm: status change startup => wait_for_quorum +info 20 node2/lrm: status change startup => wait_for_agent_lock +info 20 cmdlist: execute power node3 on +info 20 node3/crm: status change startup => wait_for_quorum +info 20 node3/lrm: status change startup => wait_for_agent_lock +info 20 node1/crm: got lock 'ha_manager_lock' +info 20 node1/crm: status change wait_for_quorum => master +info 20 node1/crm: node 'node1': state changed from 'unknown' => 'online' +info 20 node1/crm: node 'node2': state changed from 'unknown' => 'online' +info 20 node1/crm: node 'node3': state changed from 'unknown' => 'online' +info 22 node2/crm: status change wait_for_quorum => slave +info 24 node3/crm: status change wait_for_quorum => slave +info 620 hardware: exit simulation - done diff --git a/src/test/test-service-ignore3/manager_status b/src/test/test-service-ignore3/manager_status new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/src/test/test-service-ignore3/manager_status @@ -0,0 +1 @@ +{} diff --git a/src/test/test-service-ignore3/service_config b/src/test/test-service-ignore3/service_config new file mode 100644 index 0000000..8066aab --- /dev/null +++ b/src/test/test-service-ignore3/service_config @@ -0,0 +1,3 @@ +{ + "vm:103": { "node": "node3", "state": "ignored" } +}