Search in sources :

Example 66 with Cluster

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

the class DataCenterGuideModel method updateOptionsNonLocalFS.

private void updateOptionsNonLocalFS() {
    if (clusters == null || allStorageDomains == null || attachedStorageDomains == null || isoStorageDomains == null || allHosts == null) {
        return;
    }
    updateAddClusterAvailability();
    Set<Guid> clusterIds = clusters.stream().map(Cluster::getId).collect(Collectors.toSet());
    List<VDS> hosts = allHosts.stream().filter(h -> clusterIds.contains(h.getClusterId())).collect(Collectors.toList());
    List<VDS> upHosts = hosts.stream().filter(v -> v.getStatus() == VDSStatus.Up).collect(Collectors.toList());
    List<VDS> availableHosts = allHosts.stream().filter(v -> v.getStatus() == VDSStatus.Maintenance || v.getStatus() == VDSStatus.PendingApproval).filter(v -> doesHostSupportAnyCluster(clusters, v)).collect(Collectors.toList());
    updateAddAndSelectHostAvailability(hosts, availableHosts);
    List<StorageDomain> unattachedStorages = getUnattachedStorages();
    List<StorageDomain> attachedDataStorages = new ArrayList<>();
    List<StorageDomain> attachedIsoStorages = new ArrayList<>();
    for (StorageDomain sd : attachedStorageDomains) {
        if (sd.getStorageDomainType().isDataDomain()) {
            attachedDataStorages.add(sd);
        } else if (sd.getStorageDomainType() == StorageDomainType.ISO) {
            attachedIsoStorages.add(sd);
        }
    }
    updateAddAndAttachDataDomainAvailability(upHosts, unattachedStorages, attachedDataStorages);
    updateAddAndAttachIsoDomainAvailability(upHosts, attachedDataStorages, attachedIsoStorages);
    stopProgress();
}
Also used : SearchType(org.ovirt.engine.core.common.interfaces.SearchType) Arrays(java.util.Arrays) RegexValidation(org.ovirt.engine.ui.uicommonweb.validation.RegexValidation) StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) NewHostModel(org.ovirt.engine.ui.uicommonweb.models.hosts.NewHostModel) GuideModel(org.ovirt.engine.ui.uicommonweb.models.GuideModel) IFrontendMultipleActionAsyncCallback(org.ovirt.engine.ui.uicompat.IFrontendMultipleActionAsyncCallback) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ActionType(org.ovirt.engine.core.common.action.ActionType) ManagementNetworkOnClusterOperationParameters(org.ovirt.engine.core.common.action.ManagementNetworkOnClusterOperationParameters) PosixStorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.PosixStorageModel) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) NewEditStorageModelBehavior(org.ovirt.engine.ui.uicommonweb.models.storage.NewEditStorageModelBehavior) AttachStorageDomainToPoolParameters(org.ovirt.engine.core.common.action.AttachStorageDomainToPoolParameters) VdsActionParameters(org.ovirt.engine.core.common.action.VdsActionParameters) StorageType(org.ovirt.engine.core.common.businessentities.storage.StorageType) SearchParameters(org.ovirt.engine.core.common.queries.SearchParameters) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) Set(java.util.Set) AddSANStorageDomainParameters(org.ovirt.engine.core.common.action.AddSANStorageDomainParameters) StorageDomainSharedStatus(org.ovirt.engine.core.common.businessentities.StorageDomainSharedStatus) Collectors(java.util.stream.Collectors) MoveHost(org.ovirt.engine.ui.uicommonweb.models.hosts.MoveHost) List(java.util.List) VDSStatus(org.ovirt.engine.core.common.businessentities.VDSStatus) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) IStorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.IStorageModel) StorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.StorageModel) AddVdsActionParameters(org.ovirt.engine.core.common.action.hostdeploy.AddVdsActionParameters) ClusterModel(org.ovirt.engine.ui.uicommonweb.models.clusters.ClusterModel) NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) QueryType(org.ovirt.engine.core.common.queries.QueryType) HostModel(org.ovirt.engine.ui.uicommonweb.models.hosts.HostModel) ITaskTarget(org.ovirt.engine.ui.uicompat.ITaskTarget) Guid(org.ovirt.engine.core.compat.Guid) IFrontendActionAsyncCallback(org.ovirt.engine.ui.uicompat.IFrontendActionAsyncCallback) TaskContext(org.ovirt.engine.ui.uicompat.TaskContext) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) FrontendMultipleActionAsyncResult(org.ovirt.engine.ui.uicompat.FrontendMultipleActionAsyncResult) Task(org.ovirt.engine.ui.uicompat.Task) NfsStorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.NfsStorageModel) StorageDomainStatus(org.ovirt.engine.core.common.businessentities.StorageDomainStatus) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) GetDeviceListQueryParameters(org.ovirt.engine.core.common.queries.GetDeviceListQueryParameters) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) Frontend(org.ovirt.engine.ui.frontend.Frontend) StorageDomainStatic(org.ovirt.engine.core.common.businessentities.StorageDomainStatic) ChangeVDSClusterParameters(org.ovirt.engine.core.common.action.ChangeVDSClusterParameters) ClusterListModel(org.ovirt.engine.ui.uicommonweb.models.clusters.ClusterListModel) Model(org.ovirt.engine.ui.uicommonweb.models.Model) StoragePoolStatus(org.ovirt.engine.core.common.businessentities.StoragePoolStatus) MoveHostData(org.ovirt.engine.ui.uicommonweb.models.hosts.MoveHostData) SanStorageModelBase(org.ovirt.engine.ui.uicommonweb.models.storage.SanStorageModelBase) StorageDomainManagementParameter(org.ovirt.engine.core.common.action.StorageDomainManagementParameter) Linq(org.ovirt.engine.ui.uicommonweb.Linq) IValidation(org.ovirt.engine.ui.uicommonweb.validation.IValidation) ApproveVdsParameters(org.ovirt.engine.core.common.action.hostdeploy.ApproveVdsParameters) LocalStorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.LocalStorageModel) StorageServerConnectionParametersBase(org.ovirt.engine.core.common.action.StorageServerConnectionParametersBase) StorageDomainType(org.ovirt.engine.core.common.businessentities.StorageDomainType) Collections(java.util.Collections) VDS(org.ovirt.engine.core.common.businessentities.VDS) LunModel(org.ovirt.engine.ui.uicommonweb.models.storage.LunModel) Timer(com.google.gwt.user.client.Timer) LUNs(org.ovirt.engine.core.common.businessentities.storage.LUNs) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) VDS(org.ovirt.engine.core.common.businessentities.VDS) ArrayList(java.util.ArrayList) Guid(org.ovirt.engine.core.compat.Guid)

