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;
}
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));
}
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);
}
}
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);
}
}
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());
}
}
Aggregations