Search in sources :

Example 66 with StoragePool

use of org.ovirt.engine.core.common.businessentities.StoragePool in project ovirt-engine by oVirt.

the class DataCenterListModel method updateDetailsAvailability.

@Override
protected void updateDetailsAvailability() {
    super.updateDetailsAvailability();
    if (getSelectedItem() != null) {
        StoragePool storagePool = getSelectedItem();
        quotaListModel.setIsAvailable(storagePool.getQuotaEnforcementType() != QuotaEnforcementTypeEnum.DISABLED);
        updateIscsiBondListAvailability(storagePool);
    }
}
Also used : StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool)

Example 67 with StoragePool

use of org.ovirt.engine.core.common.businessentities.StoragePool in project ovirt-engine by oVirt.

the class ImportVmFromExportDomainModel method doInit.

protected void doInit() {
    StoragePool dataCenter = getStoragePool();
    if (dataCenter == null) {
        return;
    }
    getClusterQuota().setIsAvailable(dataCenter.getQuotaEnforcementType() != QuotaEnforcementTypeEnum.DISABLED);
    getCluster().getSelectedItemChangedEvent().addListener(clusterChangedListener);
    // get cluster
    getCluster().setItems(null);
    AsyncDataProvider.getInstance().getClusterByServiceList(new AsyncQuery<>(clusters -> {
        ArchitectureType targetArch = getTargetArchitecture();
        if (targetArch != null) {
            List<Cluster> filteredClusters = AsyncDataProvider.getInstance().filterByArchitecture(clusters, targetArch);
            getCluster().setItems(filteredClusters);
            getCluster().setSelectedItem(Linq.firstOrNull(filteredClusters));
        } else {
            getCluster().setItems(clusters);
            getCluster().setSelectedItem(Linq.firstOrNull(clusters));
        }
        // get storage domains
        AsyncDataProvider.getInstance().getStorageDomainList(new AsyncQuery<>(storageDomains -> {
            // filter storage domains
            filteredStorageDomains = new ArrayList<>();
            for (StorageDomain domain : storageDomains) {
                if (Linq.isDataActiveStorageDomain(domain)) {
                    filteredStorageDomains.add(domain);
                }
            }
            if (getClusterQuota().getIsAvailable()) {
                initQuotaForStorageDomains();
            } else {
                initDisksStorageDomainsList();
            }
        }), getStoragePool().getId());
    }), dataCenter.getId(), true, false);
}
Also used : NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) QueryType(org.ovirt.engine.core.common.queries.QueryType) GetAllFromExportDomainQueryParameters(org.ovirt.engine.core.common.queries.GetAllFromExportDomainQueryParameters) ArchitectureType(org.ovirt.engine.core.common.businessentities.ArchitectureType) Guid(org.ovirt.engine.core.compat.Guid) Inject(com.google.inject.Inject) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) HashMap(java.util.HashMap) SearchableListModel(org.ovirt.engine.ui.uicommonweb.models.SearchableListModel) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) QuotaEnforcementTypeEnum(org.ovirt.engine.core.common.businessentities.QuotaEnforcementTypeEnum) IFrontendMultipleActionAsyncCallback(org.ovirt.engine.ui.uicompat.IFrontendMultipleActionAsyncCallback) ArrayList(java.util.ArrayList) AsyncCallback(org.ovirt.engine.ui.frontend.AsyncCallback) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) HashSet(java.util.HashSet) ActionType(org.ovirt.engine.core.common.action.ActionType) CpuProfile(org.ovirt.engine.core.common.businessentities.profiles.CpuProfile) Frontend(org.ovirt.engine.ui.frontend.Frontend) QuotaListModel(org.ovirt.engine.ui.uicommonweb.models.quota.QuotaListModel) Map(java.util.Map) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) VolumeFormat(org.ovirt.engine.core.common.businessentities.storage.VolumeFormat) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) ClusterListModel(org.ovirt.engine.ui.uicommonweb.models.clusters.ClusterListModel) QueryParametersBase(org.ovirt.engine.core.common.queries.QueryParametersBase) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) Linq(org.ovirt.engine.ui.uicommonweb.Linq) IValidation(org.ovirt.engine.ui.uicommonweb.validation.IValidation) Collection(java.util.Collection) VmTemplate(org.ovirt.engine.core.common.businessentities.VmTemplate) Set(java.util.Set) Disk(org.ovirt.engine.core.common.businessentities.storage.Disk) VolumeType(org.ovirt.engine.core.common.businessentities.storage.VolumeType) Quota(org.ovirt.engine.core.common.businessentities.Quota) ImportVmParameters(org.ovirt.engine.core.common.action.ImportVmParameters) List(java.util.List) VM(org.ovirt.engine.core.common.businessentities.VM) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) Entry(java.util.Map.Entry) PropertyChangedEventArgs(org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs) ArchitectureType(org.ovirt.engine.core.common.businessentities.ArchitectureType) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) ArrayList(java.util.ArrayList) List(java.util.List)

