use of org.ovirt.engine.core.common.businessentities.StoragePool in project ovirt-engine by oVirt.
the class AbstractDiskModel method validate.
public boolean validate() {
getDescription().validateEntity(new IValidation[] { new SpecialAsciiI18NOrNoneValidation(), new LengthValidation(BusinessEntitiesDefinitions.DISK_DESCRIPTION_MAX_SIZE) });
getAlias().validateEntity(getDiskAliasValidations());
StoragePool dataCenter = getDataCenter().getSelectedItem();
if (dataCenter != null && dataCenter.getQuotaEnforcementType() == QuotaEnforcementTypeEnum.HARD_ENFORCEMENT) {
getQuota().validateSelectedItem(new IValidation[] { new NotEmptyQuotaValidation() });
}
if (getCinderVolumeType().getIsAvailable()) {
getCinderVolumeType().validateSelectedItem(new IValidation[] { new NotEmptyValidation() });
}
return getAlias().getIsValid() && getDescription().getIsValid() && getQuota().getIsValid() && getDiskInterface().getIsValid() && getCinderVolumeType().getIsValid();
}
use of org.ovirt.engine.core.common.businessentities.StoragePool 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.StoragePool 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.StoragePool in project ovirt-engine by oVirt.
the class StorageModel method updateHost.
void updateHost() {
if (getDataCenter().getItems() == null) {
return;
}
if (getCurrentStorageItem() == null) {
return;
}
StoragePool dataCenter = getDataCenter().getSelectedItem();
boolean localFsOnly = getCurrentStorageItem() instanceof LocalStorageModel;
Guid dataCenterId = dataCenter == null ? null : dataCenter.getId();
AsyncDataProvider.getInstance().getHostsForStorageOperation(new AsyncQuery<>(this::postUpdateHost), dataCenterId, localFsOnly);
}
use of org.ovirt.engine.core.common.businessentities.StoragePool in project ovirt-engine by oVirt.
the class StoragePopupView method initListBoxEditors.
@SuppressWarnings({ "unchecked", "rawtypes" })
void initListBoxEditors() {
datacenterListEditor = new ListModelListBoxEditor<>(new AbstractRenderer<StoragePool>() {
@Override
public String render(StoragePool storage) {
// $NON-NLS-1$
String formattedString = "";
if (storage != null) {
// Get formatted storage type and format using Enum renders
// $NON-NLS-1$
String storageType = storage.isLocal() ? constants.storageTypeLocal() : "";
String storageFormatType = // $NON-NLS-1$
storage.getStoragePoolFormatType() == null ? // $NON-NLS-1$
"" : new EnumRenderer<StorageFormatType>().render(storage.getStoragePoolFormatType());
// Add storage type and format if available
if (!storageType.isEmpty() || !storageFormatType.isEmpty()) {
// $NON-NLS-1$
formattedString = " (";
if (storage.isLocal()) {
formattedString += storageType;
} else {
formattedString += storageFormatType;
}
// $NON-NLS-1$
formattedString += ")";
}
formattedString = storage.getName() + formattedString;
}
return formattedString;
}
});
formatListEditor = new ListModelListBoxEditor<>(new EnumRenderer());
hostListEditor = new ListModelListBoxEditor<>(new NameRenderer<VDS>());
domainFunctionListEditor = new ListModelListBoxEditor<>(new EnumRenderer<StorageDomainType>());
storageTypeListEditor = new ListModelListBoxEditor<>(new EnumRenderer<StorageType>());
activateDomainEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
wipeAfterDeleteEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
backup = new EntityModelCheckBoxEditor(Align.RIGHT);
discardAfterDeleteEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
}
Aggregations