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);
}
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);
}
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);
}
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;
}
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);
}
Aggregations