5
0
mirror of git://git.proxmox.com/git/pve-ha-manager.git synced 2025-01-03 05:17:57 +03:00

tests: add one for service set to be & stay ignored from the start

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2021-07-01 17:26:13 +02:00
parent 21051707f6
commit d54c04bdcc
7 changed files with 33 additions and 2 deletions

View File

@ -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';

View File

@ -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.

View File

@ -0,0 +1,3 @@
[
[ "power node1 on", "power node2 on", "power node3 on"]
]

View File

@ -0,0 +1,5 @@
{
"node1": { "power": "off", "network": "off" },
"node2": { "power": "off", "network": "off" },
"node3": { "power": "off", "network": "off" }
}

View File

@ -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

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1,3 @@
{
"vm:103": { "node": "node3", "state": "ignored" }
}