Search in sources :

Example 6 with Cluster

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

the class ClusterListModel method checkForNonResponsiveHosts.

/**
 * Checks if in selected cluster are some non responsive hosts. If so, it adds warning about upgrading cluster level
 * when some hosts are non responsive
 */
@SuppressWarnings("unchecked")
private void checkForNonResponsiveHosts(final ConfirmationModel confirmModel) {
    startProgress();
    Frontend.getInstance().runQuery(QueryType.GetHostsByClusterId, new IdQueryParameters(getSelectedItem().getId()), new AsyncQuery<>(returnValue -> {
        List<VDS> hosts = null;
        if (returnValue instanceof List) {
            hosts = (List<VDS>) returnValue;
        } else if (returnValue instanceof QueryReturnValue && ((QueryReturnValue) returnValue).getReturnValue() instanceof List) {
            hosts = ((QueryReturnValue) returnValue).getReturnValue();
        }
        boolean foundNRHosts = false;
        if (hosts != null) {
            for (VDS host : hosts) {
                if (VDSStatus.NonResponsive == host.getStatus()) {
                    foundNRHosts = true;
                    break;
                }
            }
        }
        String existingMsg = confirmModel.getMessage() == null ? "" : confirmModel.getMessage();
        if (foundNRHosts) {
            confirmModel.setMessage(existingMsg + constants.youAreAboutChangeClusterCompatibilityVersionNonResponsiveHostsMsg());
        } else {
            confirmModel.setMessage(existingMsg + constants.youAreAboutChangeClusterCompatibilityVersionMsg());
        }
        stopProgress();
    }));
}
Also used : SearchType(org.ovirt.engine.core.common.interfaces.SearchType) Arrays(java.util.Arrays) SearchObjects(org.ovirt.engine.core.searchbackend.SearchObjects) Inject(com.google.inject.Inject) HostDetailModel(org.ovirt.engine.ui.uicommonweb.models.hosts.HostDetailModel) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ActionType(org.ovirt.engine.core.common.action.ActionType) ManagementNetworkOnClusterOperationParameters(org.ovirt.engine.core.common.action.ManagementNetworkOnClusterOperationParameters) Map(java.util.Map) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) HasEntity(org.ovirt.engine.ui.uicommonweb.models.HasEntity) Version(org.ovirt.engine.core.compat.Version) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) MultipleHostsModel(org.ovirt.engine.ui.uicommonweb.models.hosts.MultipleHostsModel) ClusterParametersBase(org.ovirt.engine.core.common.action.ClusterParametersBase) AdditionalFeature(org.ovirt.engine.core.common.businessentities.AdditionalFeature) SearchParameters(org.ovirt.engine.core.common.queries.SearchParameters) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) Collection(java.util.Collection) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) MigrationBandwidthLimitType(org.ovirt.engine.core.common.businessentities.MigrationBandwidthLimitType) List(java.util.List) VDSStatus(org.ovirt.engine.core.common.businessentities.VDSStatus) VmRngDevice(org.ovirt.engine.core.common.businessentities.VmRngDevice) KeyValueModel(org.ovirt.engine.ui.uicommonweb.models.vms.key_value.KeyValueModel) Cloner(org.ovirt.engine.ui.uicommonweb.Cloner) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) SharedMacPoolModel(org.ovirt.engine.ui.uicommonweb.models.macpool.SharedMacPoolModel) OptimizationType(org.ovirt.engine.core.common.scheduling.OptimizationType) AddVdsActionParameters(org.ovirt.engine.core.common.action.hostdeploy.AddVdsActionParameters) CpuProfileListModel(org.ovirt.engine.ui.uicommonweb.models.profiles.CpuProfileListModel) QueryType(org.ovirt.engine.core.common.queries.QueryType) NewSharedMacPoolModel(org.ovirt.engine.ui.uicommonweb.models.macpool.NewSharedMacPoolModel) PermissionListModel(org.ovirt.engine.ui.uicommonweb.models.configure.PermissionListModel) Guid(org.ovirt.engine.core.compat.Guid) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ArrayList(java.util.ArrayList) AsyncCallback(org.ovirt.engine.ui.frontend.AsyncCallback) Frontend(org.ovirt.engine.ui.frontend.Frontend) Network(org.ovirt.engine.core.common.businessentities.network.Network) UIMessages(org.ovirt.engine.ui.uicompat.UIMessages) Linq(org.ovirt.engine.ui.uicommonweb.Linq) SearchStringMapping(org.ovirt.engine.ui.uicommonweb.models.SearchStringMapping) ClusterAffinityLabelListModel(org.ovirt.engine.ui.uicommonweb.models.configure.labels.list.ClusterAffinityLabelListModel) ClusterAffinityGroupListModel(org.ovirt.engine.ui.uicommonweb.models.configure.scheduling.affinity_groups.list.ClusterAffinityGroupListModel) SupportedAdditionalClusterFeature(org.ovirt.engine.core.common.businessentities.SupportedAdditionalClusterFeature) MacPool(org.ovirt.engine.core.common.businessentities.MacPool) ListWithSimpleDetailsModel(org.ovirt.engine.ui.uicommonweb.models.ListWithSimpleDetailsModel) UIConstants(org.ovirt.engine.ui.uicompat.UIConstants) WebAdminApplicationPlaces(org.ovirt.engine.ui.uicommonweb.place.WebAdminApplicationPlaces) VDS(org.ovirt.engine.core.common.businessentities.VDS) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) VDS(org.ovirt.engine.core.common.businessentities.VDS) List(java.util.List) ArrayList(java.util.ArrayList)

