Search in sources :

Example 56 with FenceOperationResult

use of org.ovirt.engine.core.common.businessentities.pm.FenceOperationResult in project ovirt-engine by oVirt.

the class SingleAgentFenceActionExecutorTest method successfulStartUnknownStatusLimitExceededOn1stAttempt.

/**
 * Test start action with UNKNOWN power status limit exceeded on 1st attempt, but 2nd attempt is successful
 */
@Test
public void successfulStartUnknownStatusLimitExceededOn1stAttempt() {
    FenceOperationResult expectedResult = new FenceOperationResult(Status.SUCCESS, PowerStatus.ON);
    FenceOperationResult[] expectedResults = { // result of 1st start action
    new FenceOperationResult(Status.SUCCESS, PowerStatus.UNKNOWN), // result of 1st status action
    new FenceOperationResult(Status.SUCCESS, PowerStatus.UNKNOWN), // result of 2nd start action
    new FenceOperationResult(Status.SUCCESS, PowerStatus.UNKNOWN), // result of 1st status action
    new FenceOperationResult(Status.SUCCESS, PowerStatus.ON) };
    mockFenceActionResults(expectedResults);
    FenceOperationResult result = executor.fence(FenceActionType.START);
    validateResult(expectedResult, result);
}
Also used : FenceOperationResult(org.ovirt.engine.core.common.businessentities.pm.FenceOperationResult) Test(org.junit.Test)

Example 57 with FenceOperationResult

use of org.ovirt.engine.core.common.businessentities.pm.FenceOperationResult in project ovirt-engine by oVirt.

the class SingleAgentFenceActionExecutorTest method successfulGetStatus.

/**
 * Test successful status action
 */
@Test
public void successfulGetStatus() {
    FenceOperationResult expectedResult = new FenceOperationResult(Status.SUCCESS, PowerStatus.ON);
    FenceOperationResult[] expectedResults = { expectedResult };
    mockFenceActionResults(expectedResults);
    FenceOperationResult result = executor.fence(FenceActionType.STATUS);
    validateResult(expectedResult, result);
}
Also used : FenceOperationResult(org.ovirt.engine.core.common.businessentities.pm.FenceOperationResult) Test(org.junit.Test)

Example 58 with FenceOperationResult

use of org.ovirt.engine.core.common.businessentities.pm.FenceOperationResult in project ovirt-engine by oVirt.

the class BackendHostResource method getFenceStatus.

private Response getFenceStatus(Action action) {
    FenceOperationResult result = getEntity(FenceOperationResult.class, QueryType.GetVdsFenceStatus, new IdQueryParameters(guid), guid.toString());
    if (result.getStatus() == Status.SUCCESS) {
        PowerManagement pm = new PowerManagement();
        pm.setStatus(convertPowerStatus(result.getPowerStatus()));
        action.setPowerManagement(pm);
        return actionSuccess(action);
    } else {
        return handleFailure(action, result.getMessage());
    }
}
Also used : PowerManagement(org.ovirt.engine.api.model.PowerManagement) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) FenceOperationResult(org.ovirt.engine.core.common.businessentities.pm.FenceOperationResult)

Aggregations

FenceOperationResult (org.ovirt.engine.core.common.businessentities.pm.FenceOperationResult)58 Test (org.junit.Test)43 ArrayList (java.util.ArrayList)2 Action (org.ovirt.engine.api.model.Action)2 FenceAgent (org.ovirt.engine.core.common.businessentities.pm.FenceAgent)2 PowerStatus (org.ovirt.engine.core.common.businessentities.pm.PowerStatus)2 EngineException (org.ovirt.engine.core.common.errors.EngineException)2 Comparator (java.util.Comparator)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Objects (java.util.Objects)1 ExecutionException (java.util.concurrent.ExecutionException)1 Future (java.util.concurrent.Future)1 Response (javax.ws.rs.core.Response)1 PowerManagement (org.ovirt.engine.api.model.PowerManagement)1 PowerManagementStatus (org.ovirt.engine.api.model.PowerManagementStatus)1 BaseCommandTest (org.ovirt.engine.core.bll.BaseCommandTest)1 HostFenceActionExecutor (org.ovirt.engine.core.bll.pm.HostFenceActionExecutor)1 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)1