Search in sources :

Example 46 with FenceOperationResult

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

the class FenceAgentExecutorTest method successfulFenceWithSameProxyRetry.

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

Example 47 with FenceOperationResult

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

the class HostFenceActionExecutorTest method successfulStatusWithSpecifiedFenceAgent.

/**
 * Test successful status action using specified fence agent
 */
@Test
public void successfulStatusWithSpecifiedFenceAgent() {
    // result of fence action invoked on specified agent
    mockFenceResult(agentExecutor1, new FenceOperationResult(Status.SUCCESS, PowerStatus.ON));
    FenceOperationResult result = executor.getFenceAgentStatus(createFenceAgent(1));
    assertNotNull(result);
    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)

Example 48 with FenceOperationResult

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

the class HostFenceActionExecutorTest method failedStatusWithSpecifiedFenceAgent.

/**
 * Test failed status action using specified fence agent
 */
@Test
public void failedStatusWithSpecifiedFenceAgent() {
    // result of fence action invoked on specified agent
    mockFenceResult(agentExecutor1, new FenceOperationResult(Status.ERROR, PowerStatus.UNKNOWN));
    FenceOperationResult result = executor.getFenceAgentStatus(createFenceAgent(1));
    assertNotNull(result);
    assertEquals(Status.ERROR, result.getStatus());
    assertEquals(PowerStatus.UNKNOWN, result.getPowerStatus());
}
Also used : FenceOperationResult(org.ovirt.engine.core.common.businessentities.pm.FenceOperationResult) Test(org.junit.Test)

Example 49 with FenceOperationResult

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

the class HostFenceActionExecutorTest method hostIsPoweredOffWhenFenceStatusReturnsOff.

/**
 * Test that host is powered off when status action returns power off
 */
@Test
public void hostIsPoweredOffWhenFenceStatusReturnsOff() {
    mockFenceAgent();
    // result of fence action invoked on specified agent
    mockFenceResult(agentExecutor1, new FenceOperationResult(Status.SUCCESS, PowerStatus.OFF));
    assertTrue(executor.isHostPoweredOff());
}
Also used : FenceOperationResult(org.ovirt.engine.core.common.businessentities.pm.FenceOperationResult) Test(org.junit.Test)

Example 50 with FenceOperationResult

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

the class HostFenceActionExecutorTest method failedFenceWithAllError.

/**
 * Test failed fence action when both of 2 sequential fence agents return error
 */
@Test
public void failedFenceWithAllError() {
    mockFenceAgents();
    // result of fence action invoked on 1st sequential agent
    mockFenceResult(agentExecutor1, new FenceOperationResult(Status.ERROR, PowerStatus.UNKNOWN));
    // result of fence action invoked on 2nd sequential agent
    mockFenceResult(agentExecutor2, new FenceOperationResult(Status.ERROR, PowerStatus.UNKNOWN));
    FenceOperationResult result = executor.fence(FenceActionType.STATUS);
    assertEquals(Status.ERROR, result.getStatus());
    assertEquals(PowerStatus.UNKNOWN, 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