Search in sources :

Example 11 with DiskProfile

use of org.ovirt.engine.core.common.businessentities.profiles.DiskProfile in project ovirt-engine by oVirt.

the class DiskProfileDaoTest method generateNewEntity.

@Override
protected DiskProfile generateNewEntity() {
    DiskProfile diskProfile = new DiskProfile();
    diskProfile.setId(Guid.newGuid());
    diskProfile.setName("new_profile");
    diskProfile.setStorageDomainId(FixturesTool.STORAGE_DOMAIN_SCALE_SD5);
    diskProfile.setQosId(FixturesTool.QOS_ID_1);
    return diskProfile;
}
Also used : DiskProfile(org.ovirt.engine.core.common.businessentities.profiles.DiskProfile)

Example 12 with DiskProfile

use of org.ovirt.engine.core.common.businessentities.profiles.DiskProfile in project ovirt-engine by oVirt.

the class EntityDaoImplTest method testGetEntityNameByIdAndTypeForDiskProfile.

@Test
public void testGetEntityNameByIdAndTypeForDiskProfile() {
    DiskProfile diskProfile = diskProfileDao.get(FixturesTool.DISK_PROFILE_1);
    assertNotNull(diskProfile);
    String name = diskProfile.getName();
    assertEquals(name, underTest.getEntityNameByIdAndType(FixturesTool.DISK_PROFILE_1, VdcObjectType.DiskProfile));
}
Also used : DiskProfile(org.ovirt.engine.core.common.businessentities.profiles.DiskProfile) Test(org.junit.Test)

Example 13 with DiskProfile

use of org.ovirt.engine.core.common.businessentities.profiles.DiskProfile in project ovirt-engine by oVirt.

the class DisksAllocationModel method updateImageToDestinationDomainMap.

private void updateImageToDestinationDomainMap() {
    if (disks == null) {
        return;
    }
    for (DiskModel diskModel : disks) {
        StorageDomain storageDomain = diskModel.getStorageDomain().getSelectedItem();
        DiskImage diskImage = (DiskImage) diskModel.getDisk();
        diskImage.setStorageIds(new ArrayList<>(Collections.singletonList(storageDomain.getId())));
        diskImage.setDiskAlias(diskModel.getAlias().getEntity());
        DiskProfile diskProfile = diskModel.getDiskProfile().getSelectedItem();
        diskImage.setDiskProfileId(diskProfile != null ? diskProfile.getId() : null);
        if (diskModel.getQuota().getSelectedItem() != null) {
            diskImage.setQuotaId(diskModel.getQuota().getSelectedItem().getId());
        }
        if (diskModel.getVolumeFormat().getIsAvailable()) {
            VolumeFormat volumeFormat = diskModel.getVolumeFormat().getSelectedItem();
            diskImage.setVolumeFormat(volumeFormat);
            diskImage.setVolumeType(AsyncDataProvider.getInstance().getVolumeType(volumeFormat, storageDomain.getStorageType()));
        } else if (diskModel.getVolumeType().getIsAvailable()) {
            VolumeType volumeType = diskModel.getVolumeType().getSelectedItem();
            diskImage.setVolumeType(volumeType);
            diskImage.setVolumeFormat(AsyncDataProvider.getInstance().getDiskVolumeFormat(volumeType, storageDomain.getStorageType()));
        }
        imageToDestinationDomainMap.put(diskImage.getId(), diskImage);
    }
}
Also used : DiskModel(org.ovirt.engine.ui.uicommonweb.models.vms.DiskModel) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) VolumeFormat(org.ovirt.engine.core.common.businessentities.storage.VolumeFormat) VolumeType(org.ovirt.engine.core.common.businessentities.storage.VolumeType) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) DiskProfile(org.ovirt.engine.core.common.businessentities.profiles.DiskProfile)

Example 14 with DiskProfile

use of org.ovirt.engine.core.common.businessentities.profiles.DiskProfile in project ovirt-engine by oVirt.

the class AbstractDiskModel method setDiskProfilesList.

private void setDiskProfilesList(List<DiskProfile> diskProfiles) {
    // set disk profiles
    if (diskProfiles != null && !diskProfiles.isEmpty()) {
        getDiskProfile().setItems(diskProfiles);
    }
    // handle disk profile selected item
    Guid defaultProfileId = (getDisk() != null && !getIsNew() && getDisk().getDiskStorageType() == DiskStorageType.IMAGE) ? ((DiskImage) getDisk()).getDiskProfileId() : null;
    if (defaultProfileId != null) {
        for (DiskProfile profile : diskProfiles) {
            if (profile.getId().equals(defaultProfileId)) {
                getDiskProfile().setSelectedItem(profile);
                return;
            }
        }
        // set dummy disk profile (if not fetched because of permissions, and it's attached to disk.
        DiskProfile diskProfile = new DiskProfile();
        diskProfile.setId(defaultProfileId);
        if (getDisk() != null) {
            diskProfile.setName(getDiskImage().getDiskProfileName());
        }
        diskProfiles.add(diskProfile);
        getDiskProfile().setItems(diskProfiles);
        getDiskProfile().setSelectedItem(diskProfile);
    }
}
Also used : Guid(org.ovirt.engine.core.compat.Guid) DiskProfile(org.ovirt.engine.core.common.businessentities.profiles.DiskProfile)

Example 15 with DiskProfile

use of org.ovirt.engine.core.common.businessentities.profiles.DiskProfile in project ovirt-engine by oVirt.

the class DiskProfileDaoTest method checkResults.

private void checkResults(List<DiskProfile> result) {
    assertNotNull(result);
    assertEquals(2, result.size());
    for (DiskProfile diskProfile : result) {
        assertEquals(FixturesTool.STORAGE_DOMAIN_SCALE_SD5, diskProfile.getStorageDomainId());
    }
}
Also used : DiskProfile(org.ovirt.engine.core.common.businessentities.profiles.DiskProfile)

Aggregations

DiskProfile (org.ovirt.engine.core.common.businessentities.profiles.DiskProfile)19 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)7 Guid (org.ovirt.engine.core.compat.Guid)7 ArrayList (java.util.ArrayList)5 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)5 HashMap (java.util.HashMap)3 List (java.util.List)3 ValidationResult (org.ovirt.engine.core.bll.ValidationResult)3 DiskModel (org.ovirt.engine.ui.uicommonweb.models.vms.DiskModel)3 Arrays (java.util.Arrays)2 HashSet (java.util.HashSet)2 Test (org.junit.Test)2 ActionGroup (org.ovirt.engine.core.common.businessentities.ActionGroup)2 StorageQos (org.ovirt.engine.core.common.businessentities.qos.StorageQos)2 DiskStorageType (org.ovirt.engine.core.common.businessentities.storage.DiskStorageType)2 Collection (java.util.Collection)1 Collections (java.util.Collections)1 Map (java.util.Map)1 Entry (java.util.Map.Entry)1 Optional (java.util.Optional)1