Example 68 with StoragePool

use of org.ovirt.engine.core.common.businessentities.StoragePool in project ovirt-engine by oVirt.

the class ImportVmFromExternalProviderModel method doInit.

protected void doInit() {
    final StoragePool dataCenter = getStoragePool();
    if (dataCenter == null) {
        return;
    }
    setStoragePool(dataCenter);
    getClusterQuota().setIsAvailable(dataCenter.getQuotaEnforcementType() != QuotaEnforcementTypeEnum.DISABLED);
    getCluster().getSelectedItemChangedEvent().addListener(clusterChangedListener);
    // get cluster
    getCluster().setItems(null);
    AsyncDataProvider.getInstance().getVnicProfilesByDcId(new AsyncQuery<>(returnValue -> {
        networkProfiles = returnValue;
        initNetworksList();
        initClusterAndStorage(dataCenter);
    }), dataCenter.getId());
}
Also used : StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) QueryType(org.ovirt.engine.core.common.queries.QueryType) Arrays(java.util.Arrays) ArchitectureType(org.ovirt.engine.core.common.businessentities.ArchitectureType) Guid(org.ovirt.engine.core.compat.Guid) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) HashMap(java.util.HashMap) ImagesDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.ImagesDataProvider) SearchableListModel(org.ovirt.engine.ui.uicommonweb.models.SearchableListModel) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) QuotaEnforcementTypeEnum(org.ovirt.engine.core.common.businessentities.QuotaEnforcementTypeEnum) ArrayList(java.util.ArrayList) AsyncCallback(org.ovirt.engine.ui.frontend.AsyncCallback) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) Frontend(org.ovirt.engine.ui.frontend.Frontend) OriginType(org.ovirt.engine.core.common.businessentities.OriginType) QuotaListModel(org.ovirt.engine.ui.uicommonweb.models.quota.QuotaListModel) Map(java.util.Map) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) ClusterListModel(org.ovirt.engine.ui.uicommonweb.models.clusters.ClusterListModel) QueryParametersBase(org.ovirt.engine.core.common.queries.QueryParametersBase) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) Iterator(java.util.Iterator) Linq(org.ovirt.engine.ui.uicommonweb.Linq) VmNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) Disk(org.ovirt.engine.core.common.businessentities.storage.Disk) VolumeType(org.ovirt.engine.core.common.businessentities.storage.VolumeType) Quota(org.ovirt.engine.core.common.businessentities.Quota) Objects(java.util.Objects) List(java.util.List) VM(org.ovirt.engine.core.common.businessentities.VM) RepoImage(org.ovirt.engine.core.common.businessentities.storage.RepoImage) VnicProfileView(org.ovirt.engine.core.common.businessentities.network.VnicProfileView) PropertyChangedEventArgs(org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool)

Example 69 with StoragePool

use of org.ovirt.engine.core.common.businessentities.StoragePool in project ovirt-engine by oVirt.

the class ImportVmFromExternalProviderModel method initClusterAndStorage.

