Search in sources :

Example 1 with ServerCpu

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

the class ClusterModel method version_SelectedItemChanged.

private void version_SelectedItemChanged() {
    Version version = getEffectiveVersion();
    AsyncDataProvider.getInstance().getCPUList(new AsyncQuery<>(cpus -> {
        if (getIsEdit()) {
            AsyncDataProvider.getInstance().isClusterEmpty(new AsyncQuery<>(isEmpty -> {
                if (isEmpty) {
                    populateCPUList(cpus, true);
                } else {
                    ArrayList<ServerCpu> filteredCpus = new ArrayList<>();
                    for (ServerCpu cpu : cpus) {
                        if (cpu.getArchitecture() == getEntity().getArchitecture()) {
                            filteredCpus.add(cpu);
                        }
                    }
                    populateCPUList(filteredCpus, false);
                }
            }), getEntity().getId());
        } else {
            cpus.add(0, null);
            populateCPUList(cpus, true);
        }
    }), version);
    getVersionSupportsCpuThreads().setEntity(true);
    getEnableBallooning().setChangeProhibitionReason(ConstantsManager.getInstance().getConstants().ballooningNotAvailable());
    getEnableBallooning().setIsChangeable(true);
    setRngSourcesCheckboxes(version);
    updateSwitchTypeUponVersionChange(version);
    updateFirewallTypeUponVersionChange(version);
    updateFencingPolicyContent(version);
    updateMigrateOnError();
    refreshMigrationPolicies();
    refreshAdditionalClusterFeaturesList();
    if (getEnableGlusterService().getEntity()) {
        initTunedProfiles();
    }
}
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) Version(org.ovirt.engine.core.compat.Version) ServerCpu(org.ovirt.engine.core.common.businessentities.ServerCpu) ArrayList(java.util.ArrayList)

Example 2 with ServerCpu

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

the class ClusterModel method updateMigrateOnError.

private void updateMigrateOnError() {
    ServerCpu cpu = getCPU().getSelectedItem();
    Version version = getVersion().getSelectedItem();
    if (version == null) {
        return;
    }
    if (cpu == null || cpu.getArchitecture() == null) {
        return;
    }
    getMigrateOnErrorOption_NO().setIsAvailable(true);
    if (AsyncDataProvider.getInstance().isMigrationSupported(cpu.getArchitecture(), version)) {
        getMigrateOnErrorOption_YES().setIsAvailable(true);
        getMigrateOnErrorOption_HA_ONLY().setIsAvailable(true);
    } else {
        getMigrateOnErrorOption_YES().setIsAvailable(false);
        getMigrateOnErrorOption_HA_ONLY().setIsAvailable(false);
        setMigrateOnErrorOption(MigrateOnErrorOptions.NO);
    }
}
Also used : Version(org.ovirt.engine.core.compat.Version) ServerCpu(org.ovirt.engine.core.common.businessentities.ServerCpu)

Example 3 with ServerCpu

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

the class VmModelBehaviorBase method updateCustomCpu.

/*
     * Updates the cpu model combobox after a cluster change occurs
     */
