Search in sources :

Example 16 with ServerCpu

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

the class CpuLevelFilterPolicyUnit method filter.

@Override
public List<VDS> filter(Cluster cluster, List<VDS> hosts, VM vm, Map<String, String> parameters, PerHostMessages messages) {
    List<VDS> hostsToRunOn = new ArrayList<>();
    // full name of the vm cpu
    String customCpu;
    Version latestVer = cpuFlagsManagerHandler.getLatestDictionaryVersion();
    /* get required cpu name */
    if (StringUtils.isNotEmpty(vm.getCpuName())) {
        // dynamic check - used for 1.migrating vms 2.run-once 3.after dynamic field is updated with current static-field\cluster
        customCpu = vm.getCpuName();
    } else if (StringUtils.isNotEmpty(vm.getCustomCpuName())) {
        // static check - used only for cases where the dynamic value hasn't been updated yet(validate)
        customCpu = vm.getCustomCpuName();
    } else {
        // use cluster default - all hosts are valid
        return hosts;
    }
    // translate vdsVerb to full cpu name
    customCpu = cpuFlagsManagerHandler.getCpuNameByCpuId(customCpu, latestVer);
    if (StringUtils.isNotEmpty(customCpu)) {
        /* find compatible hosts */
        for (VDS host : hosts) {
            ServerCpu cpu = cpuFlagsManagerHandler.findMaxServerCpuByFlags(host.getCpuFlags(), latestVer);
            String hostCpuName = cpu == null ? null : cpu.getCpuName();
            if (StringUtils.isNotEmpty(hostCpuName)) {
                if (cpuFlagsManagerHandler.checkIfCpusSameManufacture(customCpu, hostCpuName, latestVer)) {
                    // verify comparison uses only one cpu-level scale
                    int compareResult = cpuFlagsManagerHandler.compareCpuLevels(customCpu, hostCpuName, latestVer);
                    if (compareResult <= 0) {
                        hostsToRunOn.add(host);
                        log.debug("Host '{}' wasn't filtered out as it has a CPU level ({}) which is higher or equal than the CPU level the VM was run with ({})", host.getName(), hostCpuName, customCpu);
                    } else {
                        log.debug("Host '{}' was filtered out as it has a CPU level ({}) which is lower than the CPU level the VM was run with ({})", host.getName(), hostCpuName, customCpu);
                        messages.addMessage(host.getId(), String.format("$hostCPULevel %1$s", hostCpuName));
                        messages.addMessage(host.getId(), String.format("$vmCPULevel %1$s", customCpu));
                        messages.addMessage(host.getId(), EngineMessage.VAR__DETAIL__LOW_CPU_LEVEL.toString());
                    }
                }
            }
        }
    }
    return hostsToRunOn;
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) Version(org.ovirt.engine.core.compat.Version) ArrayList(java.util.ArrayList) ServerCpu(org.ovirt.engine.core.common.businessentities.ServerCpu)

Example 17 with ServerCpu

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

the class BackendClusterLevelsResource method makeClusterLevel.

public ClusterLevel makeClusterLevel(String version) {
    ClusterLevel level = new ClusterLevel();
    level.setId(version);
    // Not exposing CPU list filtered queries:
    if (!isFiltered()) {
        CpuTypes cpuTypes = new CpuTypes();
        for (ServerCpu serverCpu : getServerCpuList(version)) {
            CpuType cpuType = new CpuType();
            cpuType.setName(serverCpu.getCpuName());
            cpuType.setLevel(serverCpu.getLevel());
            cpuType.setArchitecture(CPUMapper.map(serverCpu.getArchitecture(), null));
            cpuTypes.getCpuTypes().add(cpuType);
        }
        level.setCpuTypes(cpuTypes);
    }
    // Add permits:
    Permits permits = new Permits();
    for (ActionGroup actionGroup : getActionGroups()) {
        Permit permit = PermitMapper.map(actionGroup, null);
        permits.getPermits().add(permit);
    }
    level.setPermits(permits);
    return LinkHelper.addLinks(level);
}
Also used : Permit(org.ovirt.engine.api.model.Permit) ActionGroup(org.ovirt.engine.core.common.businessentities.ActionGroup) ClusterLevel(org.ovirt.engine.api.model.ClusterLevel) ServerCpu(org.ovirt.engine.core.common.businessentities.ServerCpu) CpuTypes(org.ovirt.engine.api.model.CpuTypes) CpuType(org.ovirt.engine.api.model.CpuType) Permits(org.ovirt.engine.api.model.Permits)

