Search in sources :

Example 21 with LunDisk

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);
}
Also used : VM(org.ovirt.engine.core.common.businessentities.VM) DiskVmElement(org.ovirt.engine.core.common.businessentities.storage.DiskVmElement) LunDisk(org.ovirt.engine.core.common.businessentities.storage.LunDisk) Test(org.junit.Test) BaseCommandTest(org.ovirt.engine.core.bll.BaseCommandTest)

Example 22 with LunDisk

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;
}
Also used : LunDisk(org.ovirt.engine.core.common.businessentities.storage.LunDisk)

Example 23 with LunDisk

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);
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) LunDisk(org.ovirt.engine.core.common.businessentities.storage.LunDisk) LUNs(org.ovirt.engine.core.common.businessentities.storage.LUNs) Test(org.junit.Test) BaseCommandTest(org.ovirt.engine.core.bll.BaseCommandTest)

Example 24 with LunDisk

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)));
}
Also used : LunDisk(org.ovirt.engine.core.common.businessentities.storage.LunDisk) Test(org.junit.Test) BaseCommandTest(org.ovirt.engine.core.bll.BaseCommandTest)

Example 25 with LunDisk

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);
}
Also used : LunDisk(org.ovirt.engine.core.common.businessentities.storage.LunDisk) Test(org.junit.Test) BaseCommandTest(org.ovirt.engine.core.bll.BaseCommandTest)

Aggregations

LunDisk (org.ovirt.engine.core.common.businessentities.storage.LunDisk)62 Test (org.junit.Test)29 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)21 CinderDisk (org.ovirt.engine.core.common.businessentities.storage.CinderDisk)18 BaseCommandTest (org.ovirt.engine.core.bll.BaseCommandTest)16 Disk (org.ovirt.engine.core.common.businessentities.storage.Disk)13 LUNs (org.ovirt.engine.core.common.businessentities.storage.LUNs)13 VM (org.ovirt.engine.core.common.businessentities.VM)10 ArrayList (java.util.ArrayList)9 StorageServerConnections (org.ovirt.engine.core.common.businessentities.StorageServerConnections)7 Guid (org.ovirt.engine.core.compat.Guid)7 DiskVmElement (org.ovirt.engine.core.common.businessentities.storage.DiskVmElement)6 HashMap (java.util.HashMap)5 VDS (org.ovirt.engine.core.common.businessentities.VDS)5 StorageServerConnectionManagementVDSParameters (org.ovirt.engine.core.common.vdscommands.StorageServerConnectionManagementVDSParameters)5 HashSet (java.util.HashSet)3 FullEntityOvfData (org.ovirt.engine.core.common.businessentities.storage.FullEntityOvfData)3 StorageType (org.ovirt.engine.core.common.businessentities.storage.StorageType)3 ImageResource (com.google.gwt.resources.client.ImageResource)2 List (java.util.List)2