protected void updateCustomCpu() {
    Cluster cluster = getModel().getSelectedCluster();
    if (cluster == null || cluster.getCpuName() == null) {
        return;
    }
    AsyncDataProvider.getInstance().getSupportedCpuList(new AsyncQuery<>(returnValue -> {
        if (returnValue != null) {
            List<String> cpuList = new ArrayList<>();
            // $NON-NLS-1$
            cpuList.add("");
            for (ServerCpu cpu : returnValue) {
                cpuList.add(cpu.getVdsVerbData());
            }
            String oldVal = getModel().getCustomCpu().getSelectedItem();
            getModel().getCustomCpu().setItems(cpuList);
            getModel().getCustomCpu().setSelectedItem(oldVal);
        }
    }), cluster.getCpuName());
}
Also used : UsbPolicy(org.ovirt.engine.core.common.businessentities.UsbPolicy) TemplateWithVersion(org.ovirt.engine.ui.uicommonweb.models.templates.TemplateWithVersion) Arrays(java.util.Arrays) CinderDisk(org.ovirt.engine.core.common.businessentities.storage.CinderDisk) VmType(org.ovirt.engine.core.common.businessentities.VmType) InstanceType(org.ovirt.engine.core.common.businessentities.InstanceType) DiskByDiskAliasComparator(org.ovirt.engine.core.common.businessentities.comparators.DiskByDiskAliasComparator) Event(org.ovirt.engine.ui.uicompat.Event) ImagesDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.ImagesDataProvider) VmNumaSupportModel(org.ovirt.engine.ui.uicommonweb.models.hosts.numa.VmNumaSupportModel) QuotaEnforcementTypeEnum(org.ovirt.engine.core.common.businessentities.QuotaEnforcementTypeEnum) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) Map(java.util.Map) VmDevice(org.ovirt.engine.core.common.businessentities.VmDevice) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) AsyncQuery(org.ovirt.engine.ui.frontend.AsyncQuery) Version(org.ovirt.engine.core.compat.Version) EventArgs(org.ovirt.engine.ui.uicompat.EventArgs) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) StorageType(org.ovirt.engine.core.common.businessentities.storage.StorageType) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) VmBase(org.ovirt.engine.core.common.businessentities.VmBase) DiskStorageType(org.ovirt.engine.core.common.businessentities.storage.DiskStorageType) VmNumaNode(org.ovirt.engine.core.common.businessentities.VmNumaNode) Collection(java.util.Collection) VmTemplate(org.ovirt.engine.core.common.businessentities.VmTemplate) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) Set(java.util.Set) I18NNameValidation(org.ovirt.engine.ui.uicommonweb.validation.I18NNameValidation) StringHelper(org.ovirt.engine.core.compat.StringHelper) VolumeType(org.ovirt.engine.core.common.businessentities.storage.VolumeType) List(java.util.List) VmRngDevice(org.ovirt.engine.core.common.businessentities.VmRngDevice) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) RepoImage(org.ovirt.engine.core.common.businessentities.storage.RepoImage) LatestVmTemplate(org.ovirt.engine.ui.uicommonweb.models.templates.LatestVmTemplate) GraphicsType(org.ovirt.engine.core.common.businessentities.GraphicsType) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) QueryType(org.ovirt.engine.core.common.queries.QueryType) ArchitectureType(org.ovirt.engine.core.common.businessentities.ArchitectureType) TimeZoneType(org.ovirt.engine.core.common.TimeZoneType) Guid(org.ovirt.engine.core.compat.Guid) ServerCpu(org.ovirt.engine.core.common.businessentities.ServerCpu) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) IEventListener(org.ovirt.engine.ui.uicompat.IEventListener) HashMap(java.util.HashMap) StorageDomainStatus(org.ovirt.engine.core.common.businessentities.StorageDomainStatus) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) ExistingBlankTemplateModelBehavior(org.ovirt.engine.ui.uicommonweb.models.templates.ExistingBlankTemplateModelBehavior) TreeSet(java.util.TreeSet) ArrayList(java.util.ArrayList) AsyncCallback(org.ovirt.engine.ui.frontend.AsyncCallback) HashSet(java.util.HashSet) CpuProfile(org.ovirt.engine.core.common.businessentities.profiles.CpuProfile) Frontend(org.ovirt.engine.ui.frontend.Frontend) NumaSupportModel(org.ovirt.engine.ui.uicommonweb.models.hosts.numa.NumaSupportModel) InstanceTypeManager(org.ovirt.engine.ui.uicommonweb.models.vms.instancetypes.InstanceTypeManager) UIMessages(org.ovirt.engine.ui.uicompat.UIMessages) NameableComparator(org.ovirt.engine.core.common.businessentities.comparators.NameableComparator) Linq(org.ovirt.engine.ui.uicommonweb.Linq) BuilderExecutor(org.ovirt.engine.ui.uicommonweb.builders.BuilderExecutor) IValidation(org.ovirt.engine.ui.uicommonweb.validation.IValidation) ConfigValues(org.ovirt.engine.core.common.config.ConfigValues) Quota(org.ovirt.engine.core.common.businessentities.Quota) VmCommonUtils(org.ovirt.engine.core.common.utils.VmCommonUtils) VM(org.ovirt.engine.core.common.businessentities.VM) UIConstants(org.ovirt.engine.ui.uicompat.UIConstants) ActionGroup(org.ovirt.engine.core.common.businessentities.ActionGroup) MigrationSupport(org.ovirt.engine.core.common.businessentities.MigrationSupport) Collections(java.util.Collections) VDS(org.ovirt.engine.core.common.businessentities.VDS) ServerCpu(org.ovirt.engine.core.common.businessentities.ServerCpu) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) List(java.util.List) ArrayList(java.util.ArrayList)

