Search in sources :

Example 21 with ServerCpu

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

the class CpuFlagsManagerHandler method compareCpuLevels.

public int compareCpuLevels(String cpuName1, String cpuName2, Version ver) {
    final CpuFlagsManager cpuFlagsManager = managersDictionary.get(ver);
    ServerCpu server1 = null;
    ServerCpu server2 = null;
    if (cpuFlagsManager != null) {
        server1 = cpuFlagsManager.getServerCpuByName(cpuName1);
        server2 = cpuFlagsManager.getServerCpuByName(cpuName2);
    }
    int server1Level = (server1 != null) ? server1.getLevel() : 0;
    int server2Level = (server2 != null) ? server2.getLevel() : 0;
    return server1Level - server2Level;
}
Also used : ServerCpu(org.ovirt.engine.core.common.businessentities.ServerCpu)

Example 22 with ServerCpu

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

the class ClusterPopupView method initListBoxEditors.

private void initListBoxEditors() {
    dataCenterEditor = new ListModelListBoxEditor<>(new NameRenderer<StoragePool>());
    managementNetworkEditor = new ListModelListBoxEditor<>(new NullSafeRenderer<Network>() {

        @Override
        protected String renderNullSafe(Network network) {
            return network.getName();
        }
    });
    cpuEditor = new ListModelListBoxEditor<>(new AbstractRenderer<ServerCpu>() {

        @Override
        public String render(ServerCpu object) {
            return object != null ? object.getCpuName() : constants.autoDetect();
        }
    });
    versionEditor = new ListModelListBoxEditor<>(new NullSafeRenderer<Version>() {

        @Override
        public String renderNullSafe(Version object) {
            return object.toString();
        }
    });
    switchTypeEditor = new ListModelListBoxEditor<>(new EnumRenderer<SwitchType>());
    firewallTypeEditor = new ListModelListBoxEditor<>(new EnumRenderer<FirewallType>());
    defaultNetworkProviderEditor = new ListModelListBoxEditor<>(new NullSafeRenderer<Provider>() {

        @Override
        protected String renderNullSafe(Provider provider) {
            return provider.getName();
        }
    });
    architectureEditor = new ListModelListBoxEditor<>(new EnumRenderer<ArchitectureType>() {

        @Override
        public String render(ArchitectureType object) {
            if (object == null || object == ArchitectureType.undefined) {
                // only localize the 'undefined' enum value
                return super.render(object);
            } else {
                // all other (concrete) architectures should be displayed directly
                return object.toString();
            }
        }
    });
    clusterPolicyEditor = new ListModelListBoxEditor<>(new NameRenderer<ClusterPolicy>());
    hostsWithBrokenConnectivityThresholdEditor = new ListModelListBoxEditor<>(new NullSafeRenderer<Integer>() {

        @Override
        public String renderNullSafe(Integer object) {
            if (object == null) {
                return "";
            }
            NumberFormatRenderer renderer = new NumberFormatRenderer(NumberFormat.getPercentFormat());
            // Since this is a percentage renderer, you need to divide by 100 to get the right values to show.
            return renderer.render(object.doubleValue() / 100);
        }
    });
    autoConvergeEditor = new ListModelListBoxEditor<>(new BooleanRendererWithNullText(constants.autoConverge(), constants.dontAutoConverge(), constants.inheritFromGlobal()));
    migrateCompressedEditor = new ListModelListBoxEditor<>(new BooleanRendererWithNullText(constants.compress(), constants.dontCompress(), constants.inheritFromGlobal()));
    migrationBandwidthLimitTypeEditor = new ListModelListBoxEditor<>(new EnumRenderer<MigrationBandwidthLimitType>());
    migrationBandwidthLimitTypeEditor.hideLabel();
    migrationPolicyEditor = new ListModelListBoxEditor<>(new NameRenderer());
    migrationPolicyEditor.hideLabel();
    macPoolListEditor = new ListModelListBoxEditor<>(new NameRenderer<MacPool>());
    macPoolListEditor.setLabel(constants.clusterPopupMacPoolLabel());
}
Also used : ArchitectureType(org.ovirt.engine.core.common.businessentities.ArchitectureType) BooleanRendererWithNullText(org.ovirt.engine.ui.common.widget.renderer.BooleanRendererWithNullText) NameRenderer(org.ovirt.engine.ui.common.widget.renderer.NameRenderer) ServerCpu(org.ovirt.engine.core.common.businessentities.ServerCpu) AssetProvider(org.ovirt.engine.ui.webadmin.gin.AssetProvider) Provider(org.ovirt.engine.core.common.businessentities.Provider) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) EnumRenderer(org.ovirt.engine.ui.common.widget.renderer.EnumRenderer) AbstractRenderer(com.google.gwt.text.shared.AbstractRenderer) Version(org.ovirt.engine.core.compat.Version) NumberFormatRenderer(com.google.gwt.text.client.NumberFormatRenderer) Network(org.ovirt.engine.core.common.businessentities.network.Network) NullSafeRenderer(org.ovirt.engine.ui.common.widget.renderer.NullSafeRenderer)

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