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)));
}
}
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);
}
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);
}
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;
}
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;
}
Aggregations