use of org.ovirt.engine.core.common.businessentities.StorageDomain in project ovirt-engine by oVirt.
the class NewDiskModel method store.
@Override
public void store(IFrontendActionAsyncCallback callback) {
if (getProgress() != null || !validate()) {
return;
}
startProgress();
AddDiskParameters parameters = new AddDiskParameters(getDiskVmElement(), getDisk());
parameters.setPlugDiskToVm(getIsPlugged().getEntity());
if (getDiskStorageType().getEntity() == DiskStorageType.IMAGE || getDiskStorageType().getEntity() == DiskStorageType.CINDER) {
StorageDomain storageDomain = getStorageDomain().getSelectedItem();
parameters.setStorageDomainId(storageDomain.getId());
}
IFrontendActionAsyncCallback onFinished = callback != null ? callback : result -> {
NewDiskModel diskModel = (NewDiskModel) result.getState();
diskModel.stopProgress();
diskModel.cancel();
postSave();
};
Frontend.getInstance().runAction(ActionType.AddDisk, parameters, onFinished, this);
}
use of org.ovirt.engine.core.common.businessentities.StorageDomain in project ovirt-engine by oVirt.
the class ExistingPoolModelBehavior method postInitStorageDomains.
@Override
protected void postInitStorageDomains() {
ArrayList<DiskModel> disks = (ArrayList<DiskModel>) getModel().getDisks();
if (disks == null) {
return;
}
ActionGroup actionGroup = getModel().isCreateInstanceOnly() ? ActionGroup.CREATE_INSTANCE : ActionGroup.CREATE_VM;
StoragePool dataCenter = getModel().getSelectedDataCenter();
AsyncDataProvider.getInstance().getPermittedStorageDomainsByStoragePoolId(asyncQuery(storageDomains -> {
ArrayList<DiskModel> disks1 = (ArrayList<DiskModel>) getModel().getDisks();
ArrayList<StorageDomain> activeStorageDomains = filterStorageDomains(storageDomains);
DisksAllocationModel disksAllocationModel = getModel().getDisksAllocationModel();
disksAllocationModel.setActiveStorageDomains(activeStorageDomains);
getModel().getStorageDomain().setItems(activeStorageDomains);
for (DiskModel diskModel : disks1) {
// Setting Quota
diskModel.getQuota().setItems(getModel().getQuota().getItems());
diskModel.getQuota().setIsChangeable(false);
List<Guid> storageIds = ((DiskImage) diskModel.getDisk()).getStorageIds();
for (DiskImage disk : pool.getDiskList()) {
if (diskModel.getDisk() instanceof DiskImage && ((DiskImage) diskModel.getDisk()).getImageId().equals(disk.getImageTemplateId())) {
storageIds = new ArrayList<>(disk.getStorageIds());
break;
}
}
if (storageIds == null || storageIds.size() == 0) {
continue;
}
Guid storageId = storageIds.get(0);
StorageDomain storageDomain = activeStorageDomains.stream().filter(new Linq.IdPredicate<>(storageId)).findFirst().orElse(null);
List<StorageDomain> diskStorageDomains = new ArrayList<>();
diskStorageDomains.add(storageDomain);
diskModel.getStorageDomain().setItems(diskStorageDomains);
diskModel.getStorageDomain().setIsChangeable(false);
}
}), dataCenter.getId(), actionGroup);
getModel().getDisksAllocationModel().initializeAutoSelectTarget(false, actualPool.isAutoStorageSelect());
}
use of org.ovirt.engine.core.common.businessentities.StorageDomain in project ovirt-engine by oVirt.
the class DataCenterModule method getDataCenterStorageListProvider.
// Search-able Detail Models
@Provides
@Singleton
public SearchableDetailModelProvider<StorageDomain, DataCenterListModel, DataCenterStorageListModel> getDataCenterStorageListProvider(EventBus eventBus, Provider<DefaultConfirmationPopupPresenterWidget> defaultConfirmPopupProvider, final Provider<FindSingleStoragePopupPresenterWidget> singlePopupProvider, final Provider<FindMultiStoragePopupPresenterWidget> multiPopupProvider, final Provider<RemoveConfirmationPopupPresenterWidget> removeConfirmPopupProvider, final Provider<DataCenterListModel> mainModelProvider, final Provider<DataCenterStorageListModel> modelProvider) {
SearchableDetailTabModelProvider<StorageDomain, DataCenterListModel, DataCenterStorageListModel> result = new SearchableDetailTabModelProvider<StorageDomain, DataCenterListModel, DataCenterStorageListModel>(eventBus, defaultConfirmPopupProvider) {
@Override
public AbstractModelBoundPopupPresenterWidget<? extends Model, ?> getModelPopup(DataCenterStorageListModel source, UICommand lastExecutedCommand, Model windowModel) {
DataCenterStorageListModel model = getModel();
if (lastExecutedCommand == model.getAttachStorageCommand()) {
return multiPopupProvider.get();
} else if (lastExecutedCommand == model.getAttachISOCommand() || lastExecutedCommand == model.getAttachBackupCommand()) {
return singlePopupProvider.get();
} else {
return super.getModelPopup(source, lastExecutedCommand, windowModel);
}
}
@Override
public AbstractModelBoundPopupPresenterWidget<? extends ConfirmationModel, ?> getConfirmModelPopup(DataCenterStorageListModel source, UICommand lastExecutedCommand) {
if (lastExecutedCommand == getModel().getDetachCommand() || lastExecutedCommand.getName().equals("OnAttach")) {
// $NON-NLS-1$ ) {
return removeConfirmPopupProvider.get();
} else if (lastExecutedCommand == getModel().getMaintenanceCommand() || lastExecutedCommand.getName().equals("OnMaintenance")) {
// $NON-NLS-1$) {
return removeConfirmPopupProvider.get();
} else {
return super.getConfirmModelPopup(source, lastExecutedCommand);
}
}
};
result.setMainModelProvider(mainModelProvider);
result.setModelProvider(modelProvider);
return result;
}
use of org.ovirt.engine.core.common.businessentities.StorageDomain in project ovirt-engine by oVirt.
the class SubTabStorageDataCenterView method initTable.
void initTable() {
getTable().enableColumnResizing();
StorageDomainStatusColumn statusColumn = new StorageDomainStatusColumn();
statusColumn.setContextMenuTitle(constants.statusStorageDc());
// $NON-NLS-1$
getTable().addColumn(statusColumn, constants.empty(), "30px");
AbstractTextColumn<StorageDomain> nameColumn = new AbstractLinkColumn<StorageDomain>(new FieldUpdater<StorageDomain, String>() {
@Override
public void update(int index, StorageDomain storageDomain, String value) {
Map<String, String> parameters = new HashMap<>();
parameters.put(FragmentParams.NAME.getName(), storageDomain.getStoragePoolName());
getPlaceTransitionHandler().handlePlaceTransition(WebAdminApplicationPlaces.dataCenterStorageSubTabPlace, parameters);
}
}) {
@Override
public String getValue(StorageDomain object) {
return object.getStoragePoolName();
}
};
nameColumn.makeSortable();
// $NON-NLS-1$
getTable().addColumn(nameColumn, constants.nameDc(), "600px");
AbstractTextColumn<StorageDomain> domainStatusColumn = new AbstractEnumColumn<StorageDomain, StorageDomainStatus>() {
@Override
protected StorageDomainStatus getRawValue(StorageDomain object) {
return object.getStatus();
}
};
domainStatusColumn.makeSortable();
// $NON-NLS-1$
getTable().addColumn(domainStatusColumn, constants.domainStatusInDcStorageDc(), "300px");
}
use of org.ovirt.engine.core.common.businessentities.StorageDomain in project ovirt-engine by oVirt.
the class DiskValidator method isSparsifySupported.
public ValidationResult isSparsifySupported() {
if (disk.getDiskStorageType() != DiskStorageType.IMAGE) {
return new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_DISK_SPARSIFY_NOT_SUPPORTED_BY_DISK_STORAGE_TYPE, getDiskAliasVarReplacement(), ReplacementUtils.createSetVariableString("diskStorageType", disk.getDiskStorageType()));
}
if (((DiskImage) disk).getImage().getVolumeType() == VolumeType.Preallocated) {
return new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_DISK_SPARSIFY_NOT_SUPPORTED_FOR_PREALLOCATED, getDiskAliasVarReplacement());
}
StorageDomain diskStorageDomain = Injector.get(StorageDomainDao.class).get(((DiskImage) disk).getStorageIds().get(0));
StorageType domainStorageType = diskStorageDomain.getStorageType();
if (!domainStorageType.isFileDomain() && !domainStorageType.isBlockDomain()) {
return new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_DISK_SPARSIFY_NOT_SUPPORTED_BY_STORAGE_TYPE, getDiskAliasVarReplacement(), getStorageDomainNameVarReplacement(diskStorageDomain), ReplacementUtils.createSetVariableString("storageType", domainStorageType));
}
if (domainStorageType.isBlockDomain() && disk.isWipeAfterDelete()) {
return new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_DISK_SPARSIFY_NOT_SUPPORTED_BY_UNDERLYING_STORAGE_WHEN_WAD_IS_ENABLED, getStorageDomainNameVarReplacement(diskStorageDomain), getDiskAliasVarReplacement());
}
return ValidationResult.VALID;
}
Aggregations