summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
f9b7a59)
If a service is in error state the single state change command that
can make sense is setting the disabled request state.
Thus abort on all other commands early to enhance user experience.
+sub check_service_state {
+ my ($sid, $req_state) = @_;
+
+ my $service_status = PVE::HA::Config::get_service_status($sid);
+ if ($service_status->{managed} && $service_status->{state} eq 'error') {
+ # service in error state, must get disabled before new state request
+ # can be executed
+ return if defined($req_state) && $req_state eq 'disabled';
+ die "service '$sid' in error state, must be disabled and fixed first\n";
+ }
+}
+
__PACKAGE__->register_method ({
name => 'index',
path => '',
__PACKAGE__->register_method ({
name => 'index',
path => '',
if !$group_cfg->{ids}->{$group};
}
if !$group_cfg->{ids}->{$group};
}
+ check_service_state($sid, $param->{state});
+
PVE::HA::Config::lock_ha_domain(
sub {
PVE::HA::Config::lock_ha_domain(
sub {
PVE::HA::Config::service_is_ha_managed($sid);
PVE::HA::Config::service_is_ha_managed($sid);
+ check_service_state($sid);
+
PVE::HA::Config::queue_crm_commands("migrate $sid $param->{node}");
return undef;
PVE::HA::Config::queue_crm_commands("migrate $sid $param->{node}");
return undef;
PVE::HA::Config::service_is_ha_managed($sid);
PVE::HA::Config::service_is_ha_managed($sid);
+ check_service_state($sid);
+
PVE::HA::Config::queue_crm_commands("relocate $sid $param->{node}");
return undef;
PVE::HA::Config::queue_crm_commands("relocate $sid $param->{node}");
return undef;