# Server can have several states:
my $valid_states = {
- wait_for_agent_lock => "waiting for agnet lock",
+ disabled => "HA is disabled (no resource configuration)",
+ wait_for_agent_lock => "waiting for agent lock",
active => "got agent_lock",
lost_agent_lock => "lost agent_lock",
};
results => {},
}, $class;
- $self->set_local_status({ state => 'wait_for_agent_lock' });
+ my $next_state = $haenv->service_config_exists() ?
+ 'wait_for_agent_lock' : 'disabled';
+
+ $self->set_local_status({ state => $next_state });
return $self;
}
my $ctime = $haenv->get_time();
- if ($state eq 'wait_for_agent_lock') {
+ if ($state eq 'disabled') {
+
+ if ($haenv->service_config_exists()) {
+ $self->set_local_status({ state => 'wait_for_agent_lock' });
+ }
+
+ } if ($state eq 'wait_for_agent_lock') {
my $service_count = 1; # todo: correctly compute
return 0;
}
+ } elsif ($state eq 'disabled') {
+ # do nothing
+
} else {
die "got unexpected status '$state'\n";