Example 7 with Cluster

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

the class ClusterListModel method onSaveConfirmGenericWarnings.

private void onSaveConfirmGenericWarnings() {
    ClusterModel model = (ClusterModel) getWindow();
    cancelConfirmation();
    Cluster cluster = buildCluster(model, model.getIsNew() ? new Cluster() : (Cluster) Cloner.clone(getSelectedItem()));
    AsyncDataProvider.getInstance().getClusterEditWarnings(new AsyncQuery<>(warnings -> {
        if (!warnings.isEmpty()) {
            ClusterWarningsModel confirmWindow = new ClusterWarningsModel();
            confirmWindow.init(warnings);
            // $NON-NLS-1$
            confirmWindow.getCommands().add(UICommand.createDefaultOkUiCommand("OnSaveInternal", ClusterListModel.this));
            // $NON-NLS-1$
            confirmWindow.getCommands().add(UICommand.createCancelUiCommand("CancelConfirmation", ClusterListModel.this));
            setConfirmWindow(confirmWindow);
        } else {
            onSaveInternal();
        }
    }), model.getClusterId(), cluster);
}
Also used : SearchType(org.ovirt.engine.core.common.interfaces.SearchType) Arrays(java.util.Arrays) SearchObjects(org.ovirt.engine.core.searchbackend.SearchObjects) Inject(com.google.inject.Inject) HostDetailModel(org.ovirt.engine.ui.uicommonweb.models.hosts.HostDetailModel) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ActionType(org.ovirt.engine.core.common.action.ActionType) ManagementNetworkOnClusterOperationParameters(org.ovirt.engine.core.common.action.ManagementNetworkOnClusterOperationParameters) Map(java.util.Map) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) HasEntity(org.ovirt.engine.ui.uicommonweb.models.HasEntity) Version(org.ovirt.engine.core.compat.Version) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) MultipleHostsModel(org.ovirt.engine.ui.uicommonweb.models.hosts.MultipleHostsModel) ClusterParametersBase(org.ovirt.engine.core.common.action.ClusterParametersBase) AdditionalFeature(org.ovirt.engine.core.common.businessentities.AdditionalFeature) SearchParameters(org.ovirt.engine.core.common.queries.SearchParameters) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) Collection(java.util.Collection) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) MigrationBandwidthLimitType(org.ovirt.engine.core.common.businessentities.MigrationBandwidthLimitType) List(java.util.List) VDSStatus(org.ovirt.engine.core.common.businessentities.VDSStatus) VmRngDevice(org.ovirt.engine.core.common.businessentities.VmRngDevice) KeyValueModel(org.ovirt.engine.ui.uicommonweb.models.vms.key_value.KeyValueModel) Cloner(org.ovirt.engine.ui.uicommonweb.Cloner) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) SharedMacPoolModel(org.ovirt.engine.ui.uicommonweb.models.macpool.SharedMacPoolModel) OptimizationType(org.ovirt.engine.core.common.scheduling.OptimizationType) AddVdsActionParameters(org.ovirt.engine.core.common.action.hostdeploy.AddVdsActionParameters) CpuProfileListModel(org.ovirt.engine.ui.uicommonweb.models.profiles.CpuProfileListModel) QueryType(org.ovirt.engine.core.common.queries.QueryType) NewSharedMacPoolModel(org.ovirt.engine.ui.uicommonweb.models.macpool.NewSharedMacPoolModel) PermissionListModel(org.ovirt.engine.ui.uicommonweb.models.configure.PermissionListModel) Guid(org.ovirt.engine.core.compat.Guid) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ArrayList(java.util.ArrayList) AsyncCallback(org.ovirt.engine.ui.frontend.AsyncCallback) Frontend(org.ovirt.engine.ui.frontend.Frontend) Network(org.ovirt.engine.core.common.businessentities.network.Network) UIMessages(org.ovirt.engine.ui.uicompat.UIMessages) Linq(org.ovirt.engine.ui.uicommonweb.Linq) SearchStringMapping(org.ovirt.engine.ui.uicommonweb.models.SearchStringMapping) ClusterAffinityLabelListModel(org.ovirt.engine.ui.uicommonweb.models.configure.labels.list.ClusterAffinityLabelListModel) ClusterAffinityGroupListModel(org.ovirt.engine.ui.uicommonweb.models.configure.scheduling.affinity_groups.list.ClusterAffinityGroupListModel) SupportedAdditionalClusterFeature(org.ovirt.engine.core.common.businessentities.SupportedAdditionalClusterFeature) MacPool(org.ovirt.engine.core.common.businessentities.MacPool) ListWithSimpleDetailsModel(org.ovirt.engine.ui.uicommonweb.models.ListWithSimpleDetailsModel) UIConstants(org.ovirt.engine.ui.uicompat.UIConstants) WebAdminApplicationPlaces(org.ovirt.engine.ui.uicommonweb.place.WebAdminApplicationPlaces) VDS(org.ovirt.engine.core.common.businessentities.VDS) Cluster(org.ovirt.engine.core.common.businessentities.Cluster)

