Search in sources :

Example 96 with VDSReturnValue

use of org.ovirt.engine.core.common.vdscommands.VDSReturnValue in project ovirt-engine by oVirt.

the class GetMultipleTlvsByHostIdTest method setup.

private void setup(ExpectedError expectedError) {
    Guid validGuid = Guid.newGuid();
    VDS validVds = new VDS();
    validVds.setId(validGuid);
    if (expectedError == ExpectedError.NOT_SUPPORTED) {
        validVds.setClusterCompatibilityVersion(Version.v4_1);
    } else {
        validVds.setClusterCompatibilityVersion(Version.v4_2);
    }
    when(getQueryParameters().getId()).thenReturn(validGuid);
    when(vdsDao.get(eq(validGuid))).thenReturn(validVds);
    VDSReturnValue returnValue = new VDSReturnValue();
    returnValue.setSucceeded(true);
    returnValue.setReturnValue(creatLldpInfoMap(expectedError != ExpectedError.LLDP_ENABLE));
    when(vdsBrokerFrontendMocked.runVdsCommand(eq(VDSCommandType.GetLldp), any())).thenReturn(returnValue);
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) Guid(org.ovirt.engine.core.compat.Guid) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Example 97 with VDSReturnValue

use of org.ovirt.engine.core.common.vdscommands.VDSReturnValue in project ovirt-engine by oVirt.

the class GetTlvsByHostNicIdQueryTest method setup.

public void setup(ExpectedError expectedError) {
    Guid validVdsGuid = Guid.newGuid();
    VDS validVds = new VDS();
    validVds.setId(validVdsGuid);
    if (expectedError == ExpectedError.NOT_SUPPORTED) {
        validVds.setClusterCompatibilityVersion(Version.v4_1);
    } else {
        validVds.setClusterCompatibilityVersion(Version.v4_2);
    }
    final Guid NIC_ID = Guid.Empty;
    when(getQueryParameters().getId()).thenReturn(expectedError == ExpectedError.NIC_ID_NOT_NULL ? null : NIC_ID);
    when(interfaceDaoMocked.get(NIC_ID)).thenReturn(createNic(expectedError, validVdsGuid));
    when(vdsDao.get(eq(validVdsGuid))).thenReturn(validVds);
    VDSReturnValue returnValue = new VDSReturnValue();
    returnValue.setSucceeded(true);
    returnValue.setReturnValue(creatLldpInfoMap(expectedError != ExpectedError.LLDP_ENABLED));
    when(vdsBrokerFrontendMock.runVdsCommand(eq(VDSCommandType.GetLldp), any())).thenReturn(returnValue);
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) Guid(org.ovirt.engine.core.compat.Guid) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Example 98 with VDSReturnValue

use of org.ovirt.engine.core.common.vdscommands.VDSReturnValue in project ovirt-engine by oVirt.

the class StopRebalanceGlusterVolumeCommandTest method mockBackend.

private void mockBackend(boolean succeeded, JobExecutionStatus rebalanceStopStatus, boolean isRebalancegTaskCompleted, EngineError errorCode) {
    doReturn("TestVDS").when(cmd).getClusterName();
    doReturn("TestVolume").when(cmd).getGlusterVolumeName();
    doNothing().when(cmd).endStepJob(eq(rebalanceStopStatus), any(), eq(isRebalancegTaskCompleted));
    doNothing().when(cmd).releaseVolumeLock();
    VDSReturnValue vdsReturnValue = new VDSReturnValue();
    GlusterVolumeTaskStatusEntity rebalanceStatusEntity = new GlusterVolumeTaskStatusEntity();
    rebalanceStatusEntity.getStatusSummary().setStatus(rebalanceStopStatus);
    vdsReturnValue.setReturnValue(rebalanceStatusEntity);
    vdsReturnValue.setSucceeded(succeeded);
    if (!succeeded) {
        vdsReturnValue.setVdsError(new VDSError(errorCode, ""));
    }
    when(vdsBrokerFrontend.runVdsCommand(eq(VDSCommandType.StopRebalanceGlusterVolume), 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)

Example 99 with VDSReturnValue

use of org.ovirt.engine.core.common.vdscommands.VDSReturnValue in project ovirt-engine by oVirt.

the class StorageDeviceSyncJobTest method getStorageDevicesVDSReturnVal.

private Object getStorageDevicesVDSReturnVal(Guid hostId) {
    VDSReturnValue vdsRetValue = new VDSReturnValue();
    vdsRetValue.setSucceeded(true);
    if (HOST_ID_WITH_NEW_DEVICES.equals(hostId)) {
        vdsRetValue.setReturnValue(Arrays.asList(getStorageDevice("sda", null), getStorageDevice("sdb", null), getStorageDevice("sdc", null)));
    } else if (HOST_ID_WITH_DEVICES_CHANGED.equals(hostId)) {
        List<StorageDevice> devices = new ArrayList<>();
        devices.add(getStorageDevice("device-without-anychange", DEVICE_WITHOUT_ANYCHANGE));
        devices.add(getStorageDevice("new-device-with-name-change", DEVICE_WITH_NAME_CHANGE));
        StorageDevice device = getStorageDevice("device-with-change", DEVICE_WITH_CHANGE);
        device.setMountPoint("/temp-mount");
        device.setFsType("XFS");
        device.setSize(12345678L);
        devices.add(device);
        device = getStorageDevice("device-with-devuuid-but-name-changed-1", DEVICE_WITH_DEVUUID_BUT_NAME_CHANGED);
        device.setDevUuid("123456");
        devices.add(device);
        devices.add(getStorageDevice("device-with-devuuid-but-name-changed", null));
        vdsRetValue.setReturnValue(devices);
    } else {
        vdsRetValue.setReturnValue(Collections.emptyList());
    }
    return vdsRetValue;
}
Also used : StorageDevice(org.ovirt.engine.core.common.businessentities.gluster.StorageDevice) ArrayList(java.util.ArrayList) List(java.util.List) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Example 100 with VDSReturnValue

use of org.ovirt.engine.core.common.vdscommands.VDSReturnValue in project ovirt-engine by oVirt.

the class UpdateGlusterHookCommandTest 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.UpdateGlusterHook), any())).thenReturn(vdsReturnValue);
}
Also used : VDSError(org.ovirt.engine.core.common.errors.VDSError) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Aggregations

VDSReturnValue (org.ovirt.engine.core.common.vdscommands.VDSReturnValue)250 Guid (org.ovirt.engine.core.compat.Guid)65 ArrayList (java.util.ArrayList)43 VDS (org.ovirt.engine.core.common.businessentities.VDS)29 EngineException (org.ovirt.engine.core.common.errors.EngineException)29 Pair (org.ovirt.engine.core.common.utils.Pair)26 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)23 List (java.util.List)16 Test (org.junit.Test)15 StorageDomainStatic (org.ovirt.engine.core.common.businessentities.StorageDomainStatic)15 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)15 VdsIdVDSCommandParametersBase (org.ovirt.engine.core.common.vdscommands.VdsIdVDSCommandParametersBase)15 HashMap (java.util.HashMap)13 VDSError (org.ovirt.engine.core.common.errors.VDSError)13 Map (java.util.Map)11 Callable (java.util.concurrent.Callable)11 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)11 StoragePoolIsoMap (org.ovirt.engine.core.common.businessentities.StoragePoolIsoMap)11 EngineLock (org.ovirt.engine.core.utils.lock.EngineLock)9 GlusterGeoRepSession (org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession)8