Search in sources :

Example 11 with VDSError

use of org.ovirt.engine.core.common.errors.VDSError in project ovirt-engine by oVirt.

the class AddGlusterHookCommandTest method mockBackend.

private void mockBackend(boolean succeeded, EngineError errorCode) {
    VDSReturnValue vdsReturnValue = new VDSReturnValue();
    vdsReturnValue.setSucceeded(succeeded);
    if (!succeeded) {
        vdsReturnValue.setVdsError(new VDSError(errorCode, ""));
    }
    when(vdsBrokerFrontend.runVdsCommand(eq(VDSCommandType.AddGlusterHook), any())).thenReturn(vdsReturnValue);
}
Also used : VDSError(org.ovirt.engine.core.common.errors.VDSError) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Example 12 with VDSError

use of org.ovirt.engine.core.common.errors.VDSError in project ovirt-engine by oVirt.

the class CommitRemoveGlusterVolumeBricksCommandTest method mockBackend.

@SuppressWarnings("unchecked")
private void mockBackend(boolean succeeded, EngineError errorCode) {
    doNothing().when(cmd).endStepJobCommitted();
    doNothing().when(cmd).releaseVolumeLock();
    VDSReturnValue vdsReturnValue = new VDSReturnValue();
    vdsReturnValue.setSucceeded(succeeded);
    if (!succeeded) {
        vdsReturnValue.setVdsError(new VDSError(errorCode, ""));
    }
    when(vdsBrokerFrontend.runVdsCommand(eq(VDSCommandType.CommitRemoveGlusterVolumeBricks), any())).thenReturn(vdsReturnValue);
}
Also used : VDSError(org.ovirt.engine.core.common.errors.VDSError) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Example 13 with VDSError

use of org.ovirt.engine.core.common.errors.VDSError in project ovirt-engine by oVirt.

the class GlusterServiceSyncJobTest method createVDSReturnValueForFailure.

private VDSReturnValue createVDSReturnValueForFailure() {
    VDSReturnValue ret = new VDSReturnValue();
    ret.setSucceeded(false);
    ret.setVdsError(new VDSError(EngineError.GlusterServicesActionFailed, "VDSM Error"));
    return ret;
}
Also used : VDSError(org.ovirt.engine.core.common.errors.VDSError) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Example 14 with VDSError

use of org.ovirt.engine.core.common.errors.VDSError in project ovirt-engine by oVirt.

the class ManageGlusterServiceCommandTest method mockBackend.

private void mockBackend(boolean succeeded, EngineError errorCode, GlusterServiceStatus status) {
    VDSReturnValue vdsReturnValue = new VDSReturnValue();
    vdsReturnValue.setSucceeded(succeeded);
    if (!succeeded) {
        vdsReturnValue.setVdsError(new VDSError(errorCode, ""));
    } else {
        if (status == GlusterServiceStatus.STOPPED) {
            vdsReturnValue.setReturnValue(getGlusterServerServicesByServerIdAndServiceType(Guid.newGuid(), ServiceType.GLUSTER_SWIFT, status));
        } else {
            // Adding one additional service for the case of stop so that save mechanism can be tested out
            Guid serverId = Guid.newGuid();
            List<GlusterServerService> serverServiceList = getGlusterServerServicesByServerIdAndServiceType(serverId, ServiceType.GLUSTER_SWIFT, status);
            GlusterServerService srvc3 = new GlusterServerService();
            srvc3.setMessage("test-msg3");
            srvc3.setPid(10000);
            srvc3.setPort(20000);
            srvc3.setServerId(serverId);
            srvc3.setServiceId(Guid.newGuid());
            srvc3.setServiceName("srvc3");
            srvc3.setServiceType(ServiceType.GLUSTER_SWIFT);
            srvc3.setStatus(status);
            serverServiceList.add(srvc3);
            vdsReturnValue.setReturnValue(serverServiceList);
        }
    }
    when(vdsBrokerFrontend.runVdsCommand(eq(VDSCommandType.ManageGlusterService), any())).thenReturn(vdsReturnValue);
}
Also used : VDSError(org.ovirt.engine.core.common.errors.VDSError) GlusterServerService(org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService) Guid(org.ovirt.engine.core.compat.Guid) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Example 15 with VDSError

use of org.ovirt.engine.core.common.errors.VDSError in project ovirt-engine by oVirt.

the class StopRemoveGlusterVolumeBricksCommandTest method mockBackend.

private void mockBackend(boolean succeeded, EngineError errorCode) {
    doNothing().when(cmd).endStepJobAborted(any());
    doNothing().when(cmd).releaseVolumeLock();
    VDSReturnValue vdsReturnValue = new VDSReturnValue();
    vdsReturnValue.setSucceeded(succeeded);
    if (!succeeded) {
        vdsReturnValue.setVdsError(new VDSError(errorCode, ""));
    } else {
        vdsReturnValue.setReturnValue(new GlusterVolumeTaskStatusEntity());
    }
    when(vdsBrokerFrontend.runVdsCommand(eq(VDSCommandType.StopRemoveGlusterVolumeBricks), any())).thenReturn(vdsReturnValue);
}
Also used : VDSError(org.ovirt.engine.core.common.errors.VDSError) GlusterVolumeTaskStatusEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Aggregations

VDSError (org.ovirt.engine.core.common.errors.VDSError)24 VDSReturnValue (org.ovirt.engine.core.common.vdscommands.VDSReturnValue)13 EngineError (org.ovirt.engine.core.common.errors.EngineError)7 Guid (org.ovirt.engine.core.compat.Guid)3 Map (java.util.Map)2 GlusterVolumeTaskStatusEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity)2 UndeclaredThrowableException (java.lang.reflect.UndeclaredThrowableException)1 SocketException (java.net.SocketException)1 ArrayList (java.util.ArrayList)1 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1 List (java.util.List)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 Collectors (java.util.stream.Collectors)1 Inject (javax.inject.Inject)1 AsyncTaskStatus (org.ovirt.engine.core.common.businessentities.AsyncTaskStatus)1 HostJobInfo (org.ovirt.engine.core.common.businessentities.HostJobInfo)1 HostJobStatus (org.ovirt.engine.core.common.businessentities.HostJobInfo.HostJobStatus)1 HostJobType (org.ovirt.engine.core.common.businessentities.HostJobInfo.HostJobType)1 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)1