private void initClusterAndStorage(StoragePool dataCenter) {
    AsyncDataProvider.getInstance().getClusterByServiceList(new AsyncQuery<>(clusters -> {
        ArchitectureType targetArch = getTargetArchitecture();
        if (targetArch != null) {
            clusters = AsyncDataProvider.getInstance().filterByArchitecture(clusters, targetArch);
        }
        getCluster().setItems(clusters);
        getCluster().setSelectedItem(Linq.firstOrNull(clusters));
        // get storage domains
        AsyncDataProvider.getInstance().getStorageDomainList(new AsyncQuery<>(storageDomains -> {
            // filter storage domains
            List<StorageDomain> filteredStorageDomains = new ArrayList<>();
            for (StorageDomain domain : storageDomains) {
                if (Linq.isDataActiveStorageDomain(domain)) {
                    filteredStorageDomains.add(domain);
                }
            }
            getStorage().setItems(filteredStorageDomains);
            if (getClusterQuota().getIsAvailable()) {
                initQuotaForStorageDomains();
            } else {
                initDisksStorageDomainsList();
            }
        }), getStoragePool().getId());
    }), dataCenter.getId(), true, false);
}
Also used : StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) QueryType(org.ovirt.engine.core.common.queries.QueryType) Arrays(java.util.Arrays) ArchitectureType(org.ovirt.engine.core.common.businessentities.ArchitectureType) Guid(org.ovirt.engine.core.compat.Guid) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) HashMap(java.util.HashMap) ImagesDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.ImagesDataProvider) SearchableListModel(org.ovirt.engine.ui.uicommonweb.models.SearchableListModel) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) QuotaEnforcementTypeEnum(org.ovirt.engine.core.common.businessentities.QuotaEnforcementTypeEnum) ArrayList(java.util.ArrayList) AsyncCallback(org.ovirt.engine.ui.frontend.AsyncCallback) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) Frontend(org.ovirt.engine.ui.frontend.Frontend) OriginType(org.ovirt.engine.core.common.businessentities.OriginType) QuotaListModel(org.ovirt.engine.ui.uicommonweb.models.quota.QuotaListModel) Map(java.util.Map) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) ClusterListModel(org.ovirt.engine.ui.uicommonweb.models.clusters.ClusterListModel) QueryParametersBase(org.ovirt.engine.core.common.queries.QueryParametersBase) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) Iterator(java.util.Iterator) Linq(org.ovirt.engine.ui.uicommonweb.Linq) VmNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) Disk(org.ovirt.engine.core.common.businessentities.storage.Disk) VolumeType(org.ovirt.engine.core.common.businessentities.storage.VolumeType) Quota(org.ovirt.engine.core.common.businessentities.Quota) Objects(java.util.Objects) List(java.util.List) VM(org.ovirt.engine.core.common.businessentities.VM) RepoImage(org.ovirt.engine.core.common.businessentities.storage.RepoImage) VnicProfileView(org.ovirt.engine.core.common.businessentities.network.VnicProfileView) PropertyChangedEventArgs(org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs) ArchitectureType(org.ovirt.engine.core.common.businessentities.ArchitectureType) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) ArrayList(java.util.ArrayList)

Example 70 with StoragePool

use of org.ovirt.engine.core.common.businessentities.StoragePool in project ovirt-engine by oVirt.

the class ImportVmsModel method initDataCenters.

