Search in sources :

Example 41 with FenceOperationResult

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

the class ConcurrentAgentsFenceActionExecutorTest method successfulStartWhenAllAgentsSuccessful.

/**
 * Test successful start action, when all agents were successful
 */
@Test
public void successfulStartWhenAllAgentsSuccessful() {
    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.START);
    validateResult(expectedResult, result);
}
Also used : FenceOperationResult(org.ovirt.engine.core.common.businessentities.pm.FenceOperationResult) Test(org.junit.Test)

Example 42 with FenceOperationResult

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

the class ConcurrentAgentsFenceActionExecutorTest method statusOffWhenAllReportsOff.

/**
 * Test status action with power off result, when all agents reports power off
 */
@Test
public void statusOffWhenAllReportsOff() {
    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.STATUS);
    validateResult(expectedResult, result);
}
Also used : FenceOperationResult(org.ovirt.engine.core.common.businessentities.pm.FenceOperationResult) Test(org.junit.Test)

Example 43 with FenceOperationResult

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

the class FenceAgentExecutorTest method successfulFenceWithDifferentProxyRetry.

/**
 * Test that fence attempt is retried with a different proxy host when first fence attempt fails
 */
@Test
public void successfulFenceWithDifferentProxyRetry() {
    FenceOperationResult fenceVdsResult1 = new FenceOperationResult(Status.ERROR);
    FenceOperationResult fenceVdsResult2 = new FenceOperationResult(Status.SUCCESS);
    mockFenceVdsResult(fenceVdsResult1, fenceVdsResult2);
    mockProxyHost(true);
    FenceOperationResult result = executor.fence(FenceActionType.START, createAgent());
    assertEquals(Status.SUCCESS, result.getStatus());
    verifyAuditFenceExecutionStart(2);
    verifyAuditFenceExecutionFailure(1);
}
Also used : FenceOperationResult(org.ovirt.engine.core.common.businessentities.pm.FenceOperationResult) Test(org.junit.Test)

Example 44 with FenceOperationResult

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

the class FenceAgentExecutorTest method failedFenceWithDifferentProxyRetry.

/**
 * Test that the whole fence execution fails when the first fence attempt fails and the second attempt using
 * a different proxy host also fails
 */
@Test
public void failedFenceWithDifferentProxyRetry() {
    FenceOperationResult fenceVdsResult1 = new FenceOperationResult(Status.ERROR);
    FenceOperationResult fenceVdsResult2 = new FenceOperationResult(Status.ERROR);
    mockFenceVdsResult(fenceVdsResult1, fenceVdsResult2);
    mockProxyHost(true);
    FenceOperationResult result = executor.fence(FenceActionType.START, createAgent());
    assertEquals(Status.ERROR, result.getStatus());
    verifyAttemptToFindDifferentProxy();
    verifyAuditFenceExecutionFailure(2);
}
Also used : FenceOperationResult(org.ovirt.engine.core.common.businessentities.pm.FenceOperationResult) Test(org.junit.Test)

Example 45 with FenceOperationResult

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

the class FenceAgentExecutorTest method failedFenceWithSameProxyRetry.

/**
 * Test that the whole fence execution fails when the first fence attempt fails and the second attempt using
 * the same proxy host also fails
 */
@Test
public void failedFenceWithSameProxyRetry() {
    FenceOperationResult fenceVdsResult1 = new FenceOperationResult(Status.ERROR);
    FenceOperationResult fenceVdsResult2 = new FenceOperationResult(Status.ERROR);
    mockFenceVdsResult(fenceVdsResult1, fenceVdsResult2);
    mockProxyHost(false);
    FenceOperationResult result = executor.fence(FenceActionType.START, createAgent());
    assertEquals(Status.ERROR, result.getStatus());
    verifyAttemptToFindDifferentProxy();
    verifyAuditFenceExecutionFailure(2);
}
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