Search in sources :

Example 11 with CinderDisk

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

the class CinderDisksValidator method initializeVolumeProviderProxyMap.

private Map<Guid, OpenStackVolumeProviderProxy> initializeVolumeProviderProxyMap() {
    if (diskProxyMap == null) {
        diskProxyMap = new HashMap<>();
        for (CinderDisk cinderDisk : cinderDisks) {
            OpenStackVolumeProviderProxy volumeProviderProxy = getVolumeProviderProxy(cinderDisk);
            diskProxyMap.put(cinderDisk.getId(), volumeProviderProxy);
        }
    }
    return diskProxyMap;
}
Also used : CinderDisk(org.ovirt.engine.core.common.businessentities.storage.CinderDisk) OpenStackVolumeProviderProxy(org.ovirt.engine.core.bll.provider.storage.OpenStackVolumeProviderProxy)

Example 12 with CinderDisk

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

the class DisksFilterTest method testFilterNonImageDisks.

@Test
public void testFilterNonImageDisks() {
    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<DiskImage> filteredList = DisksFilter.filterImageDisks(disksList);
    assertEquals(1, filteredList.size());
    assertThat(filteredList, containsInAnyOrder(imageDisk));
}
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) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) Test(org.junit.Test)

Example 13 with CinderDisk

use of org.ovirt.engine.core.common.businessentities.storage.CinderDisk 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 14 with CinderDisk

use of org.ovirt.engine.core.common.businessentities.storage.CinderDisk 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 15 with CinderDisk

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

the class AbstractGetDisksAndSnapshotsQueryTest method createCinderDisk.

private CinderDisk createCinderDisk() {
    CinderDisk cd = new CinderDisk();
    cd.setId(Guid.newGuid());
    cd.setActive(true);
    return cd;
}
Also used : CinderDisk(org.ovirt.engine.core.common.businessentities.storage.CinderDisk)

Aggregations

CinderDisk (org.ovirt.engine.core.common.businessentities.storage.CinderDisk)74 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)28 Guid (org.ovirt.engine.core.compat.Guid)19 LunDisk (org.ovirt.engine.core.common.businessentities.storage.LunDisk)15 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)14 Disk (org.ovirt.engine.core.common.businessentities.storage.Disk)13 ArrayList (java.util.ArrayList)12 ImagesContainterParametersBase (org.ovirt.engine.core.common.action.ImagesContainterParametersBase)9 ExecutionException (java.util.concurrent.ExecutionException)7 VM (org.ovirt.engine.core.common.businessentities.VM)6 HashMap (java.util.HashMap)5 List (java.util.List)5 ImageStatus (org.ovirt.engine.core.common.businessentities.storage.ImageStatus)5 Map (java.util.Map)4 Test (org.junit.Test)4 StoragePoolValidator (org.ovirt.engine.core.bll.validator.storage.StoragePoolValidator)4 Snapshot (org.ovirt.engine.core.common.businessentities.Snapshot)4 EngineException (org.ovirt.engine.core.common.errors.EngineException)4 Set (java.util.Set)3 Collectors (java.util.stream.Collectors)3