use of org.ovirt.engine.core.common.businessentities.profiles.DiskProfile in project ovirt-engine by oVirt.
the class DisksAllocationModel method setDiskProfilesList.
private void setDiskProfilesList(final ListModel<DiskProfile> diskProfiles, List<DiskProfile> fetchedDiskProfiles) {
if (fetchedDiskProfiles != null) {
// normal flow, set items and selected item according to current selected.
if (diskProfiles == null) {
for (DiskModel diskModel : getDisks()) {
diskModel.getDiskProfile().setItems(fetchedDiskProfiles);
for (DiskProfile diskProfile : fetchedDiskProfiles) {
if (diskModel.getDisk().getDiskStorageType() == DiskStorageType.IMAGE && diskProfile.getId().equals(((DiskImage) diskModel.getDisk()).getDiskProfileId())) {
diskModel.getDiskProfile().setSelectedItem(diskProfile);
}
}
}
// inner model disk profiles
} else {
DiskProfile selectedDiskProfile = null;
if (diskProfiles.getSelectedItem() != null) {
selectedDiskProfile = diskProfiles.getSelectedItem();
}
diskProfiles.setItems(fetchedDiskProfiles);
if (selectedDiskProfile != null && fetchedDiskProfiles.size() > 1) {
for (DiskProfile diskProfile : fetchedDiskProfiles) {
if (diskProfile.getId().equals(selectedDiskProfile.getId())) {
diskProfiles.setSelectedItem(diskProfile);
break;
}
}
}
}
}
}
use of org.ovirt.engine.core.common.businessentities.profiles.DiskProfile in project ovirt-engine by oVirt.
the class MoveOrCopyDiskModel method getParameters.
protected ArrayList<ActionParametersBase> getParameters() {
ArrayList<ActionParametersBase> parameters = new ArrayList<>();
for (DiskModel diskModel : getDisks()) {
StorageDomain destStorageDomain = diskModel.getStorageDomain().getSelectedItem();
StorageDomain sourceStorageDomain = diskModel.getSourceStorageDomain().getSelectedItem();
Guid sourceStorageDomainGuid = sourceStorageDomain != null ? sourceStorageDomain.getId() : Guid.Empty;
DiskImage disk = (DiskImage) diskModel.getDisk();
DiskProfile diskProfile = diskModel.getDiskProfile().getSelectedItem();
disk.setDiskProfileId(diskProfile != null ? diskProfile.getId() : null);
disk.setDiskAlias(diskModel.getAlias().getEntity());
if (diskModel.getQuota().getSelectedItem() != null) {
disk.setQuotaId(diskModel.getQuota().getSelectedItem().getId());
}
if (destStorageDomain == null || sourceStorageDomain == null) {
continue;
}
Guid destStorageDomainGuid = destStorageDomain.getId();
addMoveOrCopyParameters(parameters, sourceStorageDomainGuid, destStorageDomainGuid, disk);
}
return parameters;
}
use of org.ovirt.engine.core.common.businessentities.profiles.DiskProfile in project ovirt-engine by oVirt.
the class DiskProfileBaseModel method flush.
@Override
public void flush() {
if (getProfile() == null) {
setProfile(new DiskProfile());
}
DiskProfile diskProfile = getProfile();
diskProfile.setName(getName().getEntity());
diskProfile.setDescription(getDescription().getEntity());
StorageDomain storageDomain = getParentListModel().getSelectedItem();
diskProfile.setStorageDomainId(storageDomain != null ? storageDomain.getId() : null);
StorageQos storageQos = getQos().getSelectedItem();
diskProfile.setQosId(storageQos != null && storageQos.getId() != null && !storageQos.getId().equals(Guid.Empty) ? storageQos.getId() : null);
}
use of org.ovirt.engine.core.common.businessentities.profiles.DiskProfile in project ovirt-engine by oVirt.
the class DiskProfileHelper method updateDiskProfileForBackwardCompatibility.
private boolean updateDiskProfileForBackwardCompatibility(DiskImage diskImage, List<DiskProfile> diskProfilesList, Set<Guid> permittedDiskProfilesIds, DbUser user) {
for (DiskProfile diskProfile : diskProfilesList) {
if (isDiskProfilePermitted(diskProfile, permittedDiskProfilesIds, user)) {
permittedDiskProfilesIds.add(diskProfile.getId());
diskImage.setDiskProfileId(diskProfile.getId());
return true;
}
}
return false;
}
use of org.ovirt.engine.core.common.businessentities.profiles.DiskProfile in project ovirt-engine by oVirt.
the class DiskProfileHelper method createDiskProfile.
public DiskProfile createDiskProfile(Guid storageDomainId, String name) {
DiskProfile profile = new DiskProfile();
profile.setId(Guid.newGuid());
profile.setName(name);
profile.setStorageDomainId(storageDomainId);
return profile;
}
Aggregations