Search in sources :

Example 86 with Version

use of org.ovirt.engine.core.compat.Version in project ovirt-engine by oVirt.

the class AddClusterRM method prepare2.

public void prepare2() {
    PreparingEnlistment enlistment = (PreparingEnlistment) context.enlistment;
    EnlistmentContext enlistmentContext = (EnlistmentContext) enlistment.getContext();
    HostListModel<?> model = enlistmentContext.getModel();
    ConfigureLocalStorageModel configureModel = (ConfigureLocalStorageModel) model.getWindow();
    Cluster candidate = configureModel.getCandidateCluster();
    ClusterModel clusterModel = configureModel.getCluster();
    String clusterName = clusterModel.getName().getEntity();
    if (candidate == null || !Objects.equals(candidate.getName(), clusterName)) {
        // Try to find existing cluster with the specified name.
        Cluster cluster = context.clusterFoundByName;
        if (cluster != null) {
            enlistmentContext.setClusterId(cluster.getId());
            context.enlistment = null;
            enlistment.prepared();
        } else {
            Version version = clusterModel.getVersion().getSelectedItem();
            cluster = new Cluster();
            cluster.setName(clusterName);
            cluster.setDescription(clusterModel.getDescription().getEntity());
            cluster.setStoragePoolId(enlistmentContext.getDataCenterId());
            cluster.setCpuName(clusterModel.getCPU().getSelectedItem().getCpuName());
            cluster.setMaxVdsMemoryOverCommit(clusterModel.getMemoryOverCommit());
            cluster.setCountThreadsAsCores(Boolean.TRUE.equals(clusterModel.getVersionSupportsCpuThreads().getEntity()) && Boolean.TRUE.equals(clusterModel.getCountThreadsAsCores().getEntity()));
            cluster.setTransparentHugepages(true);
            cluster.setCompatibilityVersion(version);
            cluster.setMigrateOnError(clusterModel.getMigrateOnErrorOption());
            ClusterOperationParameters parameters = new ManagementNetworkOnClusterOperationParameters(cluster);
            parameters.setCorrelationId(getCorrelationId());
            Frontend.getInstance().runAction(ActionType.AddCluster, parameters, result -> {
                ActionReturnValue returnValue = result.getReturnValue();
                context.addClusterReturnValue = returnValue;
                prepare3();
            });
        }
    } else {
        enlistmentContext.setClusterId(configureModel.getCluster().getClusterId());
        context.enlistment = null;
        enlistment.prepared();
    }
}
Also used : ClusterModel(org.ovirt.engine.ui.uicommonweb.models.clusters.ClusterModel) ManagementNetworkOnClusterOperationParameters(org.ovirt.engine.core.common.action.ManagementNetworkOnClusterOperationParameters) PreparingEnlistment(org.ovirt.engine.ui.uicompat.PreparingEnlistment) Version(org.ovirt.engine.core.compat.Version) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) ClusterOperationParameters(org.ovirt.engine.core.common.action.ClusterOperationParameters) ManagementNetworkOnClusterOperationParameters(org.ovirt.engine.core.common.action.ManagementNetworkOnClusterOperationParameters)

Example 87 with Version

use of org.ovirt.engine.core.compat.Version in project ovirt-engine by oVirt.

the class UpdateVmCommand method init.

@Override
protected void init() {
    super.init();
    if (getCluster() != null) {
        setStoragePoolId(getCluster().getStoragePoolId());
    }
    if (isVmExist() && isCompatibilityVersionSupportedByCluster(getEffectiveCompatibilityVersion())) {
        Version compatibilityVersion = getEffectiveCompatibilityVersion();
        getVmPropertiesUtils().separateCustomPropertiesToUserAndPredefined(compatibilityVersion, getParameters().getVmStaticData());
        getVmPropertiesUtils().separateCustomPropertiesToUserAndPredefined(compatibilityVersion, getVm().getStaticData());
    }
    vmHandler.updateDefaultTimeZone(getParameters().getVmStaticData());
    vmHandler.autoSelectUsbPolicy(getParameters().getVmStaticData());
    vmHandler.autoSelectResumeBehavior(getParameters().getVmStaticData(), getCluster());
    vmHandler.autoSelectDefaultDisplayType(getVmId(), getParameters().getVmStaticData(), getCluster(), getParameters().getGraphicsDevices());
    updateParametersVmFromInstanceType();
    // we always need to verify new or existing numa nodes with the updated VM configuration
    if (!getParameters().isUpdateNuma()) {
        getParameters().getVm().setvNumaNodeList(vmNumaNodeDao.getAllVmNumaNodeByVmId(getParameters().getVmId()));
    }
    if (getParameters().getVmStaticData().getDefaultDisplayType() == DisplayType.none && !getParameters().isConsoleEnabled()) {
        getParameters().getVmStaticData().setUsbPolicy(UsbPolicy.DISABLED);
    }
}
Also used : Version(org.ovirt.engine.core.compat.Version)