Example 18 with ServerCpu

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

the class AsyncDataProvider method initCpuMap.

private void initCpuMap() {
    cpuMap = new HashMap<>();
    final List<QueryType> queryTypes = new ArrayList<>();
    final List<QueryParametersBase> queryParams = new ArrayList<>();
    for (Version version : Version.ALL) {
        queryTypes.add(QueryType.GetAllServerCpuList);
        queryParams.add(new GetAllServerCpuListParameters(version));
    }
    final IFrontendMultipleQueryAsyncCallback callback = result -> {
        for (int i = 0; i < result.getReturnValues().size(); i++) {
            final List<ServerCpu> cpus = result.getReturnValues().get(i).getReturnValue();
            final Version version = ((GetAllServerCpuListParameters) result.getParameters().get(i)).getVersion();
            initCpuMapForVersion(version, cpus);
        }
    };
    Frontend.getInstance().runMultipleQueries(queryTypes, queryParams, callback);
}
Also used : StorageDomainsAndStoragePoolIdQueryParameters(org.ovirt.engine.core.common.queries.StorageDomainsAndStoragePoolIdQueryParameters) BusinessEntity(org.ovirt.engine.core.common.businessentities.BusinessEntity) ServiceType(org.ovirt.engine.core.common.businessentities.gluster.ServiceType) StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) GetConfigurationValueParameters(org.ovirt.engine.core.common.queries.GetConfigurationValueParameters) Map(java.util.Map) VdsNumaNode(org.ovirt.engine.core.common.businessentities.VdsNumaNode) ProfileEntry(org.ovirt.engine.core.aaa.ProfileEntry) AsyncQuery(org.ovirt.engine.ui.frontend.AsyncQuery) DisplayType(org.ovirt.engine.core.common.businessentities.DisplayType) AdditionalFeature(org.ovirt.engine.core.common.businessentities.AdditionalFeature) GlusterGeoRepSession(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession) ActionUtils(org.ovirt.engine.core.common.ActionUtils) RefObject(org.ovirt.engine.core.compat.RefObject) SetupNetworksBondModel(org.ovirt.engine.ui.uicommonweb.models.hosts.SetupNetworksBondModel) GlusterVolumeQueriesParameters(org.ovirt.engine.core.common.queries.gluster.GlusterVolumeQueriesParameters) StringHelper(org.ovirt.engine.core.compat.StringHelper) NetworkQoSModel(org.ovirt.engine.ui.uicommonweb.models.datacenters.NetworkQoSModel) VolumeType(org.ovirt.engine.core.common.businessentities.storage.VolumeType) DbUser(org.ovirt.engine.core.common.businessentities.aaa.DbUser) GlusterParameters(org.ovirt.engine.core.common.queries.gluster.GlusterParameters) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) DiskInterface(org.ovirt.engine.core.common.businessentities.storage.DiskInterface) GraphicsType(org.ovirt.engine.core.common.businessentities.GraphicsType) GlusterServerService(org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService) GetStorageDomainsByConnectionParameters(org.ovirt.engine.core.common.queries.GetStorageDomainsByConnectionParameters) QueryType(org.ovirt.engine.core.common.queries.QueryType) LoginModel(org.ovirt.engine.ui.uicommonweb.models.LoginModel) GlusterVolumeProfileParameters(org.ovirt.engine.core.common.queries.gluster.GlusterVolumeProfileParameters) ServerCpu(org.ovirt.engine.core.common.businessentities.ServerCpu) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) ExternalDiscoveredHost(org.ovirt.engine.core.common.businessentities.ExternalDiscoveredHost) NfsStorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.NfsStorageModel) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) ProviderQueryParameters(org.ovirt.engine.core.common.queries.ProviderQueryParameters) AuthzGroup(org.ovirt.engine.core.common.businessentities.aaa.AuthzGroup) OsQueryParameters(org.ovirt.engine.core.common.queries.OsQueryParameters) GlusterClusterService(org.ovirt.engine.core.common.businessentities.gluster.GlusterClusterService) GlusterVolumeSnapshotSchedule(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotSchedule) MigrationPolicy(org.ovirt.engine.core.common.migration.MigrationPolicy) HostNetworkQos(org.ovirt.engine.core.common.businessentities.network.HostNetworkQos) Pair(org.ovirt.engine.core.common.utils.Pair) ExternalComputeResource(org.ovirt.engine.core.common.businessentities.ExternalComputeResource) VmPool(org.ovirt.engine.core.common.businessentities.VmPool) IdsQueryParameters(org.ovirt.engine.core.common.queries.IdsQueryParameters) VmNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface) Quota(org.ovirt.engine.core.common.businessentities.Quota) GlusterHookQueryParameters(org.ovirt.engine.core.common.queries.gluster.GlusterHookQueryParameters) VmCommonUtils(org.ovirt.engine.core.common.utils.VmCommonUtils) SupportedAdditionalClusterFeature(org.ovirt.engine.core.common.businessentities.SupportedAdditionalClusterFeature) VM(org.ovirt.engine.core.common.businessentities.VM) QosType(org.ovirt.engine.core.common.businessentities.qos.QosType) VnicProfileView(org.ovirt.engine.core.common.businessentities.network.VnicProfileView) GetExistingStorageDomainListParameters(org.ovirt.engine.core.common.queries.GetExistingStorageDomainListParameters) GlusterStorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.GlusterStorageModel) GlusterVolumeRemoveBricksQueriesParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeRemoveBricksQueriesParameters) QuotaComparator(org.ovirt.engine.ui.uicommonweb.comparators.QuotaComparator) SearchType(org.ovirt.engine.core.common.interfaces.SearchType) NetworkModel(org.ovirt.engine.ui.uicommonweb.models.datacenters.NetworkModel) GetSupportedCpuListParameters(org.ovirt.engine.core.common.queries.GetSupportedCpuListParameters) SortedSet(java.util.SortedSet) GetClusterFeaturesByVersionAndCategoryParameters(org.ovirt.engine.core.common.queries.GetClusterFeaturesByVersionAndCategoryParameters) GetVmsFromExternalProviderQueryParameters(org.ovirt.engine.core.common.queries.GetVmsFromExternalProviderQueryParameters) GetAllProvidersParameters(org.ovirt.engine.core.common.queries.GetAllProvidersParameters) OriginType(org.ovirt.engine.core.common.businessentities.OriginType) PosixStorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.PosixStorageModel) KeyValuePairCompat(org.ovirt.engine.core.compat.KeyValuePairCompat) Version(org.ovirt.engine.core.compat.Version) EventArgs(org.ovirt.engine.ui.uicompat.EventArgs) StorageType(org.ovirt.engine.core.common.businessentities.storage.StorageType) Collection(java.util.Collection) WanColorDepth(org.ovirt.engine.core.common.console.ConsoleOptions.WanColorDepth) Collectors(java.util.stream.Collectors) TagsType(org.ovirt.engine.core.common.businessentities.TagsType) GetPermittedStorageDomainsByStoragePoolIdParameters(org.ovirt.engine.core.common.queries.GetPermittedStorageDomainsByStoragePoolIdParameters) GlusterVolumeAdvancedDetails(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeAdvancedDetails) ApplicationModeHelper(org.ovirt.engine.ui.uicommonweb.models.ApplicationModeHelper) VDSStatus(org.ovirt.engine.core.common.businessentities.VDSStatus) GetTagsByUserGroupIdParameters(org.ovirt.engine.core.common.queries.GetTagsByUserGroupIdParameters) Entry(java.util.Map.Entry) Converter(org.ovirt.engine.ui.frontend.Converter) VdcEventNotificationUtils(org.ovirt.engine.core.common.VdcEventNotificationUtils) IStorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.IStorageModel) GetAllAttachableDisksForVmQueryParameters(org.ovirt.engine.core.common.queries.GetAllAttachableDisksForVmQueryParameters) IntegerCompat(org.ovirt.engine.core.compat.IntegerCompat) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) ImportIscsiStorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.ImportIscsiStorageModel) ExternalHostGroup(org.ovirt.engine.core.common.businessentities.ExternalHostGroup) GetAllServerCpuListParameters(org.ovirt.engine.core.common.queries.GetAllServerCpuListParameters) HashSet(java.util.HashSet) Frontend(org.ovirt.engine.ui.frontend.Frontend) GetTagsByUserIdParameters(org.ovirt.engine.core.common.queries.GetTagsByUserIdParameters) VolumeFormat(org.ovirt.engine.core.common.businessentities.storage.VolumeFormat) QueryParametersBase(org.ovirt.engine.core.common.queries.QueryParametersBase) CinderVolumeType(org.ovirt.engine.core.common.businessentities.storage.CinderVolumeType) GetStoragePoolsByClusterServiceParameters(org.ovirt.engine.core.common.queries.GetStoragePoolsByClusterServiceParameters) VmTemplateStatus(org.ovirt.engine.core.common.businessentities.VmTemplateStatus) GetVmChangedFieldsForNextRunParameters(org.ovirt.engine.core.common.queries.GetVmChangedFieldsForNextRunParameters) DbGroup(org.ovirt.engine.core.common.businessentities.aaa.DbGroup) ConfigurationType(org.ovirt.engine.core.common.businessentities.ConfigurationType) ClusterEditWarnings(org.ovirt.engine.core.common.businessentities.ClusterEditWarnings) GetHostListFromExternalProviderParameters(org.ovirt.engine.core.common.queries.GetHostListFromExternalProviderParameters) GetLunsByVgIdParameters(org.ovirt.engine.core.common.queries.GetLunsByVgIdParameters) Role(org.ovirt.engine.core.common.businessentities.Role) StorageDomainType(org.ovirt.engine.core.common.businessentities.StorageDomainType) Comparator(java.util.Comparator) VmManagementParametersBase(org.ovirt.engine.core.common.action.VmManagementParametersBase) RpmVersion(org.ovirt.engine.core.compat.RpmVersion) Arrays(java.util.Arrays) GetConnectionsByDataCenterAndStorageTypeParameters(org.ovirt.engine.core.common.queries.GetConnectionsByDataCenterAndStorageTypeParameters) Provider(org.ovirt.engine.core.common.businessentities.Provider) GetDataCentersWithPermittedActionOnClustersParameters(org.ovirt.engine.core.common.queries.GetDataCentersWithPermittedActionOnClustersParameters) ApplicationMode(org.ovirt.engine.core.common.mode.ApplicationMode) QuotaEnforcementTypeEnum(org.ovirt.engine.core.common.businessentities.QuotaEnforcementTypeEnum) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ActionType(org.ovirt.engine.core.common.action.ActionType) HostDeviceView(org.ovirt.engine.core.common.businessentities.HostDeviceView) GetVmTemplateParameters(org.ovirt.engine.core.common.queries.GetVmTemplateParameters) Snapshot(org.ovirt.engine.core.common.businessentities.Snapshot) Tags(org.ovirt.engine.core.common.businessentities.Tags) GlusterVolumeGeoRepEligibilityParameters(org.ovirt.engine.core.common.queries.gluster.GlusterVolumeGeoRepEligibilityParameters) SearchParameters(org.ovirt.engine.core.common.queries.SearchParameters) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) VmTemplate(org.ovirt.engine.core.common.businessentities.VmTemplate) Set(java.util.Set) NameQueryParameters(org.ovirt.engine.core.common.queries.NameQueryParameters) VmGuestAgentInterface(org.ovirt.engine.core.common.businessentities.VmGuestAgentInterface) EventNotificationEntity(org.ovirt.engine.core.common.EventNotificationEntity) GetVmTemplatesFromStorageDomainParameters(org.ovirt.engine.core.common.queries.GetVmTemplatesFromStorageDomainParameters) FenceAgent(org.ovirt.engine.core.common.businessentities.pm.FenceAgent) GlusterServiceQueryParameters(org.ovirt.engine.core.common.queries.gluster.GlusterServiceQueryParameters) PairQueryable(org.ovirt.engine.core.common.utils.PairQueryable) Label(org.ovirt.engine.core.common.businessentities.Label) ProviderType(org.ovirt.engine.core.common.businessentities.ProviderType) VdcObjectType(org.ovirt.engine.core.common.VdcObjectType) VmWithStatusForExclusiveLock(org.ovirt.engine.core.common.businessentities.VmWithStatusForExclusiveLock) ClusterEditParameters(org.ovirt.engine.core.common.queries.ClusterEditParameters) BondMode(org.ovirt.engine.core.common.businessentities.network.BondMode) LibvirtSecretUsageType(org.ovirt.engine.core.common.businessentities.storage.LibvirtSecretUsageType) VmIconIdSizePair(org.ovirt.engine.core.common.queries.VmIconIdSizePair) GlusterGeoRepNonEligibilityReason(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepNonEligibilityReason) GetStorageDomainDefaultWipeAfterDeleteParameters(org.ovirt.engine.core.common.queries.GetStorageDomainDefaultWipeAfterDeleteParameters) Guid(org.ovirt.engine.core.compat.Guid) GlusterServersQueryParameters(org.ovirt.engine.core.common.queries.gluster.GlusterServersQueryParameters) TreeSet(java.util.TreeSet) OsRepositoryVerb(org.ovirt.engine.core.common.queries.OsQueryParameters.OsRepositoryVerb) ArrayList(java.util.ArrayList) ArchCapabilitiesVerb(org.ovirt.engine.core.common.queries.ArchCapabilitiesParameters.ArchCapabilitiesVerb) StorageDomainStatic(org.ovirt.engine.core.common.businessentities.StorageDomainStatic) Permission(org.ovirt.engine.core.common.businessentities.Permission) VmHostDevice(org.ovirt.engine.core.common.businessentities.VmHostDevice) ConfigValues(org.ovirt.engine.core.common.config.ConfigValues) ImportFcpStorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.ImportFcpStorageModel) Disk(org.ovirt.engine.core.common.businessentities.storage.Disk) LocalStorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.LocalStorageModel) CertificateInfo(org.ovirt.engine.core.common.businessentities.CertificateInfo) Nameable(org.ovirt.engine.core.common.businessentities.Nameable) NumaTuneMode(org.ovirt.engine.core.common.businessentities.NumaTuneMode) NetworkQoS(org.ovirt.engine.core.common.businessentities.network.NetworkQoS) VmInterfaceType(org.ovirt.engine.core.common.businessentities.network.VmInterfaceType) GetAgentFenceOptionsQueryParameters(org.ovirt.engine.core.common.queries.GetAgentFenceOptionsQueryParameters) GetValidHostsForVmsParameters(org.ovirt.engine.core.common.queries.GetValidHostsForVmsParameters) StorageServerConnectionQueryParametersBase(org.ovirt.engine.core.common.queries.StorageServerConnectionQueryParametersBase) GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) QosQueryParameterBase(org.ovirt.engine.core.common.queries.QosQueryParameterBase) ServerParameters(org.ovirt.engine.core.common.queries.ServerParameters) NetworkFilterParameterModel(org.ovirt.engine.ui.uicommonweb.models.vms.NetworkFilterParameterModel) List(java.util.List) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) GetVmFromConfigurationQueryParameters(org.ovirt.engine.core.common.queries.GetVmFromConfigurationQueryParameters) GetVmFromOvaQueryParameters(org.ovirt.engine.core.common.queries.GetVmFromOvaQueryParameters) AuditLogType(org.ovirt.engine.core.common.AuditLogType) OsValueAutoCompleter(org.ovirt.engine.core.searchbackend.OsValueAutoCompleter) IFrontendMultipleQueryAsyncCallback(org.ovirt.engine.ui.uicompat.IFrontendMultipleQueryAsyncCallback) GlusterHookContentQueryParameters(org.ovirt.engine.core.common.queries.gluster.GlusterHookContentQueryParameters) GetAllFromExportDomainQueryParameters(org.ovirt.engine.core.common.queries.GetAllFromExportDomainQueryParameters) ArchitectureType(org.ovirt.engine.core.common.businessentities.ArchitectureType) GlusterHookEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterHookEntity) WanDisableEffects(org.ovirt.engine.core.common.console.ConsoleOptions.WanDisableEffects) IscsiStorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.IscsiStorageModel) HashMap(java.util.HashMap) ArchCapabilitiesParameters(org.ovirt.engine.core.common.queries.ArchCapabilitiesParameters) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) SimpleDependencyInjector(org.ovirt.engine.core.common.utils.SimpleDependencyInjector) VdsNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface) NoMigrationPolicy(org.ovirt.engine.core.common.migration.NoMigrationPolicy) GetTagsByVdsIdParameters(org.ovirt.engine.core.common.queries.GetTagsByVdsIdParameters) StorageDevice(org.ovirt.engine.core.common.businessentities.gluster.StorageDevice) GetTagsByVmIdParameters(org.ovirt.engine.core.common.queries.GetTagsByVmIdParameters) LexoNumericComparator(org.ovirt.engine.core.common.businessentities.comparators.LexoNumericComparator) GlusterVolumeSnapshotEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotEntity) Network(org.ovirt.engine.core.common.businessentities.network.Network) NameableComparator(org.ovirt.engine.core.common.businessentities.comparators.NameableComparator) GetHostsForStorageOperationParameters(org.ovirt.engine.core.common.queries.GetHostsForStorageOperationParameters) FcpStorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.FcpStorageModel) Iterator(java.util.Iterator) GlusterVolumeAdvancedDetailsParameters(org.ovirt.engine.core.common.queries.gluster.GlusterVolumeAdvancedDetailsParameters) ValidateVmMacsParameters(org.ovirt.engine.core.common.queries.ValidateVmMacsParameters) ActionGroup(org.ovirt.engine.core.common.businessentities.ActionGroup) Collections(java.util.Collections) VDS(org.ovirt.engine.core.common.businessentities.VDS) LUNs(org.ovirt.engine.core.common.businessentities.storage.LUNs) GetEntitiesWithPermittedActionParameters(org.ovirt.engine.core.common.queries.GetEntitiesWithPermittedActionParameters) AddedGlusterServersParameters(org.ovirt.engine.core.common.queries.gluster.AddedGlusterServersParameters) Version(org.ovirt.engine.core.compat.Version) RpmVersion(org.ovirt.engine.core.compat.RpmVersion) ArrayList(java.util.ArrayList) GetAllServerCpuListParameters(org.ovirt.engine.core.common.queries.GetAllServerCpuListParameters) QueryParametersBase(org.ovirt.engine.core.common.queries.QueryParametersBase) StorageServerConnectionQueryParametersBase(org.ovirt.engine.core.common.queries.StorageServerConnectionQueryParametersBase) IFrontendMultipleQueryAsyncCallback(org.ovirt.engine.ui.uicompat.IFrontendMultipleQueryAsyncCallback) ArrayList(java.util.ArrayList) List(java.util.List) QueryType(org.ovirt.engine.core.common.queries.QueryType)

Example 19 with ServerCpu

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

the class SearchQueryTest method mockCpuFlagsManagerHandler.

@Before
public void mockCpuFlagsManagerHandler() {
    ServerCpu resultCpu = new ServerCpu();
    resultCpu.setCpuName("cpu");
    when(cpuFlagsManagerHandler.findMaxServerCpuByFlags("flag", Version.getLast())).thenReturn(resultCpu);
}
Also used : ServerCpu(org.ovirt.engine.core.common.businessentities.ServerCpu) Before(org.junit.Before)

Example 20 with ServerCpu

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

the class GetHostArchitectureQuery method executeQueryCommand.

@Override
protected void executeQueryCommand() {
    VDS host = vdsDao.get(getParameters().getId());
    ServerCpu sc = cpuFlagsManagerHandler.findMaxServerCpuByFlags(host.getCpuFlags(), host.getClusterCompatibilityVersion());
    getQueryReturnValue().setReturnValue(sc == null ? ArchitectureType.undefined : sc.getArchitecture());
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) ServerCpu(org.ovirt.engine.core.common.businessentities.ServerCpu)

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