use of org.ovirt.engine.core.common.businessentities.storage.DiskImage in project ovirt-engine by oVirt.
the class StorageDomainModel method getDisksModels.
public ArrayList<DiskModel> getDisksModels() {
ArrayList<DiskModel> diskModels = new ArrayList<>();
for (DiskImage diskImage : getDisks()) {
DiskModel diskModel = new DiskModel();
diskModel.setDisk(diskImage);
ListModel<StorageDomain> storageDomain = new ListModel<>();
storageDomain.setSelectedItem(getStorageDomain());
diskModel.setStorageDomain(storageDomain);
diskModels.add(diskModel);
}
return diskModels;
}
use of org.ovirt.engine.core.common.businessentities.storage.DiskImage in project ovirt-engine by oVirt.
the class UploadImageModel method flush.
public boolean flush() {
if (validate()) {
diskModel.flush();
DiskImage diskImage = (DiskImage) getDiskModel().getDisk();
diskImage.setActualSizeInBytes(getImageSize());
diskImage.setVolumeFormat(getImageInfoModel().getFormat());
diskImage.setVolumeType(AsyncDataProvider.getInstance().getVolumeType(diskImage.getVolumeFormat(), getDiskModel().getStorageDomain().getSelectedItem().getStorageType()));
diskImage.setContentType(getImageInfoModel().getContentType());
if (getImageInfoModel().getContentType() == DiskContentType.ISO) {
diskImage.setSize(getImageSize());
}
return true;
} else {
setIsValid(false);
}
return false;
}
use of org.ovirt.engine.core.common.businessentities.storage.DiskImage in project ovirt-engine by oVirt.
the class AbstractDiskModel method updateQuota.
private void updateQuota(StoragePool datacenter) {
if (datacenter.getQuotaEnforcementType().equals(QuotaEnforcementTypeEnum.DISABLED) || !getDiskStorageType().getEntity().isInternal()) {
getQuota().setIsAvailable(false);
return;
}
getQuota().setIsAvailable(true);
StorageDomain storageDomain = getStorageDomain().getSelectedItem();
if (storageDomain == null) {
return;
}
final Guid diskQuota = getDisk() != null ? ((DiskImage) getDisk()).getQuotaId() : null;
final Guid vmQuota = getVm() != null ? getVm().getQuotaId() : null;
final Guid defaultQuota = diskQuota != null ? diskQuota : vmQuota;
AsyncDataProvider.getInstance().getAllRelevantQuotasForStorageSorted(new AsyncQuery<>(quotaList -> {
if (quotaList != null && !quotaList.isEmpty()) {
getQuota().setItems(quotaList);
// If list contains default quota, return
if (quotaList.get(0).getId().equals(defaultQuota)) {
return;
}
}
if (diskQuota != null) {
Quota quota = new Quota();
quota.setId(diskQuota);
quota.setQuotaName(getDiskImage().getQuotaName());
if (quotaList == null) {
quotaList = new ArrayList<>();
}
quotaList.add(quota);
getQuota().setItems(quotaList);
getQuota().setSelectedItem(quota);
}
}), storageDomain.getId(), defaultQuota);
}
use of org.ovirt.engine.core.common.businessentities.storage.DiskImage in project ovirt-engine by oVirt.
the class CopyDiskModel method onInitDisks.
@Override
protected void onInitDisks() {
ArrayList<DiskModel> disks = new ArrayList<>();
for (DiskImage disk : getDiskImages()) {
disks.add(DiskModel.diskToModel(disk));
}
setDisks(disks);
initStorageDomains();
}
use of org.ovirt.engine.core.common.businessentities.storage.DiskImage in project ovirt-engine by oVirt.
the class TemplateDiskListModel method changeQuota.
private void changeQuota() {
ArrayList<DiskImage> disks = (ArrayList<DiskImage>) getSelectedItems();
if (disks == null || getWindow() != null) {
return;
}
ChangeQuotaModel model = new ChangeQuotaModel();
setWindow(model);
model.setTitle(ConstantsManager.getInstance().getConstants().assignQuotaForDisk());
model.setHelpTag(HelpTag.change_quota_disks);
// $NON-NLS-1$
model.setHashName("change_quota_disks");
model.startProgress();
model.init(disks);
// $NON-NLS-1$
model.getCommands().add(UICommand.createDefaultOkUiCommand("onChangeQuota", this));
// $NON-NLS-1$
model.getCommands().add(UICommand.createCancelUiCommand("Cancel", this));
}
Aggregations