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