use of org.ovirt.engine.core.compat.Version in project ovirt-engine by oVirt.
the class SnapshotModel method setOldClusterVersionOfSnapshotWithMemory.
public void setOldClusterVersionOfSnapshotWithMemory(VM vm) {
if (!isVMWithMemoryCompatible(vm)) {
// message regarding old cluster snapshot will be shown
Version originalClusterVersion = vm.getClusterCompatibilityVersionOrigin();
originalClusterVersion = (originalClusterVersion == null) ? Version.v3_6 : originalClusterVersion;
oldClusterVersionOfSnapshotWithMemory = originalClusterVersion;
} else {
oldClusterVersionOfSnapshotWithMemory = null;
}
}
use of org.ovirt.engine.core.compat.Version in project ovirt-engine by oVirt.
the class ExistingVmModelBehavior method loadDataCenter.
private void loadDataCenter() {
// Preinitialize the VM compatibility version because it's needed during init
Version newCustomCompatibilityVersion = ((ExistingVmModelBehavior) getModel().getBehavior()).getVm().getStaticData().getCustomCompatibilityVersion();
if (newCustomCompatibilityVersion != null) {
getModel().getCustomCompatibilityVersion().setItems(Collections.singletonList(newCustomCompatibilityVersion), newCustomCompatibilityVersion);
}
AsyncDataProvider.getInstance().getDataCenterById(asyncQuery(dataCenter -> {
if (dataCenter != null) {
final List<StoragePool> dataCenters = new ArrayList<>(Arrays.asList(new StoragePool[] { dataCenter }));
initClusters(dataCenters);
} else {
ExistingVmModelBehavior behavior = (ExistingVmModelBehavior) getModel().getBehavior();
VM currentVm = behavior.vm;
Cluster cluster = new Cluster();
cluster.setId(currentVm.getClusterId());
cluster.setName(currentVm.getClusterName());
cluster.setCompatibilityVersion(currentVm.getClusterCompatibilityVersion());
cluster.setStoragePoolId(currentVm.getStoragePoolId());
DataCenterWithCluster dataCenterWithCluster = new DataCenterWithCluster(null, cluster);
getModel().getDataCenterWithClustersList().setItems(Arrays.asList(dataCenterWithCluster));
getModel().getDataCenterWithClustersList().setSelectedItem(dataCenterWithCluster);
behavior.initTemplate();
behavior.updateCdImage();
}
}), vm.getStoragePoolId());
}
use of org.ovirt.engine.core.compat.Version in project ovirt-engine by oVirt.
the class ExistingVmModelBehavior method isHotSetCpuSupported.
public boolean isHotSetCpuSupported() {
Cluster selectedCluster = getModel().getSelectedCluster();
Version compatibilityVersion = getModel().getCompatibilityVersion();
boolean hotplugCpuSupported = Boolean.parseBoolean(((Map<String, String>) AsyncDataProvider.getInstance().getConfigValuePreConverted(ConfigValues.HotPlugCpuSupported, compatibilityVersion.getValue())).get(selectedCluster.getArchitecture().name()));
return getVm().getStatus() == VMStatus.Up && hotplugCpuSupported;
}
use of org.ovirt.engine.core.compat.Version in project ovirt-engine by oVirt.
the class GetAllSupportedNetworkFiltersByVersionQuery method executeQueryCommand.
@Override
protected void executeQueryCommand() {
Version version = getParameters().getVersion();
Collection<NetworkFilter> networkFilters = networkFilterDao.getAllSupportedNetworkFiltersByVersion(version);
getQueryReturnValue().setReturnValue(networkFilters);
}
use of org.ovirt.engine.core.compat.Version in project ovirt-engine by oVirt.
the class RunVmCommand method guestToolsVersionTreatment.
/**
* If vds version greater then vm's and vm not running with cd and there is appropriate RhevAgentTools image -
* add it to vm as cd.
*/
private String guestToolsVersionTreatment() {
boolean attachCd = false;
String selectedToolsVersion = "";
String selectedToolsClusterVersion = "";
Guid isoDomainId = getActiveIsoDomainId();
if (osRepository.isWindows(getVm().getVmOsId()) && null != isoDomainId) {
// get cluster version of the vm tools
Version vmToolsClusterVersion = null;
if (getVm().getHasAgent()) {
Version clusterVer = getVm().getPartialVersion();
if (new Version("4.4").equals(clusterVer)) {
vmToolsClusterVersion = new Version("2.1");
} else {
vmToolsClusterVersion = clusterVer;
}
}
// Fetch cached Iso files from active Iso domain.
List<RepoImage> repoFilesMap = getIsoDomainListSynchronizer().getCachedIsoListByDomainId(isoDomainId, ImageFileType.ISO);
Version bestClusterVer = null;
int bestToolVer = 0;
for (RepoImage map : repoFilesMap) {
String fileName = StringUtils.defaultString(map.getRepoImageId(), "");
Matcher matchToolPattern = Pattern.compile(IsoDomainListSynchronizer.REGEX_TOOL_PATTERN).matcher(fileName);
if (matchToolPattern.find()) {
// Get cluster version and tool version of Iso tool.
Version clusterVer = new Version(matchToolPattern.group(IsoDomainListSynchronizer.TOOL_CLUSTER_LEVEL));
int toolVersion = Integer.parseInt(matchToolPattern.group(IsoDomainListSynchronizer.TOOL_VERSION));
if (clusterVer.compareTo(getVm().getCompatibilityVersion()) <= 0) {
if ((bestClusterVer == null) || (clusterVer.compareTo(bestClusterVer) > 0)) {
bestToolVer = toolVersion;
bestClusterVer = clusterVer;
} else if (clusterVer.equals(bestClusterVer) && toolVersion > bestToolVer) {
bestToolVer = toolVersion;
bestClusterVer = clusterVer;
}
}
}
}
if (bestClusterVer != null && (vmToolsClusterVersion == null || vmToolsClusterVersion.compareTo(bestClusterVer) < 0 || (vmToolsClusterVersion.equals(bestClusterVer) && getVm().getHasAgent() && getVm().getGuestAgentVersion().getBuild() < bestToolVer))) {
// Vm has no tools or there are new tools
selectedToolsVersion = Integer.toString(bestToolVer);
selectedToolsClusterVersion = bestClusterVer.toString();
attachCd = true;
}
}
if (attachCd) {
String rhevToolsPath = String.format("%1$s%2$s_%3$s.iso", IsoDomainListSynchronizer.getGuestToolsSetupIsoPrefix(), selectedToolsClusterVersion, selectedToolsVersion);
String isoDir = (String) runVdsCommand(VDSCommandType.IsoDirectory, new IrsBaseVDSCommandParameters(getVm().getStoragePoolId())).getReturnValue();
rhevToolsPath = isoDir + File.separator + rhevToolsPath;
return rhevToolsPath;
}
return null;
}
Aggregations