use of org.ovirt.engine.core.common.businessentities.profiles.DiskProfile in project ovirt-engine by oVirt.
the class DiskProfileHelper method updateDiskImageProfilesList.
/**
* Updates the disk profiles list of the given disk image according to the storageDomainID.
* The disk profiles list will be set with the first disk profile that matches the storage domain id.
*
* @param diskImage disk image to be updated with the relevant disk profiles list
* @param storageDomainId storage domain id to match a disk profile with
* @return valid disk profile in case there is a match with the given storage domain ID. otherwise return an
* invalid disk profile.
*/
private DiskProfile updateDiskImageProfilesList(DiskImage diskImage, Guid storageDomainId) {
DiskProfile diskProfile = null;
if (storageDomainId != null) {
List<Guid> diskProfileIds = diskImage.getDiskProfileIds();
List<DiskProfile> diskProfilesListByStorageDomain = diskProfileDao.getAllForStorageDomain(storageDomainId);
Optional<DiskProfile> match = diskProfilesListByStorageDomain.stream().filter(profile -> diskProfileIds.contains(profile.getId())).findFirst();
if (match.isPresent()) {
diskProfile = match.get();
diskImage.setDiskProfileIds(new ArrayList<Guid>(Arrays.asList(diskProfile.getId())));
}
}
return diskProfile;
}
use of org.ovirt.engine.core.common.businessentities.profiles.DiskProfile in project ovirt-engine by oVirt.
the class StorageDomainCommandBase method createDefaultDiskProfile.
/**
* Creates default disk profile for existing storage domain.
*/
protected void createDefaultDiskProfile() {
executeInNewTransaction(() -> {
final DiskProfile diskProfile = diskProfileHelper.createDiskProfile(getStorageDomain().getId(), getStorageDomainName());
DiskProfileParameters diskProfileParameters = new DiskProfileParameters(diskProfile, true);
runInternalActionWithTasksContext(ActionType.AddDiskProfile, diskProfileParameters);
getCompensationContext().snapshotNewEntity(diskProfile);
getCompensationContext().stateChanged();
return null;
});
}
use of org.ovirt.engine.core.common.businessentities.profiles.DiskProfile in project ovirt-engine by oVirt.
the class AbstractDiskModel method updateDiskProfiles.
private void updateDiskProfiles(StoragePool selectedItem) {
StorageDomain storageDomain = getStorageDomain().getSelectedItem();
if (storageDomain == null) {
return;
}
Frontend.getInstance().runQuery(QueryType.GetDiskProfilesByStorageDomainId, new IdQueryParameters(storageDomain.getId()), new AsyncQuery<QueryReturnValue>(value -> setDiskProfilesList((List<DiskProfile>) value.getReturnValue())));
}
use of org.ovirt.engine.core.common.businessentities.profiles.DiskProfile in project ovirt-engine by oVirt.
the class DiskProfilesListModelTable method updatePermissionPanel.
private void updatePermissionPanel() {
final DiskProfile diskProfile = getModel().getSelectedItem();
Scheduler.get().scheduleDeferred(() -> {
if (permissionListModelTable.isVisible() && diskProfile == null) {
permissionListModelTable.setVisible(false);
} else if (!permissionListModelTable.isVisible() && diskProfile != null) {
permissionListModelTable.setVisible(true);
}
});
}
use of org.ovirt.engine.core.common.businessentities.profiles.DiskProfile in project ovirt-engine by oVirt.
the class DiskProfileDaoTest method testGetByQos.
@Test
public void testGetByQos() {
List<DiskProfile> allForQos = dao.getAllForQos(FixturesTool.QOS_ID_1);
assertNotNull(allForQos);
assertEquals(2, allForQos.size());
for (DiskProfile diskProfile : allForQos) {
assertEquals(FixturesTool.QOS_ID_1, diskProfile.getQosId());
}
}
Aggregations