use of org.apache.cloudstack.ha.HAConfig in project cloudstack by apache.
the class FenceTask method processResult.
public void processResult(boolean result, Throwable e) {
final HAConfig haConfig = getHaConfig();
final HAResourceCounter counter = haManager.getHACounter(haConfig.getResourceId(), haConfig.getResourceType());
if (result) {
counter.resetRecoveryCounter();
haManager.transitionHAState(HAConfig.Event.Fenced, haConfig);
getHaProvider().fenceSubResources(getResource());
getHaProvider().enableMaintenance(getResource());
}
getHaProvider().sendAlert(getResource(), HAConfig.HAState.Fencing);
}
use of org.apache.cloudstack.ha.HAConfig in project cloudstack by apache.
the class RecoveryTask method processResult.
public void processResult(boolean result, Throwable e) {
final HAConfig haConfig = getHaConfig();
final HAResourceCounter counter = haManager.getHACounter(haConfig.getResourceId(), haConfig.getResourceType());
counter.incrRecoveryCounter();
counter.resetActivityCounter();
if (result) {
haManager.transitionHAState(HAConfig.Event.Recovered, haConfig);
getHaProvider().fenceSubResources(getResource());
}
getHaProvider().sendAlert(getResource(), HAConfig.HAState.Recovering);
}
use of org.apache.cloudstack.ha.HAConfig in project cloudstack by apache.
the class ListHostHAResourcesCmd method setupResponse.
private void setupResponse(final List<HAConfig> hostHAConfigList) {
final ListResponse<HostHAResponse> response = new ListResponse<>();
final List<HostHAResponse> hostHAResponses = new ArrayList<>();
for (final HAConfig config : hostHAConfigList) {
final Host host = _resourceService.getHost(config.getResourceId());
if (host == null) {
continue;
}
final HostHAResponse hostHAResponse = new HostHAResponse();
hostHAResponse.setId(host.getUuid());
hostHAResponse.setEnabled(config.isEnabled());
hostHAResponse.setHaState(config.getState());
hostHAResponse.setProvider(config.getHaProvider());
hostHAResponses.add(hostHAResponse);
}
response.setResponses(hostHAResponses);
response.setResponseName(getCommandName());
setResponseObject(response);
}
use of org.apache.cloudstack.ha.HAConfig in project cloudstack by apache.
the class HealthCheckTask method processResult.
public void processResult(boolean result, Throwable e) {
final HAConfig haConfig = getHaConfig();
final HAResourceCounter counter = haManager.getHACounter(haConfig.getResourceId(), haConfig.getResourceType());
if (result) {
haManager.transitionHAState(HAConfig.Event.HealthCheckPassed, haConfig);
if (haConfig.getState() == HAConfig.HAState.Fenced) {
haManager.disableHA(haConfig.getResourceId(), haConfig.getResourceType());
}
counter.resetSuspectTimestamp();
counter.resetActivityCounter();
counter.resetRecoveryCounter();
} else {
haManager.transitionHAState(HAConfig.Event.HealthCheckFailed, haConfig);
counter.markResourceSuspected();
}
}
use of org.apache.cloudstack.ha.HAConfig in project cloudstack by apache.
the class ActivityCheckTask method processResult.
public synchronized void processResult(boolean result, Throwable t) {
final HAConfig haConfig = getHaConfig();
final HAResourceCounter counter = haManager.getHACounter(haConfig.getResourceId(), haConfig.getResourceType());
if (t != null && t instanceof HACheckerException) {
haManager.transitionHAState(HAConfig.Event.Ineligible, getHaConfig());
counter.resetActivityCounter();
return;
}
counter.incrActivityCounter(!result);
if (counter.getActivityCheckCounter() < maxActivityChecks) {
haManager.transitionHAState(HAConfig.Event.TooFewActivityCheckSamples, haConfig);
return;
}
if (counter.hasActivityThresholdExceeded(activityCheckFailureRatio)) {
haManager.transitionHAState(HAConfig.Event.ActivityCheckFailureOverThresholdRatio, haConfig);
} else {
if (haManager.transitionHAState(HAConfig.Event.ActivityCheckFailureUnderThresholdRatio, haConfig)) {
counter.markResourceDegraded();
}
}
counter.resetActivityCounter();
}
Aggregations