use of org.ovirt.engine.core.common.businessentities.storage.LunDisk in project ovirt-engine by oVirt.
the class AddDiskCommandTest method testAddingPCILunExceedsSlotLimit.
@Test
public void testAddingPCILunExceedsSlotLimit() {
mockInterfaceList();
LunDisk disk = createISCSILunDisk();
command.getParameters().setDiskInfo(disk);
command.getParameters().getDiskVmElement().setDiskInterface(DiskInterface.VirtIO);
VM vm = mockVm();
mockMaxPciSlots();
// use maximum slots for PCI. validate expected to succeed.
mockOtherVmDisks(vm, MAX_PCI_SLOTS - 2, DiskInterface.VirtIO);
ValidateTestUtils.runAndAssertValidateSuccess(command);
LunDisk newDisk = createISCSILunDisk();
DiskVmElement dve = new DiskVmElement(disk.getId(), vmId);
dve.setDiskInterface(DiskInterface.VirtIO);
newDisk.setDiskVmElements(Collections.singletonList(dve));
vm.getDiskMap().put(newDisk.getId(), newDisk);
ValidateTestUtils.runAndAssertValidateFailure(command, EngineMessage.ACTION_TYPE_FAILED_EXCEEDED_MAX_PCI_SLOTS);
}
use of org.ovirt.engine.core.common.businessentities.storage.LunDisk in project ovirt-engine by oVirt.
the class AddDiskCommandTest method createISCSILunDisk.
private LunDisk createISCSILunDisk(ScsiGenericIO sgio) {
LunDisk disk = createISCSILunDisk();
disk.setSgio(sgio);
return disk;
}
use of org.ovirt.engine.core.common.businessentities.storage.LunDisk in project ovirt-engine by oVirt.
the class AddDiskCommandTest method testLunDiskValid.
@Test
public void testLunDiskValid() {
VDS vds = mockVds();
LunDisk disk = createISCSILunDisk();
command.getParameters().setDiskInfo(disk);
command.getParameters().setVdsId(vds.getId());
command.setVds(vds);
mockVm();
mockMaxPciSlots();
mockInterfaceList();
List<LUNs> luns = Collections.singletonList(disk.getLun());
doReturn(luns).when(command).executeGetDeviceList(any(), any(), any());
ValidateTestUtils.runAndAssertValidateSuccess(command);
}
use of org.ovirt.engine.core.common.businessentities.storage.LunDisk in project ovirt-engine by oVirt.
the class AddDiskCommandTest method testIscsiLunCanBeAddedIfScsiPassthroughEnabledAndScsiReservationEnabled.
@Test
public void testIscsiLunCanBeAddedIfScsiPassthroughEnabledAndScsiReservationEnabled() {
LunDisk disk = createISCSILunDisk(ScsiGenericIO.UNFILTERED);
command.getParameters().setDiskInfo(disk);
command.getParameters().getDiskVmElement().setUsingScsiReservation(true);
mockVm();
mockInterfaceList();
assertTrue("Failed to add Lun disk when scsi passthrough and scsi reservation are enabled", command.checkIfLunDiskCanBeAdded(spyDiskValidator(disk)));
}
use of org.ovirt.engine.core.common.businessentities.storage.LunDisk in project ovirt-engine by oVirt.
the class AddDiskCommandTest method testUnknownTypeLunCantBeAdded.
@Test
public void testUnknownTypeLunCantBeAdded() {
LunDisk disk = createISCSILunDisk();
command.getParameters().setDiskInfo(disk);
disk.getLun().setLunType(StorageType.UNKNOWN);
assertFalse("checkIfLunDiskCanBeAdded() succeded for LUN with UNKNOWN type", 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_HAS_NO_VALID_TYPE);
}
Aggregations