Example 67 with Cluster

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

the class VolumeModel method addBricks.

public void addBricks() {
    if (getWindow() != null || getCluster().getSelectedItem() == null) {
        return;
    }
    final VolumeBrickModel volumeBrickModel = new VolumeBrickModel();
    volumeBrickModel.getVolumeType().setEntity(getTypeList().getSelectedItem());
    volumeBrickModel.getReplicaCount().setEntity(getReplicaCount().getEntity());
    volumeBrickModel.getReplicaCount().setIsChangeable(true);
    volumeBrickModel.getReplicaCount().setIsAvailable(getReplicaCount().getIsAvailable());
    volumeBrickModel.getStripeCount().setEntity(getStripeCount().getEntity());
    volumeBrickModel.getStripeCount().setIsChangeable(true);
    volumeBrickModel.getStripeCount().setIsAvailable(getStripeCount().getIsAvailable());
    Cluster cluster = getCluster().getSelectedItem();
    if (cluster != null) {
        volumeBrickModel.getForce().setIsAvailable(true);
        volumeBrickModel.getForce().setEntity(isForceAddBricks());
        volumeBrickModel.setIsBrickProvisioningSupported();
    }
    setWindow(volumeBrickModel);
    volumeBrickModel.setTitle(ConstantsManager.getInstance().getConstants().addBricksTitle());
    volumeBrickModel.setHelpTag(HelpTag.add_bricks);
    // $NON-NLS-1$
    volumeBrickModel.setHashName("add_bricks");
    AsyncDataProvider.getInstance().getHostListByCluster(volumeBrickModel.asyncQuery(hostList -> {
        Iterator<VDS> iterator = hostList.iterator();
        while (iterator.hasNext()) {
            if (iterator.next().getStatus() != VDSStatus.Up) {
                iterator.remove();
            }
        }
        volumeBrickModel.setHostList(hostList);
    }), getCluster().getSelectedItem().getName());
    // TODO: fetch the mount points to display
    if (getBricks().getItems() != null) {
        volumeBrickModel.getBricks().setItems(getBricks().getItems());
    } else {
        volumeBrickModel.getBricks().setItems(new ArrayList<EntityModel<GlusterBrickEntity>>());
    }
    // $NON-NLS-1$
    UICommand command = UICommand.createDefaultOkUiCommand("OnAddBricks", this);
    volumeBrickModel.getCommands().add(command);
    // $NON-NLS-1$
    volumeBrickModel.getCommands().add(UICommand.createCancelUiCommand("Cancel", this));
}
Also used : NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) GlusterVolumeType(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeType) ApplicationMode(org.ovirt.engine.core.common.mode.ApplicationMode) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ArrayList(java.util.ArrayList) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) VolumeListModel(org.ovirt.engine.ui.uicommonweb.models.volumes.VolumeListModel) Version(org.ovirt.engine.core.compat.Version) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) Model(org.ovirt.engine.ui.uicommonweb.models.Model) Iterator(java.util.Iterator) Linq(org.ovirt.engine.ui.uicommonweb.Linq) IValidation(org.ovirt.engine.ui.uicommonweb.validation.IValidation) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) ApplicationModeHelper(org.ovirt.engine.ui.uicommonweb.models.ApplicationModeHelper) List(java.util.List) VDSStatus(org.ovirt.engine.core.common.businessentities.VDSStatus) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) AsciiNameValidation(org.ovirt.engine.ui.uicommonweb.validation.AsciiNameValidation) LengthValidation(org.ovirt.engine.ui.uicommonweb.validation.LengthValidation) VDS(org.ovirt.engine.core.common.businessentities.VDS) PropertyChangedEventArgs(org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs) Iterator(java.util.Iterator) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand)

