Search in sources :

Example 16 with LunDisk

use of org.ovirt.engine.core.common.businessentities.storage.LunDisk in project ovirt-engine by oVirt.

the class DisksFilterTest method createDisk.

private Disk createDisk(DiskStorageType type, boolean isActive, boolean isShareable, boolean isSnapable, boolean isPlugged) {
    Disk disk = null;
    switch(type) {
        case IMAGE:
            disk = new DiskImage();
            setDiskImageProperties((DiskImage) disk, isActive, isShareable, isSnapable);
            break;
        case LUN:
            if (isSnapable) {
                throw new IllegalArgumentException("A LUN disk cannot be snapable");
            }
            disk = new LunDisk();
            break;
        case CINDER:
            disk = new CinderDisk();
            setDiskImageProperties((DiskImage) disk, isActive, isShareable, isSnapable);
            break;
    }
    disk.setPlugged(isPlugged);
    return disk;
}
Also used : CinderDisk(org.ovirt.engine.core.common.businessentities.storage.CinderDisk) CinderDisk(org.ovirt.engine.core.common.businessentities.storage.CinderDisk) LunDisk(org.ovirt.engine.core.common.businessentities.storage.LunDisk) Disk(org.ovirt.engine.core.common.businessentities.storage.Disk) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) LunDisk(org.ovirt.engine.core.common.businessentities.storage.LunDisk)

Example 17 with LunDisk

use of org.ovirt.engine.core.common.businessentities.storage.LunDisk in project ovirt-engine by oVirt.

the class DisksFilterTest method testFilterNonCinderDisks.

@Test
public void testFilterNonCinderDisks() {
    Disk lunDisk = createDisk(DiskStorageType.LUN, false, false, false, false);
    Disk imageDisk = createDisk(DiskStorageType.IMAGE, false, false, true, false);
    Disk cinderDisk = createDisk(DiskStorageType.CINDER, false, false, true, false);
    List<Disk> disksList = Arrays.asList(lunDisk, imageDisk, cinderDisk);
    List<CinderDisk> filteredList = DisksFilter.filterCinderDisks(disksList);
    assertEquals(1, filteredList.size());
    assertThat(filteredList, containsInAnyOrder(cinderDisk));
}
Also used : CinderDisk(org.ovirt.engine.core.common.businessentities.storage.CinderDisk) CinderDisk(org.ovirt.engine.core.common.businessentities.storage.CinderDisk) LunDisk(org.ovirt.engine.core.common.businessentities.storage.LunDisk) Disk(org.ovirt.engine.core.common.businessentities.storage.Disk) Test(org.junit.Test)

Example 18 with LunDisk

use of org.ovirt.engine.core.common.businessentities.storage.LunDisk in project ovirt-engine by oVirt.

the class AddDiskCommandTest method createISCSILunDisk.

private static LunDisk createISCSILunDisk() {
    LunDisk disk = new LunDisk();
    LUNs lun = new LUNs();
    lun.setLUNId("lunid");
    lun.setLunType(StorageType.ISCSI);
    StorageServerConnections connection = new StorageServerConnections();
    connection.setIqn("a");
    connection.setConnection("0.0.0.0");
    connection.setPort("1234");
    ArrayList<StorageServerConnections> connections = new ArrayList<>();
    connections.add(connection);
    lun.setLunConnections(connections);
    disk.setLun(lun);
    disk.setId(Guid.newGuid());
    return disk;
}
Also used : StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) ArrayList(java.util.ArrayList) LunDisk(org.ovirt.engine.core.common.businessentities.storage.LunDisk) LUNs(org.ovirt.engine.core.common.businessentities.storage.LUNs)

Example 19 with LunDisk

use of org.ovirt.engine.core.common.businessentities.storage.LunDisk in project ovirt-engine by oVirt.

the class AddDiskCommandTest method testIscsiLunDiskWithNoAddressCantBeAdded.

@Test
public void testIscsiLunDiskWithNoAddressCantBeAdded() {
    LunDisk disk = createISCSILunDisk();
    command.getParameters().setDiskInfo(disk);
    disk.getLun().getLunConnections().get(0).setConnection(null);
    assertFalse("checkIfLunDiskCanBeAdded() succeded for ISCSI lun which LUNs has storage_server_connection with a null address", 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).setConnection("");
    assertFalse("checkIfLunDiskCanBeAdded() succeded for ISCSI lun which LUNs has storage_server_connection with a empty address", 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);
}
Also used : LunDisk(org.ovirt.engine.core.common.businessentities.storage.LunDisk) Test(org.junit.Test) BaseCommandTest(org.ovirt.engine.core.bll.BaseCommandTest)

Example 20 with LunDisk

use of org.ovirt.engine.core.common.businessentities.storage.LunDisk in project ovirt-engine by oVirt.

the class GetDiskAndSnapshotsByDiskIdQueryTest method testQueryWithLunDisk.

@Test
public void testQueryWithLunDisk() {
    Disk disk = executeQuery(lunDisk);
    assertTrue("disk should be from type LunDisk", disk instanceof LunDisk);
}
Also used : CinderDisk(org.ovirt.engine.core.common.businessentities.storage.CinderDisk) LunDisk(org.ovirt.engine.core.common.businessentities.storage.LunDisk) Disk(org.ovirt.engine.core.common.businessentities.storage.Disk) LunDisk(org.ovirt.engine.core.common.businessentities.storage.LunDisk) Test(org.junit.Test)

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