private void initDataCenters() {
    getDataCenters().getSelectedItemChangedEvent().addListener((ev, sender, args) -> {
        clearVms();
        exportDomain.setEntity(null);
        loadProviders();
        StoragePool dataCenter = dataCenters.getSelectedItem();
        Frontend.getInstance().runQuery(QueryType.GetStorageDomainsByStoragePoolId, new IdQueryParameters(dataCenter.getId()), new AsyncQuery<>(createGetStorageDomainsByStoragePoolIdCallback()));
    });
    dataCenters.getSelectedItemChangedEvent().addListener(new IEventListener<EventArgs>() {

        @Override
        public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) {
            AsyncDataProvider.getInstance().getHostListByDataCenter(new AsyncQuery<>(hosts -> {
                List<VDS> upHosts = filterUpHosts(hosts);
                proxyHosts.setItems(addAnyHostInCluster(upHosts));
                xenProxyHosts.setItems(addAnyHostInCluster(upHosts));
                kvmProxyHosts.setItems(addAnyHostInCluster(upHosts));
                ImportVmsModel.this.hosts.setItems(upHosts);
                stopProgress();
            }), dataCenters.getSelectedItem().getId());
        }

        private List<VDS> filterUpHosts(List<VDS> hosts) {
            List<VDS> result = new ArrayList<>();
            for (VDS host : hosts) {
                if (host.getStatus() == VDSStatus.Up) {
                    result.add(host);
                }
            }
            return result;
        }

        private List<VDS> addAnyHostInCluster(List<VDS> hosts) {
            List<VDS> result = new ArrayList<>(hosts);
            // Any host in the cluster
            result.add(0, null);
            return result;
        }
    });
    AsyncDataProvider.getInstance().getDataCenterList(new AsyncQuery<>(returnValue -> {
        List<StoragePool> dataCenters = new ArrayList<>();
        for (StoragePool a : returnValue) {
            if (a.getStatus() == StoragePoolStatus.Up) {
                dataCenters.add(a);
            }
        }
        if (dataCenters.isEmpty()) {
            getDataCenters().setIsChangeable(false);
            getImportSources().setIsChangeable(false);
            setError(constants.notAvailableWithNoUpDC());
            stopProgress();
            return;
        }
        Collections.sort(dataCenters, new NameableComparator());
        ImportVmsModel.this.dataCenters.setItems(dataCenters);
    }));
}
Also used : Arrays(java.util.Arrays) NameAndOptionalDomainValidation(org.ovirt.engine.ui.uicommonweb.validation.NameAndOptionalDomainValidation) Inject(com.google.inject.Inject) Provider(org.ovirt.engine.core.common.businessentities.Provider) Event(org.ovirt.engine.ui.uicompat.Event) IFrontendMultipleActionAsyncCallback(org.ovirt.engine.ui.uicompat.IFrontendMultipleActionAsyncCallback) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) OriginType(org.ovirt.engine.core.common.businessentities.OriginType) Map(java.util.Map) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) URL(com.google.gwt.http.client.URL) EventArgs(org.ovirt.engine.ui.uicompat.EventArgs) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) SortedListModel(org.ovirt.engine.ui.uicommonweb.models.SortedListModel) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) Collection(java.util.Collection) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) Set(java.util.Set) StringHelper(org.ovirt.engine.core.compat.StringHelper) Objects(java.util.Objects) List(java.util.List) VDSStatus(org.ovirt.engine.core.common.businessentities.VDSStatus) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) TypeResolver(org.ovirt.engine.ui.uicommonweb.TypeResolver) ProviderType(org.ovirt.engine.core.common.businessentities.ProviderType) LengthValidation(org.ovirt.engine.ui.uicommonweb.validation.LengthValidation) HostAddressValidation(org.ovirt.engine.ui.uicommonweb.validation.HostAddressValidation) XENVmProviderProperties(org.ovirt.engine.core.common.businessentities.XENVmProviderProperties) NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) QueryType(org.ovirt.engine.core.common.queries.QueryType) KVMVmProviderProperties(org.ovirt.engine.core.common.businessentities.KVMVmProviderProperties) GetAllFromExportDomainQueryParameters(org.ovirt.engine.core.common.queries.GetAllFromExportDomainQueryParameters) ArchitectureType(org.ovirt.engine.core.common.businessentities.ArchitectureType) Guid(org.ovirt.engine.core.compat.Guid) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) IEventListener(org.ovirt.engine.ui.uicompat.IEventListener) HashMap(java.util.HashMap) StorageDomainStatus(org.ovirt.engine.core.common.businessentities.StorageDomainStatus) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) ArrayList(java.util.ArrayList) AsyncCallback(org.ovirt.engine.ui.frontend.AsyncCallback) HashSet(java.util.HashSet) Frontend(org.ovirt.engine.ui.frontend.Frontend) UIMessages(org.ovirt.engine.ui.uicompat.UIMessages) NameableComparator(org.ovirt.engine.core.common.businessentities.comparators.NameableComparator) Pair(org.ovirt.engine.core.common.utils.Pair) QueryParametersBase(org.ovirt.engine.core.common.queries.QueryParametersBase) StoragePoolStatus(org.ovirt.engine.core.common.businessentities.StoragePoolStatus) IValidation(org.ovirt.engine.ui.uicommonweb.validation.IValidation) VmwareVmProviderProperties(org.ovirt.engine.core.common.businessentities.VmwareVmProviderProperties) VM(org.ovirt.engine.core.common.businessentities.VM) ErrorPopupManager(org.ovirt.engine.ui.uicommonweb.ErrorPopupManager) ListWithSimpleDetailsModel(org.ovirt.engine.ui.uicommonweb.models.ListWithSimpleDetailsModel) UIConstants(org.ovirt.engine.ui.uicompat.UIConstants) StorageDomainType(org.ovirt.engine.core.common.businessentities.StorageDomainType) Collections(java.util.Collections) VDS(org.ovirt.engine.core.common.businessentities.VDS) PropertyChangedEventArgs(org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) VDS(org.ovirt.engine.core.common.businessentities.VDS) NameableComparator(org.ovirt.engine.core.common.businessentities.comparators.NameableComparator) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) List(java.util.List) ArrayList(java.util.ArrayList) EventArgs(org.ovirt.engine.ui.uicompat.EventArgs) PropertyChangedEventArgs(org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs)

Aggregations

StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)239 Guid (org.ovirt.engine.core.compat.Guid)83 ArrayList (java.util.ArrayList)78 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)60 Test (org.junit.Test)59 List (java.util.List)46 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)39 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)35 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)34 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)33 VDS (org.ovirt.engine.core.common.businessentities.VDS)31 QueryType (org.ovirt.engine.core.common.queries.QueryType)31 Frontend (org.ovirt.engine.ui.frontend.Frontend)31 StorageDomainStatic (org.ovirt.engine.core.common.businessentities.StorageDomainStatic)28 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)28 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)27 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)27 Linq (org.ovirt.engine.ui.uicommonweb.Linq)26 Arrays (java.util.Arrays)25 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)25