Example 68 with Cluster

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

the class VolumeModel method clusterSelectedItemChanged.

private void clusterSelectedItemChanged() {
    setBricks(new ListModel<EntityModel<GlusterBrickEntity>>());
    if (getCluster().getSelectedItem() != null) {
        final Cluster cluster = getCluster().getSelectedItem();
        updateArbiterAvailability();
        updateDefaults();
        AsyncDataProvider.getInstance().isAnyHostUpInCluster(new AsyncQuery<>(returnValue -> {
            // In case the result of previous call is returned after selecting some other cluster
            if (!getCluster().getSelectedItem().getId().equals(cluster.getId())) {
                return;
            }
            if (returnValue) {
                getAddBricksCommand().setIsExecutionAllowed(true);
                setMessage(null);
            } else {
                getAddBricksCommand().setIsExecutionAllowed(false);
                setMessage(ConstantsManager.getInstance().getConstants().volumeEmptyClusterValidationMsg());
            }
        }), cluster.getName());
    } else {
        getAddBricksCommand().setIsExecutionAllowed(false);
        setMessage(null);
    }
}
Also used : NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) GlusterVolumeType(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeType) ApplicationMode(org.ovirt.engine.core.common.mode.ApplicationMode) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ArrayList(java.util.ArrayList) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) VolumeListModel(org.ovirt.engine.ui.uicommonweb.models.volumes.VolumeListModel) Version(org.ovirt.engine.core.compat.Version) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) Model(org.ovirt.engine.ui.uicommonweb.models.Model) Iterator(java.util.Iterator) Linq(org.ovirt.engine.ui.uicommonweb.Linq) IValidation(org.ovirt.engine.ui.uicommonweb.validation.IValidation) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) ApplicationModeHelper(org.ovirt.engine.ui.uicommonweb.models.ApplicationModeHelper) List(java.util.List) VDSStatus(org.ovirt.engine.core.common.businessentities.VDSStatus) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) AsciiNameValidation(org.ovirt.engine.ui.uicommonweb.validation.AsciiNameValidation) LengthValidation(org.ovirt.engine.ui.uicommonweb.validation.LengthValidation) VDS(org.ovirt.engine.core.common.businessentities.VDS) PropertyChangedEventArgs(org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) Cluster(org.ovirt.engine.core.common.businessentities.Cluster)

