Search in sources :

Example 11 with ArchitectureType

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

the class ClusterModel method initSupportedArchitectures.

private void initSupportedArchitectures() {
    Collection<ArchitectureType> archsWithSupportingCpus = new HashSet<>();
    archsWithSupportingCpus.add(ArchitectureType.undefined);
    for (ServerCpu cpu : getCPU().getItems()) {
        if (cpu != null) {
            archsWithSupportingCpus.add(cpu.getArchitecture());
        }
    }
    getArchitecture().setItems(archsWithSupportingCpus);
}
Also used : ArchitectureType(org.ovirt.engine.core.common.businessentities.ArchitectureType) ServerCpu(org.ovirt.engine.core.common.businessentities.ServerCpu) HashSet(java.util.HashSet)

Example 12 with ArchitectureType

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

the class ClusterModel method filterCpuTypeByArchitecture.

private void filterCpuTypeByArchitecture() {
    final ArchitectureType selectedArchitecture = getArchitecture().getSelectedItem();
    final FilteredListModel.Filter<ServerCpu> filter = selectedArchitecture == null || selectedArchitecture.equals(ArchitectureType.undefined) ? cpu -> cpu == null || cpu.getLevel() > 0 : cpu -> cpu != null && selectedArchitecture.equals(cpu.getArchitecture()) && cpu.getLevel() > 0;
    getCPU().filterItems(filter);
}
Also used : ArchitectureType(org.ovirt.engine.core.common.businessentities.ArchitectureType) ServerCpu(org.ovirt.engine.core.common.businessentities.ServerCpu) FilteredListModel(org.ovirt.engine.ui.uicommonweb.models.FilteredListModel)

Example 13 with ArchitectureType

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

the class RunVmValidatorTest method mockOsRepository.

private void mockOsRepository() {
    OsRepository osRepository = mock(OsRepository.class);
    when(osRepository.get64bitOss()).thenReturn(Collections.singletonList(_64_BIT_OS));
    final Map<Integer, ArchitectureType> osArchitectures = Collections.singletonMap(_64_BIT_OS, ArchitectureType.x86_64);
    when(osRepository.getOsArchitectures()).thenReturn(Collections.unmodifiableMap(osArchitectures));
    SimpleDependencyInjector.getInstance().bind(OsRepository.class, osRepository);
}
Also used : ArchitectureType(org.ovirt.engine.core.common.businessentities.ArchitectureType) OsRepository(org.ovirt.engine.core.common.osinfo.OsRepository)

Example 14 with ArchitectureType

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

the class GetArchitectureCapabilitiesQuery method getMap.

private static Map<ArchitectureType, Map<Version, Boolean>> getMap(ArchCapabilitiesVerb archCapabilitiesVerb) {
    if (archCapabilitiesVerb == null) {
        return null;
    }
    Map<ArchitectureType, Map<Version, Boolean>> supportMap = new EnumMap<>(ArchitectureType.class);
    for (ArchitectureType arch : ArchitectureType.values()) {
        Map<Version, Boolean> archMap = new HashMap<>();
        for (Version version : Version.ALL) {
            archMap.put(version, isSupported(archCapabilitiesVerb, arch, version));
        }
        supportMap.put(arch, archMap);
    }
    return supportMap;
}
Also used : ArchitectureType(org.ovirt.engine.core.common.businessentities.ArchitectureType) Version(org.ovirt.engine.core.compat.Version) HashMap(java.util.HashMap) EnumMap(java.util.EnumMap) Map(java.util.Map) HashMap(java.util.HashMap) EnumMap(java.util.EnumMap)

Example 15 with ArchitectureType

use of org.ovirt.engine.core.common.businessentities.ArchitectureType 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

ArchitectureType (org.ovirt.engine.core.common.businessentities.ArchitectureType)18 HashMap (java.util.HashMap)5 ServerCpu (org.ovirt.engine.core.common.businessentities.ServerCpu)4 Guid (org.ovirt.engine.core.compat.Guid)4 ArrayList (java.util.ArrayList)3 HashSet (java.util.HashSet)3 List (java.util.List)3 Map (java.util.Map)3 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)3 QueryParametersBase (org.ovirt.engine.core.common.queries.QueryParametersBase)3 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)3 Linq (org.ovirt.engine.ui.uicommonweb.Linq)3 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)3 Quota (org.ovirt.engine.core.common.businessentities.Quota)2 QuotaEnforcementTypeEnum (org.ovirt.engine.core.common.businessentities.QuotaEnforcementTypeEnum)2 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)2 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)2 VM (org.ovirt.engine.core.common.businessentities.VM)2 Disk (org.ovirt.engine.core.common.businessentities.storage.Disk)2 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)2