use of org.ovirt.engine.core.common.businessentities.storage.LunDisk in project ovirt-engine by oVirt.
the class AddDiskCommandTest method testLunDiskInvalid.
@Test
public void testLunDiskInvalid() {
VDS vds = mockVds();
LunDisk disk = createISCSILunDisk();
command.getParameters().setDiskInfo(disk);
command.getParameters().setVdsId(vds.getId());
command.setVds(vds);
mockMaxPciSlots();
mockInterfaceList();
mockVm();
List<LUNs> luns = Collections.emptyList();
doReturn(luns).when(command).executeGetDeviceList(any(), any(), any());
ValidateTestUtils.runAndAssertValidateFailure(command, EngineMessage.ACTION_TYPE_FAILED_DISK_LUN_INVALID);
}
use of org.ovirt.engine.core.common.businessentities.storage.LunDisk in project ovirt-engine by oVirt.
the class AddDiskCommandTest method testIscsiLunCanBeAdded.
@Test
public void testIscsiLunCanBeAdded() {
LunDisk disk = createISCSILunDisk();
command.getParameters().setDiskInfo(disk);
command.getParameters().getDiskVmElement().setUsingScsiReservation(false);
assertTrue("checkIfLunDiskCanBeAdded() failed for valid iscsi lun", command.checkIfLunDiskCanBeAdded(spyDiskValidator(disk)));
}
use of org.ovirt.engine.core.common.businessentities.storage.LunDisk in project ovirt-engine by oVirt.
the class AddDiskCommandTest method testAddingIDELunExceedsSlotLimit.
@Test
public void testAddingIDELunExceedsSlotLimit() {
mockInterfaceList();
LunDisk disk = createISCSILunDisk();
command.getParameters().setDiskInfo(disk);
command.getParameters().getDiskVmElement().setDiskInterface(DiskInterface.IDE);
VM vm = mockVm();
mockMaxPciSlots();
// use maximum slots for IDE - validate expected to succeed.
mockOtherVmDisks(vm, VmCommand.MAX_IDE_SLOTS - 1, DiskInterface.IDE);
ValidateTestUtils.runAndAssertValidateSuccess(command);
LunDisk newDisk = createISCSILunDisk();
DiskVmElement dve = new DiskVmElement(disk.getId(), vmId);
dve.setDiskInterface(DiskInterface.IDE);
newDisk.setDiskVmElements(Collections.singletonList(dve));
vm.getDiskMap().put(newDisk.getId(), newDisk);
ValidateTestUtils.runAndAssertValidateFailure(command, EngineMessage.ACTION_TYPE_FAILED_EXCEEDED_MAX_IDE_SLOTS);
}
use of org.ovirt.engine.core.common.businessentities.storage.LunDisk in project ovirt-engine by oVirt.
the class AddDiskCommandTest method testIscsiLunDiskWithNoIqnCantBeAdded.
@Test
public void testIscsiLunDiskWithNoIqnCantBeAdded() {
LunDisk disk = createISCSILunDisk();
command.getParameters().setDiskInfo(disk);
disk.getLun().getLunConnections().get(0).setIqn(null);
assertFalse("checkIfLunDiskCanBeAdded() succeded for ISCSI lun which LUNs has storage_server_connection with a null iqn", command.checkIfLunDiskCanBeAdded(spyDiskValidator(disk)));
ValidateTestUtils.assertValidationMessages("checkIfLunDiskCanBeAdded() failed but correct can do action hasn't been added to the return response", command, EngineMessage.ACTION_TYPE_FAILED_DISK_LUN_ISCSI_MISSING_CONNECTION_PARAMS);
clearValidationMessages();
disk.getLun().getLunConnections().get(0).setIqn("");
assertFalse("checkIfLunDiskCanBeAdded() succeded for ISCSI lun which LUNs has storage_server_connection with an empty iqn", command.checkIfLunDiskCanBeAdded(spyDiskValidator(disk)));
ValidateTestUtils.assertValidationMessages("checkIfLunDiskCanBeAdded() failed but correct can do action hasn't been added to the return response", command, EngineMessage.ACTION_TYPE_FAILED_DISK_LUN_ISCSI_MISSING_CONNECTION_PARAMS);
}
use of org.ovirt.engine.core.common.businessentities.storage.LunDisk in project ovirt-engine by oVirt.
the class AddDiskCommandTest method testGetLunDiskFails.
@Test
public void testGetLunDiskFails() {
VDS vds = mockVds();
LunDisk disk = createISCSILunDisk();
List<LUNs> luns = Collections.emptyList();
initializeCommand(Guid.newGuid());
doReturn(luns).when(command).executeGetDeviceList(any(), any(), any());
assertNull(command.getLunDisk(disk.getLun(), vds));
}
Aggregations