Search in sources :

Example 61 with Version

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

the class VdsManager method getHardwareInfo.

public void getHardwareInfo(VDS vds) {
    // Verify version capabilities
    Set<Version> hostVersions = vds.getSupportedClusterVersionsSet();
    Version clusterCompatibility = vds.getClusterCompatibilityVersion();
    // API won't exist for the host and an exception will be raised by VDSM.
    if (hostVersions != null && hostVersions.contains(clusterCompatibility)) {
        resourceManager.runVdsCommand(VDSCommandType.GetHardwareInfoAsync, new VdsIdAndVdsVDSCommandParametersBase(vds).withCallback(new HardwareInfoCallback(vds)));
    }
}
Also used : Version(org.ovirt.engine.core.compat.Version) VdsIdAndVdsVDSCommandParametersBase(org.ovirt.engine.core.common.vdscommands.VdsIdAndVdsVDSCommandParametersBase)

Example 62 with Version

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

the class ClusterModel method refreshMigrationPolicies.

public void refreshMigrationPolicies() {
    Version version = getEffectiveVersion();
    Guid selectedPolicyId = null;
    if (getMigrationPolicies() != null && getMigrationPolicies().getSelectedItem() != null) {
        selectedPolicyId = getMigrationPolicies().getSelectedItem().getId();
    }
    List<MigrationPolicy> policies = AsyncDataProvider.getInstance().getMigrationPolicies(version);
    getMigrationPolicies().setItems(policies);
    MigrationPolicy migrationPolicy;
    if (selectedPolicyId == null) {
        migrationPolicy = getIsEdit() ? findMigrationPolicyById(getEntity().getMigrationPolicyId(), policies) : findFirstNonEmptyMigrationPolicy(policies);
    } else {
        migrationPolicy = findMigrationPolicyById(selectedPolicyId, policies);
    }
    getMigrationPolicies().setSelectedItem(migrationPolicy != null ? migrationPolicy : findMigrationPolicyById(NoMigrationPolicy.ID, policies));
    getMigrationPolicies().updateChangeability(ConfigValues.MigrationPoliciesSupported, version);
}
Also used : Version(org.ovirt.engine.core.compat.Version) Guid(org.ovirt.engine.core.compat.Guid) NoMigrationPolicy(org.ovirt.engine.core.common.migration.NoMigrationPolicy) MigrationPolicy(org.ovirt.engine.core.common.migration.MigrationPolicy)

Example 63 with Version

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

the class ClusterModel method refreshAdditionalClusterFeaturesList.

private void refreshAdditionalClusterFeaturesList() {
    if (getVersion() == null || getVersion().getSelectedItem() == null) {
        return;
    }
    Version version = getVersion().getSelectedItem();
    ApplicationMode category = null;
    if (getEnableGlusterService().getEntity() && getEnableOvirtService().getEntity()) {
        category = ApplicationMode.AllModes;
    } else if (getEnableGlusterService().getEntity()) {
        category = ApplicationMode.GlusterOnly;
    } else if (getEnableOvirtService().getEntity()) {
        category = ApplicationMode.VirtOnly;
    }
    // Get all the addtional features avaivalble for the cluster
    startProgress();
    AsyncDataProvider.getInstance().getClusterFeaturesByVersionAndCategory(new AsyncQuery<>(features -> {
        stopProgress();
        // cluster
        if (getIsEdit() && !features.isEmpty()) {
            startProgress();
            AsyncDataProvider.getInstance().getClusterFeaturesByClusterId(new AsyncQuery<>(clusterFeatures -> {
                stopProgress();
                Set<AdditionalFeature> featuresEnabled = new HashSet<>();
                for (SupportedAdditionalClusterFeature feature : clusterFeatures) {
                    if (feature.isEnabled()) {
                        featuresEnabled.add(feature.getFeature());
                    }
                }
                updateAddtionClusterFeatureList(features, featuresEnabled);
            }), getEntity().getId());
        } else {
            updateAddtionClusterFeatureList(features, Collections.emptySet());
        }
    }), version, category);
}
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) SupportedAdditionalClusterFeature(org.ovirt.engine.core.common.businessentities.SupportedAdditionalClusterFeature) AdditionalFeature(org.ovirt.engine.core.common.businessentities.AdditionalFeature) ApplicationMode(org.ovirt.engine.core.common.mode.ApplicationMode) HashSet(java.util.HashSet)

Example 64 with Version

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

the class InClusterUpgradeWeightPolicyUnit method score.