Example 8 with Cluster

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

the class ClusterListModel method updateDetailsAvailability.

@Override
protected void updateDetailsAvailability() {
    super.updateDetailsAvailability();
    Cluster cluster = getSelectedItem();
    boolean clusterSupportsVirtService = cluster != null && cluster.supportsVirtService();
    boolean clusterSupportsGlusterService = cluster != null && cluster.supportsGlusterService();
    getVmListModel().setIsAvailable(clusterSupportsVirtService);
    getServiceModel().setIsAvailable(clusterSupportsGlusterService);
    getGlusterHookListModel().setIsAvailable(clusterSupportsGlusterService);
    getAffinityGroupListModel().setIsAvailable(clusterSupportsVirtService);
    getCpuProfileListModel().setIsAvailable(clusterSupportsVirtService);
    getAffinityLabelListModel().setIsAvailable(clusterSupportsVirtService);
}
Also used : Cluster(org.ovirt.engine.core.common.businessentities.Cluster)

Example 9 with Cluster

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

the class ClusterModel method storagePool_SelectedItemChanged.

private void storagePool_SelectedItemChanged() {
    // possible versions for new cluster (when editing cluster, this event won't occur)
    // are actually the possible versions for the data-center that the cluster is going
    // to be attached to.
    final StoragePool selectedDataCenter = getDataCenter().getSelectedItem();
    if (selectedDataCenter == null) {
        getManagementNetwork().setItems(Collections.emptyList());
        return;
    }
    if (selectedDataCenter.isLocal()) {
        setMigrationTabAvailable(false);
    } else {
        setMigrationTabAvailable(true);
    }
    AsyncDataProvider.getInstance().getDataCenterVersions(new AsyncQuery<>(new AsyncCallback<List<Version>>() {

        @Override
        public void onSuccess(List<Version> versions) {
            Version versionToSelect = calculateNewVersionWhichShouldBeSelected(versions);
            getVersion().setItems(versions, versionToSelect);
        }

        private Version calculateNewVersionWhichShouldBeSelected(List<Version> versions) {
            ListModel<Version> version = getVersion();
            Version selectedVersion = version.getSelectedItem();
            if (!getIsEdit() && (selectedVersion == null || !versions.contains(selectedVersion) || selectedVersion.compareTo(selectedDataCenter.getCompatibilityVersion()) > 0)) {
                if (ApplicationModeHelper.getUiMode().equals(ApplicationMode.GlusterOnly)) {
                    return versions.stream().max(Comparator.naturalOrder()).orElse(null);
                } else {
                    return selectedDataCenter.getCompatibilityVersion();
                }
            } else if (getIsEdit()) {
                return Linq.firstOrNull(versions, x -> x.equals(getEntity().getCompatibilityVersion()));
            } else {
                return selectedVersion;
            }
        }
    }), ApplicationModeHelper.getUiMode().equals(ApplicationMode.GlusterOnly) ? null : selectedDataCenter.getId());
    if (getManagementNetwork().getIsChangable()) {
        loadDcNetworks(selectedDataCenter.getId());
    }
}
Also used : MacPoolModel(org.ovirt.engine.ui.uicommonweb.models.macpool.MacPoolModel) Arrays(java.util.Arrays) Provider(org.ovirt.engine.core.common.businessentities.Provider) Event(org.ovirt.engine.ui.uicompat.Event) ApplicationMode(org.ovirt.engine.core.common.mode.ApplicationMode) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) SwitchType(org.ovirt.engine.core.common.network.SwitchType) Map(java.util.Map) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) HasEntity(org.ovirt.engine.ui.uicommonweb.models.HasEntity) Version(org.ovirt.engine.core.compat.Version) EventArgs(org.ovirt.engine.ui.uicompat.EventArgs) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) SortedListModel(org.ovirt.engine.ui.uicommonweb.models.SortedListModel) ClusterPolicy(org.ovirt.engine.core.common.scheduling.ClusterPolicy) AdditionalFeature(org.ovirt.engine.core.common.businessentities.AdditionalFeature) 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) MigrationBandwidthLimitType(org.ovirt.engine.core.common.businessentities.MigrationBandwidthLimitType) HasValidatedTabs(org.ovirt.engine.ui.uicommonweb.models.HasValidatedTabs) I18NNameValidation(org.ovirt.engine.ui.uicommonweb.validation.I18NNameValidation) StringHelper(org.ovirt.engine.core.compat.StringHelper) SerialNumberPolicyModel(org.ovirt.engine.ui.uicommonweb.models.vms.SerialNumberPolicyModel) Objects(java.util.Objects) ApplicationModeHelper(org.ovirt.engine.ui.uicommonweb.models.ApplicationModeHelper) List(java.util.List) MigrateOnErrorOptions(org.ovirt.engine.core.common.businessentities.MigrateOnErrorOptions) VmRngDevice(org.ovirt.engine.core.common.businessentities.VmRngDevice) ValidationCompleteEvent(org.ovirt.engine.ui.uicommonweb.models.ValidationCompleteEvent) KeyValueModel(org.ovirt.engine.ui.uicommonweb.models.vms.key_value.KeyValueModel) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) ProviderType(org.ovirt.engine.core.common.businessentities.ProviderType) FilteredListModel(org.ovirt.engine.ui.uicommonweb.models.FilteredListModel) LengthValidation(org.ovirt.engine.ui.uicommonweb.validation.LengthValidation) NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) QueryType(org.ovirt.engine.core.common.queries.QueryType) VdsStatic(org.ovirt.engine.core.common.businessentities.VdsStatic) ArchitectureType(org.ovirt.engine.core.common.businessentities.ArchitectureType) HostWithProtocolAndPortAddressValidation(org.ovirt.engine.ui.uicommonweb.validation.HostWithProtocolAndPortAddressValidation) Guid(org.ovirt.engine.core.compat.Guid) ServerCpu(org.ovirt.engine.core.common.businessentities.ServerCpu) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) AsyncCallback(org.ovirt.engine.ui.frontend.AsyncCallback) HashSet(java.util.HashSet) LinkedHashMap(java.util.LinkedHashMap) NoMigrationPolicy(org.ovirt.engine.core.common.migration.NoMigrationPolicy) Frontend(org.ovirt.engine.ui.frontend.Frontend) NotNullIntegerValidation(org.ovirt.engine.ui.uicommonweb.validation.NotNullIntegerValidation) Network(org.ovirt.engine.core.common.businessentities.network.Network) MigrationPolicy(org.ovirt.engine.core.common.migration.MigrationPolicy) Pair(org.ovirt.engine.core.common.utils.Pair) QueryParametersBase(org.ovirt.engine.core.common.queries.QueryParametersBase) Linq(org.ovirt.engine.ui.uicommonweb.Linq) IValidation(org.ovirt.engine.ui.uicommonweb.validation.IValidation) SerialNumberPolicy(org.ovirt.engine.core.common.businessentities.SerialNumberPolicy) ConfigValues(org.ovirt.engine.core.common.config.ConfigValues) SupportedAdditionalClusterFeature(org.ovirt.engine.core.common.businessentities.SupportedAdditionalClusterFeature) MacPool(org.ovirt.engine.core.common.businessentities.MacPool) TabName(org.ovirt.engine.ui.uicommonweb.models.TabName) PolicyUnit(org.ovirt.engine.core.common.scheduling.PolicyUnit) UIConstants(org.ovirt.engine.ui.uicompat.UIConstants) FirewallType(org.ovirt.engine.core.common.network.FirewallType) Comparator(java.util.Comparator) Collections(java.util.Collections) PropertyChangedEventArgs(org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs) IdAndNameQueryParameters(org.ovirt.engine.core.common.queries.IdAndNameQueryParameters) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) Version(org.ovirt.engine.core.compat.Version) AsyncCallback(org.ovirt.engine.ui.frontend.AsyncCallback) List(java.util.List) ArrayList(java.util.ArrayList)

Example 10 with Cluster

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

the class ClusterGeneralModel method updateProperties.

private void updateProperties() {
    Cluster cluster = getEntity();
    setName(cluster.getName());
    setDescription(cluster.getDescription());
    setCpuType(cluster.getCpuName());
    setDataCenterName(cluster.getStoragePoolName());
    setMemoryOverCommit(cluster.getMaxVdsMemoryOverCommit());
    setCpuThreads(cluster.getCountThreadsAsCores());
    setResiliencePolicy(cluster.getMigrateOnError());
    setEmulatedMachine(cluster.getEmulatedMachine());
    setCompatibilityVersion(cluster.getCompatibilityVersion().getValue());
    generateClusterType(cluster.supportsGlusterService(), cluster.supportsVirtService());
    AsyncDataProvider.getInstance().getNumberOfVmsInCluster(new AsyncQuery<>((QueryReturnValue returnValue) -> setNumberOfVms((Integer) returnValue.getReturnValue())), cluster.getId());
}
Also used : QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) Cluster(org.ovirt.engine.core.common.businessentities.Cluster)

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