Search in sources :

Example 36 with FenceOperationResult

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

the class FenceVdsVDSCommandTest method successfulGetStatus.

/**
 * Tests result of successful get power status of host
 */
@Test
public void successfulGetStatus() {
    String agentMessage = "Test succeeded: on";
    setupCommand(setupCommandParams(FenceActionType.STATUS));
    setupBrokerResult(createBrokerResultMap(0, agentMessage, "on", null));
    command.execute();
    FenceOperationResult result = (FenceOperationResult) command.getVDSReturnValue().getReturnValue();
    assertEquals(Status.SUCCESS, result.getStatus());
    assertEquals(PowerStatus.ON, result.getPowerStatus());
    assertEquals(agentMessage, result.getMessage());
}
Also used : FenceOperationResult(org.ovirt.engine.core.common.businessentities.pm.FenceOperationResult) Test(org.junit.Test)

Example 37 with FenceOperationResult

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

the class GetFenceAgentStatusQuery method executeQueryCommand.

@Override
protected void executeQueryCommand() {
    HostFenceActionExecutor executor = new HostFenceActionExecutor(getHost());
    FenceOperationResult result = executor.getFenceAgentStatus(getParameters().getAgent());
    getQueryReturnValue().setSucceeded(result.getStatus() == Status.SUCCESS);
    getQueryReturnValue().setReturnValue(result);
}
Also used : FenceOperationResult(org.ovirt.engine.core.common.businessentities.pm.FenceOperationResult) HostFenceActionExecutor(org.ovirt.engine.core.bll.pm.HostFenceActionExecutor)

Example 38 with FenceOperationResult

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

the class ConcurrentAgentsFenceActionExecutorTest method failedStatusWhenOneReportsOffAndOtherFailed.

/**
 * Test failed status action, when one agent reports power off and other reports error
 */
@Test
public void failedStatusWhenOneReportsOffAndOtherFailed() {
    FenceOperationResult expectedResult = new FenceOperationResult(Status.ERROR, PowerStatus.UNKNOWN);
    mockSingleAgentResult(singleExecutor1, new FenceOperationResult(Status.SUCCESS, PowerStatus.OFF));
    mockSingleAgentResult(singleExecutor2, new FenceOperationResult(Status.ERROR, PowerStatus.UNKNOWN));
    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 39 with FenceOperationResult

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

the class ConcurrentAgentsFenceActionExecutorTest method statusOnWhenAllReportsOn.

/**
 * Test status action with power on result, when both agents reports power on
 */
@Test
public void statusOnWhenAllReportsOn() {
    FenceOperationResult expectedResult = new FenceOperationResult(Status.SUCCESS, PowerStatus.ON);
    mockSingleAgentResult(singleExecutor1, new FenceOperationResult(Status.SUCCESS, PowerStatus.ON));
    mockSingleAgentResult(singleExecutor2, new FenceOperationResult(Status.SUCCESS, PowerStatus.ON));
    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 40 with FenceOperationResult

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

the class ConcurrentAgentsFenceActionExecutorTest method statusOnWhenOneReportsOnAndOtherFailed.

/**
 * Test status action with power on result, when one agent reports power on and other reports error
 */
@Test
public void statusOnWhenOneReportsOnAndOtherFailed() {
    FenceOperationResult expectedResult = new FenceOperationResult(Status.SUCCESS, PowerStatus.ON);
    mockSingleAgentResult(singleExecutor1, new FenceOperationResult(Status.ERROR, PowerStatus.UNKNOWN));
    mockSingleAgentResult(singleExecutor2, new FenceOperationResult(Status.SUCCESS, PowerStatus.ON));
    FenceOperationResult result = executor.fence(FenceActionType.STATUS);
    validateResult(expectedResult, result);
}
Also used : FenceOperationResult(org.ovirt.engine.core.common.businessentities.pm.FenceOperationResult) Test(org.junit.Test)

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