@Override
public List<Pair<Guid, Integer>> score(Cluster cluster, List<VDS> hosts, VM vm, Map<String, String> parameters) {
    VdsDynamic referenceHost = getLastHost(vm);
    boolean isVmStartup = false;
    // Check if the VM is starting
    if (referenceHost == null) {
        isVmStartup = true;
        final Map<String, Version> highestVersions = new HashMap<>();
        for (VDS host : hosts) {
            OS os = OS.fromPackageVersionString(host.getHostOs());
            if (!os.isValid()) {
                continue;
            }
            Version version = highestVersions.get(os.getOsFamily());
            if (version == null || version.getMajor() < os.getVersion().getMajor()) {
                highestVersions.put(os.getOsFamily(), os.getVersion());
                referenceHost = host.getDynamicData();
            }
        }
        if (highestVersions.isEmpty()) {
            log.debug("No valid OS descriptors detected. Will not weight hosts on VM startup.");
            return noWeights(hosts);
        } else if (highestVersions.size() > 1) {
            log.debug("More than one OS family detected. Will not weight hosts on VM startup.");
            return noWeights(hosts);
        }
    }
    final OS lastHostOs = OS.fromPackageVersionString(referenceHost.getHostOs());
    if (!lastHostOs.isValid()) {
        log.debug("Reference host {} provides an invalid or incomplete OS identifier. Found {}.", referenceHost.getId(), referenceHost.getHostOs());
        return noWeights(hosts);
    }
    final List<Pair<Guid, Integer>> weights = new ArrayList<>();
    for (final VDS host : hosts) {
        final OS hostOs = OS.fromPackageVersionString(host.getHostOs());
        if (!hostOs.isValid()) {
            log.debug("Host {} does not provide an valid OS identifier. Found {}.", host.getId(), host.getHostOs());
            weights.add(toWeight(host, BAD_WEIGHT));
        } else if (!hostOs.isSameOsFamily(lastHostOs)) {
            log.debug("Host {} does not run the same operating system. Expected {}, found {}", host.getId(), lastHostOs.getName(), hostOs.getName());
            weights.add(toWeight(host, BAD_WEIGHT));
        } else if (hostOs.isOlderThan(lastHostOs) && !hostOs.isSameMajorVersion(lastHostOs)) {
            weights.add(toWeight(host, BAD_WEIGHT));
        } else if (hostOs.isSameMajorVersion(lastHostOs) && !isVmStartup) {
            weights.add(toWeight(host, BETTER_WEIGHT));
        } else {
            weights.add(toWeight(host, BEST_WEIGHT));
        }
    }
    return weights;
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) OS(org.ovirt.engine.core.utils.OS) Version(org.ovirt.engine.core.compat.Version) HashMap(java.util.HashMap) VdsDynamic(org.ovirt.engine.core.common.businessentities.VdsDynamic) ArrayList(java.util.ArrayList) Pair(org.ovirt.engine.core.common.utils.Pair)

Example 65 with Version

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

the class CompatibilityVersionFilterPolicyUnit method filter.

@Override
public List<VDS> filter(Cluster cluster, List<VDS> hosts, VM vm, Map<String, String> parameters, PerHostMessages messages) {
    // get required compatibility version
    Version vmCustomCompatibilityVersion = vm.getCustomCompatibilityVersion();
    if (vmCustomCompatibilityVersion == null) {
        // use cluster default - all hosts are valid
        return hosts;
    }
    // find compatible hosts
    List<VDS> hostsToRunOn = new ArrayList<>();
    for (VDS host : hosts) {
        if (host.getSupportedClusterVersionsSet().contains(vmCustomCompatibilityVersion)) {
            hostsToRunOn.add(host);
            log.debug("Host {} wasn't filtered out as it supports the VM required compatibility version({})", host.getName(), vmCustomCompatibilityVersion);
        } else {
            log.debug("Host {} was filtered out as it doesn't support the VM required compatibility-version ({}). Host supported compatibility-versions are: {}.", host.getName(), vmCustomCompatibilityVersion, host.getSupportedClusterLevels());
            messages.addMessage(host.getId(), String.format("$vmCompatibilityVersions %1$s", vmCustomCompatibilityVersion));
            messages.addMessage(host.getId(), String.format("$hostCompatibilityVersions %1$s", host.getSupportedClusterLevels()));
            messages.addMessage(host.getId(), EngineMessage.VAR__DETAIL__UNSUPPORTED_COMPATIBILITY_VERSION.toString());
        }
    }
    return hostsToRunOn;
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) Version(org.ovirt.engine.core.compat.Version) ArrayList(java.util.ArrayList)

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