Search in sources :

Example 16 with FenceOperationResult

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

the class ConcurrentAgentsFenceActionExecutorTest method successfulStopWhenAllAgentsSuccessful.

/**
 * Test successful stop action, when all agents were successful
 */
@Test
public void successfulStopWhenAllAgentsSuccessful() {
    FenceOperationResult expectedResult = new FenceOperationResult(Status.SUCCESS, PowerStatus.OFF);
    mockSingleAgentResult(singleExecutor1, new FenceOperationResult(Status.SUCCESS, PowerStatus.OFF));
    mockSingleAgentResult(singleExecutor2, new FenceOperationResult(Status.SUCCESS, PowerStatus.OFF));
    FenceOperationResult result = executor.fence(FenceActionType.STOP);
    validateResult(expectedResult, result);
}
Also used : FenceOperationResult(org.ovirt.engine.core.common.businessentities.pm.FenceOperationResult) Test(org.junit.Test)

Example 17 with FenceOperationResult

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

the class ConcurrentAgentsFenceActionExecutorTest method successfulStartWhenOneSuccessfulAndAnotherFailed.

/**
 * Test successful start action, when one agent was successful and another failed
 */
@Test
public void successfulStartWhenOneSuccessfulAndAnotherFailed() {
    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.START);
    validateResult(expectedResult, result);
}
Also used : FenceOperationResult(org.ovirt.engine.core.common.businessentities.pm.FenceOperationResult) Test(org.junit.Test)

Example 18 with FenceOperationResult

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

the class ConcurrentAgentsFenceActionExecutorTest method failedStartWhenAllAgentsFailed.

/**
 * Test failed start action, when all agents failed
 */
@Test
public void failedStartWhenAllAgentsFailed() {
    FenceOperationResult expectedResult = new FenceOperationResult(Status.ERROR, PowerStatus.UNKNOWN);
    mockSingleAgentResult(singleExecutor1, new FenceOperationResult(Status.ERROR, PowerStatus.UNKNOWN));
    mockSingleAgentResult(singleExecutor2, new FenceOperationResult(Status.ERROR, PowerStatus.UNKNOWN));
    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 19 with FenceOperationResult

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

the class FenceAgentExecutorTest method successfulFence.

/**
 * Test that the return value is correct when fencing succeeds.
 */
@Test
public void successfulFence() {
    FenceOperationResult fenceVdsResult = new FenceOperationResult(Status.SUCCESS);
    mockFenceVdsResult(fenceVdsResult, null);
    mockProxyHost();
    FenceOperationResult result = executor.fence(FenceActionType.START, createAgent());
    assertEquals(Status.SUCCESS, result.getStatus());
    verifyAuditFenceExecutionStart(1);
}
Also used : FenceOperationResult(org.ovirt.engine.core.common.businessentities.pm.FenceOperationResult) Test(org.junit.Test)

Example 20 with FenceOperationResult

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

the class HostFenceActionExecutorTest method successfulFenceWith1stSuccess.

/**
 * Test successful fence action when the 1st of 2 sequential fence agents returns success
 */
@Test
public void successfulFenceWith1stSuccess() {
    mockFenceAgents();
    // result of fence action invoked on 1st sequential agent
    mockFenceResult(agentExecutor1, new FenceOperationResult(Status.SUCCESS, PowerStatus.ON));
    // result of fence action invoked on 2nd sequential agent - set it to error, so we verify that it's not used
    mockFenceResult(agentExecutor2, new FenceOperationResult(Status.ERROR, PowerStatus.UNKNOWN));
    FenceOperationResult result = executor.fence(FenceActionType.STATUS);
    assertEquals(Status.SUCCESS, result.getStatus());
    assertEquals(PowerStatus.ON, result.getPowerStatus());
}
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