Example 4 with ServerCpu

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

the class HostModel method getCurrentCpuVendor.

/**
 * @return it may return `null`
 */
private CpuVendor getCurrentCpuVendor() {
    if (getCluster().getSelectedItem() == null) {
        return null;
    }
    final Cluster selectedCluster = getCluster().getSelectedItem();
    final ServerCpu clustersCpu = AsyncDataProvider.getInstance().getCpuByName(selectedCluster.getCpuName(), selectedCluster.getCompatibilityVersion());
    if (clustersCpu == null) {
        // in case CPU of cluster was not yet set
        return null;
    }
    return clustersCpu.getVendor();
}
Also used : ServerCpu(org.ovirt.engine.core.common.businessentities.ServerCpu) Cluster(org.ovirt.engine.core.common.businessentities.Cluster)

Example 5 with ServerCpu

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

the class HostConfigureLocalStoragePopupView method initialize.

private void initialize() {
    dataCenterVersionEditor = new ListModelListBoxEditor<>(new NullSafeRenderer<Version>() {

        @Override
        public String renderNullSafe(Version object) {
            return object.getValue();
        }
    });
    clusterCpuTypeEditor = new ListModelListBoxEditor<>(new NullSafeRenderer<ServerCpu>() {

        @Override
        public String renderNullSafe(ServerCpu object) {
            return object.getCpuName();
        }
    });
    // Optimization options.
    // $NON-NLS-1$
    optimizationNoneEditor = new EntityModelRadioButtonEditor("1");
    // $NON-NLS-1$
    optimizationForServerEditor = new EntityModelRadioButtonEditor("1");
    // $NON-NLS-1$
    optimizationForDesktopEditor = new EntityModelRadioButtonEditor("1");
    // $NON-NLS-1$
    optimizationCustomEditor = new EntityModelRadioButtonEditor("1");
    optimizationCustomEditor.setVisible(false);
    countThreadsAsCoresEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
    memoryOptimizationInfo = new InfoIcon(templates.italicText(constants.clusterPopupMemoryOptimizationInfo()));
    memoryOptimizationInfo.setTooltipMaxWidth(TooltipWidth.W520);
    cpuThreadsInfo = new InfoIcon(templates.italicText(constants.clusterPopupCpuThreadsInfo()));
    cpuThreadsInfo.setTooltipMaxWidth(TooltipWidth.W620);
}
Also used : Version(org.ovirt.engine.core.compat.Version) InfoIcon(org.ovirt.engine.ui.common.widget.dialog.InfoIcon) NullSafeRenderer(org.ovirt.engine.ui.common.widget.renderer.NullSafeRenderer) ServerCpu(org.ovirt.engine.core.common.businessentities.ServerCpu) EntityModelCheckBoxEditor(org.ovirt.engine.ui.common.widget.editor.generic.EntityModelCheckBoxEditor) EntityModelRadioButtonEditor(org.ovirt.engine.ui.common.widget.editor.generic.EntityModelRadioButtonEditor)

Aggregations

ServerCpu (org.ovirt.engine.core.common.businessentities.ServerCpu)22 Version (org.ovirt.engine.core.compat.Version)8 ArchitectureType (org.ovirt.engine.core.common.businessentities.ArchitectureType)7 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)7 ArrayList (java.util.ArrayList)6 VDS (org.ovirt.engine.core.common.businessentities.VDS)6 List (java.util.List)5 Arrays (java.util.Arrays)4 Collection (java.util.Collection)4 HashSet (java.util.HashSet)4 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)4 Collections (java.util.Collections)3 HashMap (java.util.HashMap)3 Map (java.util.Map)3 Set (java.util.Set)3 TreeSet (java.util.TreeSet)3 ConfigValues (org.ovirt.engine.core.common.config.ConfigValues)3 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)3 QueryType (org.ovirt.engine.core.common.queries.QueryType)3 Guid (org.ovirt.engine.core.compat.Guid)3