Search in sources :

Example 1 with HAResourceCounter

use of org.apache.cloudstack.ha.HAResourceCounter 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);
}
Also used : HAConfig(org.apache.cloudstack.ha.HAConfig) HAResourceCounter(org.apache.cloudstack.ha.HAResourceCounter)

Example 2 with HAResourceCounter

use of org.apache.cloudstack.ha.HAResourceCounter 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);
}
Also used : HAConfig(org.apache.cloudstack.ha.HAConfig) HAResourceCounter(org.apache.cloudstack.ha.HAResourceCounter)

Example 3 with HAResourceCounter

use of org.apache.cloudstack.ha.HAResourceCounter 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();
    }
}
Also used : HAConfig(org.apache.cloudstack.ha.HAConfig) HAResourceCounter(org.apache.cloudstack.ha.HAResourceCounter)

Example 4 with HAResourceCounter

use of org.apache.cloudstack.ha.HAResourceCounter 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();
}
Also used : HAConfig(org.apache.cloudstack.ha.HAConfig) HACheckerException(org.apache.cloudstack.ha.provider.HACheckerException) HAResourceCounter(org.apache.cloudstack.ha.HAResourceCounter)

Aggregations

HAConfig (org.apache.cloudstack.ha.HAConfig)4 HAResourceCounter (org.apache.cloudstack.ha.HAResourceCounter)4 HACheckerException (org.apache.cloudstack.ha.provider.HACheckerException)1