Example 88 with Version

use of org.ovirt.engine.core.compat.Version 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 89 with Version

use of org.ovirt.engine.core.compat.Version in project ovirt-engine by oVirt.

the class GetAvailableClusterVersionsByStoragePoolQuery method executeQueryCommand.

@Override
protected void executeQueryCommand() {
    if (getParameters().getId() != null) {
        ArrayList<Version> result = new ArrayList<>();
        StoragePool storagePool = storagePoolDao.get(getParameters().getId());
        if (storagePool != null) {
            // return all versions that >= to the storage pool version
            for (Version supportedVer : Config.<HashSet<Version>>getValue(ConfigValues.SupportedClusterLevels)) {
                // decrease version
                if (supportedVer.compareTo(storagePool.getCompatibilityVersion()) < 0) {
                    continue;
                }
                result.add(supportedVer);
            }
        }
        getQueryReturnValue().setReturnValue(result);
    } else {
        getQueryReturnValue().setReturnValue(new ArrayList<>(Config.<HashSet<Version>>getValue(ConfigValues.SupportedClusterLevels)));
    }
}
Also used : StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) Version(org.ovirt.engine.core.compat.Version) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet)

Example 90 with Version

use of org.ovirt.engine.core.compat.Version in project ovirt-engine by oVirt.

the class HandleVdsVersionCommand method executeCommand.

@Override
protected void executeCommand() {
    VDS vds = getVds();
    Cluster cluster = getCluster();
    boolean isEngineSupportedByVdsm = false;
    // partialVdcVersion will hold the engine's version (minor and major parts),
    // this will be compared to vdsm supported engines to see if vdsm can be added
    // to cluster
    Version partialVdcVersion = new Version(new Version(Config.getValue(ConfigValues.VdcVersion)).toString(2));
    RpmVersion vdsVersion = vds.getVersion();
    Version vdsmVersion = new Version(vdsVersion.getMajor(), vdsVersion.getMinor());
    if (!StringUtils.isEmpty(vds.getSupportedEngines())) {
        isEngineSupportedByVdsm = vds.getSupportedENGINESVersionsSet().contains(partialVdcVersion);
    }
    // and cluster supports the specific vdsm version. which is sufficient
    if (!isEngineSupportedByVdsm && !Config.<HashSet<Version>>getValue(ConfigValues.SupportedVDSMVersions).contains(vdsmVersion)) {
        reportNonOperationReason(NonOperationalReason.VERSION_INCOMPATIBLE_WITH_CLUSTER, Config.<HashSet<Version>>getValue(ConfigValues.SupportedVDSMVersions).toString(), vdsmVersion.toString());
    } else if (!VersionSupport.checkClusterVersionSupported(cluster.getCompatibilityVersion(), vds)) {
        reportNonOperationReason(NonOperationalReason.CLUSTER_VERSION_INCOMPATIBLE_WITH_CLUSTER, cluster.getCompatibilityVersion().toString(), vds.getSupportedClusterLevels());
    } else {
        checkClusterAdditionalFeaturesSupported(cluster, vds);
    }
    setSucceeded(true);
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) RpmVersion(org.ovirt.engine.core.compat.RpmVersion) Version(org.ovirt.engine.core.compat.Version) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) RpmVersion(org.ovirt.engine.core.compat.RpmVersion) HashSet(java.util.HashSet)

Aggregations

Version (org.ovirt.engine.core.compat.Version)102 ArrayList (java.util.ArrayList)24 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)20 Guid (org.ovirt.engine.core.compat.Guid)20 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)17 Map (java.util.Map)16 List (java.util.List)15 HashSet (java.util.HashSet)14 VDS (org.ovirt.engine.core.common.businessentities.VDS)14 HashMap (java.util.HashMap)13 ServerCpu (org.ovirt.engine.core.common.businessentities.ServerCpu)12 VM (org.ovirt.engine.core.common.businessentities.VM)11 ConfigValues (org.ovirt.engine.core.common.config.ConfigValues)11 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)11 Arrays (java.util.Arrays)10 MigrationPolicy (org.ovirt.engine.core.common.migration.MigrationPolicy)10 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)10 Collection (java.util.Collection)9 Collections (java.util.Collections)9 ArchitectureType (org.ovirt.engine.core.common.businessentities.ArchitectureType)9