Example 69 with Cluster

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

the class GlusterClusterSnapshotConfigModel method clusterSelectedItemChanged.

private void clusterSelectedItemChanged() {
    Cluster selectedCluster = getClusters().getSelectedItem();
    if (selectedCluster == null) {
        return;
    }
    AsyncDataProvider.getInstance().getGlusterSnapshotConfig(new AsyncQuery<>(new AsyncCallback<QueryReturnValue>() {

        @Override
        public void onSuccess(QueryReturnValue returnValue) {
            Pair<List<GlusterVolumeSnapshotConfig>, List<GlusterVolumeSnapshotConfig>> configs = returnValue.getReturnValue();
            if (configs != null) {
                List<GlusterVolumeSnapshotConfig> clusterConfigOptions = configs.getFirst();
                Collections.sort(clusterConfigOptions, Comparator.comparing(GlusterVolumeSnapshotConfig::getParamName));
                setModelItems(getClusterConfigOptions(), clusterConfigOptions, existingClusterConfigs);
            } else {
                getClusterConfigOptions().setItems(null);
            }
        }

        private void setModelItems(ListModel<EntityModel<GlusterVolumeSnapshotConfig>> listModel, List<GlusterVolumeSnapshotConfig> cfgs, Map<String, String> fetchedCfgsBackup) {
            List<EntityModel<GlusterVolumeSnapshotConfig>> coll = new ArrayList<>();
            for (GlusterVolumeSnapshotConfig cfg : cfgs) {
                EntityModel<GlusterVolumeSnapshotConfig> cfgModel = new EntityModel<>();
                cfgModel.setEntity(cfg);
                fetchedCfgsBackup.put(cfg.getParamName(), cfg.getParamValue());
                coll.add(cfgModel);
            }
            // set the entity items
            listModel.setItems(coll);
        }
    }), selectedCluster.getId(), null);
}
Also used : GlusterVolumeSnapshotConfig(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotConfig) AsyncCallback(org.ovirt.engine.ui.frontend.AsyncCallback) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ArrayList(java.util.ArrayList) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) ArrayList(java.util.ArrayList) List(java.util.List) HashMap(java.util.HashMap) Map(java.util.Map)

Example 70 with Cluster

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

the class NewNetworkModel method onGetClusterList.

protected void onGetClusterList(List<Cluster> clusterList) {
    // Cluster list
    List<NetworkClusterModel> items = new ArrayList<>();
    for (Cluster cluster : clusterList) {
        items.add(createNetworkClusterModel(cluster));
    }
    getNetworkClusterList().setItems(items);
    selectExternalProviderBasedOnCluster();
}
Also used : ArrayList(java.util.ArrayList) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) NetworkCluster(org.ovirt.engine.core.common.businessentities.network.NetworkCluster)

Aggregations

Cluster (org.ovirt.engine.core.common.businessentities.Cluster)346 Test (org.junit.Test)83 ArrayList (java.util.ArrayList)80 Guid (org.ovirt.engine.core.compat.Guid)77 VDS (org.ovirt.engine.core.common.businessentities.VDS)54 List (java.util.List)50 VM (org.ovirt.engine.core.common.businessentities.VM)36 HashMap (java.util.HashMap)35 Map (java.util.Map)33 HashSet (java.util.HashSet)30 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)30 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)28 Version (org.ovirt.engine.core.compat.Version)27 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)26 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)26 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)25 Set (java.util.Set)24 QueryType (org.ovirt.engine.core.common.queries.QueryType)23 Collections (java.util.Collections)22 Frontend (org.ovirt.engine.ui.frontend.Frontend)22