Hello Alon Bar-Lev,
I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/23538
to review the following change.
Change subject: oVirt Node Upgrade: Support N configuration
......................................................................
oVirt Node Upgrade: Support N configuration
To have multiple configurations supported for node upgrade and same code
for upstream/downstream, this patch will include the delimiter ":" to the below
elements in vdc_options.
- OvirtInitialSupportedIsoVersion
- oVirtISOsRepositoryPath
- OvirtIsoPrefix
Additionally:
- OvirtIsoPrefix now includes prefix and regex to list ISOs.
- Includes OvirtNodeOS to regex node OS
- New class OVirtNodeInfo to hold informations about upgrade.
Change-Id: Ibfb9dc5d0dc8780b519107acbe0ae866831f782c
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=979231
Signed-off-by: Alon Bar-Lev <[email protected]>
Signed-off-by: Douglas Schilling Landgraf <[email protected]>
---
M
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetoVirtISOsQuery.java
M
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InstallVdsCommand.java
A
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/OVirtNodeInfo.java
M
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/OVirtNodeUpgrade.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/GetoVirtISOsTest.java
M
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/InstallVdsCommandTest.java
M
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java
M packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql
8 files changed, 236 insertions(+), 198 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/38/23538/1
diff --git
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetoVirtISOsQuery.java
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetoVirtISOsQuery.java
index ca0c56b..07da53e 100644
---
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetoVirtISOsQuery.java
+++
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetoVirtISOsQuery.java
@@ -4,21 +4,16 @@
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
-import java.io.FilenameFilter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-import java.util.regex.Pattern;
+import java.util.regex.Matcher;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.ovirt.engine.core.common.businessentities.VDS;
-import org.ovirt.engine.core.common.businessentities.VDSType;
-import org.ovirt.engine.core.common.config.Config;
-import org.ovirt.engine.core.common.config.ConfigValues;
import org.ovirt.engine.core.common.queries.VdsIdParametersBase;
-import org.ovirt.engine.core.common.utils.RpmVersionUtils;
import org.ovirt.engine.core.compat.Guid;
import org.ovirt.engine.core.compat.RpmVersion;
import org.ovirt.engine.core.compat.Version;
@@ -29,11 +24,8 @@
* verifies image files exist, and returns list of ISOs sorted by their
version.
*/
public class GetoVirtISOsQuery<P extends VdsIdParametersBase> extends
QueriesCommandBase<P> {
- private static Pattern isoPattern;
private static final String OVIRT_ISO_VERSION_PREFIX = "version";
private static final String OVIRT_ISO_VDSM_COMPATIBILITY_PREFIX =
"vdsm-compatibility";
- private static final String OVIRT_ISO_VERSION_PATTERN =
OVIRT_ISO_VERSION_PREFIX + "-.*.txt";
- private static final Pattern isoVersionPattern =
Pattern.compile(OVIRT_ISO_VERSION_PATTERN);
public GetoVirtISOsQuery(P parameters) {
super(parameters);
@@ -41,20 +33,37 @@
@Override
protected void executeQueryCommand() {
-
- RpmVersion vdsOsVersion = getOvirtOsVersion();
-
List<RpmVersion> availableISOsList = new ArrayList<RpmVersion>();
- File directory = new File(Config.resolveOVirtISOsRepositoryPath());
- if (directory.isDirectory()) {
- List<String> listOfIsoFiles = getListOfIsoFiles(directory);
- if (!listOfIsoFiles.isEmpty()) {
+ VDS vds = getVdsByVdsId(getParameters().getVdsId());
+ if (vds == null) {
+ getQueryReturnValue().setReturnValue(availableISOsList);
+ return;
+ }
- File[] ovirtVersionFiles = filterOvirtFiles(directory,
isoVersionPattern);
+ RpmVersion vdsOsVersion = VdsHandler.getOvirtHostOsVersion(vds);
+ String nodeOS = vds.getHostOs();
+ for (OVirtNodeInfo.Entry info : OVirtNodeInfo.getInstance().get()) {
+ log.debugFormat(
+ "nodeOS [{0}] | osPattern [{1}] | minimumVersion [{2}]",
+ nodeOS,
+ info.osPattern,
+ info.minimumVersion
+ );
- for (File versionFile : ovirtVersionFiles) {
- try {
+ Matcher matcher = info.osPattern.matcher(nodeOS);
+ if (matcher.matches() && info.path.isDirectory()) {
+ log.debugFormat("Looking for list of ISOs in [{0}], regex
[{1}]", info.path, info.isoPattern);
+ for (File file : info.path.listFiles()) {
+ matcher = info.isoPattern.matcher(file.getName());
+ if (matcher.matches()) {
+ log.debugFormat("ISO Found [{0}]", file);
+ String version = matcher.group(1);
+ log.debugFormat("ISO Version [{0}]", version);
+ File versionFile = new File(info.path,
String.format("version-%s.txt", version));
+ log.debugFormat("versionFile [{0}]", versionFile);
+
+ // Setting IsoData Class to get further [version] and
[vdsm compatibility version] data
IsoData isoData = new IsoData();
isoData.setVersion(readIsoVersion(versionFile));
String isoVersionText = isoData.getVersion();
@@ -62,7 +71,7 @@
versionFile.getAbsolutePath().replace(OVIRT_ISO_VERSION_PREFIX,
OVIRT_ISO_VDSM_COMPATIBILITY_PREFIX))));
- if (StringUtils.isBlank(isoVersionText)) {
+ if (StringUtils.isEmpty(isoVersionText)) {
log.debugFormat("Iso version file {0} is empty.",
versionFile.getAbsolutePath());
continue;
}
@@ -74,46 +83,16 @@
continue;
}
- String majorVersionStr = versionParts[0];
- String releaseStr = versionParts[1];
- String isoFileName =
getIsoFileNameByVersion(listOfIsoFiles, majorVersionStr, releaseStr);
- if (isoFileName == null) {
- log.debugFormat("Iso version file {0} has no
matching iso file searched by version parts: {1} and {2}.",
- versionFile.getAbsolutePath(),
- majorVersionStr,
- releaseStr);
- continue;
- }
+ RpmVersion isoVersion = new RpmVersion(file.getName());
- RpmVersion isoVersion = new RpmVersion(isoFileName,
getOvirtIsoPrefix(), true);
- boolean shouldAdd = false;
-
- String rpmParts[] =
RpmVersionUtils.splitRpmToParts(isoFileName);
- if (isoVersion != null &&
isIsoVersionSupported(rpmParts[1])) {
- if (isoData.getVdsmCompatibilityVersion() != null)
{
- shouldAdd =
isIsoCompatibleForUpgradeByClusterVersion(isoData);
- } else if (vdsOsVersion != null) {
- if
(VdsHandler.isIsoVersionCompatibleForUpgrade(vdsOsVersion, isoVersion)) {
- shouldAdd = true;
- }
- } else {
- shouldAdd = true;
- }
- }
-
- if (shouldAdd) {
+ if (isoData.getVdsmCompatibilityVersion() != null &&
isIsoCompatibleForUpgradeByClusterVersion(isoData) ||
+ vdsOsVersion != null &&
VdsHandler.isIsoVersionCompatibleForUpgrade(vdsOsVersion, isoVersion)
+ ) {
availableISOsList.add(isoVersion);
}
- } catch (RuntimeException e) {
- log.errorFormat("Failed to parse ovirt iso version {0}
with error {1}",
- versionFile.getAbsolutePath(),
- ExceptionUtils.getMessage(e));
}
-
}
}
- } else {
- log.errorFormat("ovirt ISOs directory not found. Search in: {0}",
directory.getPath());
}
Collections.sort(availableISOsList);
getQueryReturnValue().setReturnValue(availableISOsList);
@@ -132,35 +111,12 @@
private boolean isNewerVersion(Version isoClusterVersion) {
VDS vds = getVdsByVdsId(getParameters().getVdsId());
Version vdsClusterVersion = vds.getVdsGroupCompatibilityVersion();
+ log.debugFormat(
+ "vdsClusterVersion {0} isoClusterVersion {1}",
+ vdsClusterVersion,
+ isoClusterVersion
+ );
return (vdsClusterVersion.getMajor() == isoClusterVersion.getMajor()
&& vdsClusterVersion.getMinor() <= isoClusterVersion.getMinor());
- }
-
- private RpmVersion getOvirtOsVersion() {
- VDS vds = getVdsByVdsId(getParameters().getVdsId());
- RpmVersion vdsOsVersion = null;
- if (vds != null && vds.getVdsType() == VDSType.oVirtNode) {
- vdsOsVersion = VdsHandler.getOvirtHostOsVersion(vds);
- }
- return vdsOsVersion;
- }
-
- private static String getIsoFileNameByVersion(List<String> listOfIsoFiles,
String majorVersionStr, String releaseStr) {
- Pattern pattern = Pattern.compile(majorVersionStr + ".*" + releaseStr);
- for (String fileName : listOfIsoFiles) {
- if (pattern.matcher(fileName).find()) {
- return fileName;
- }
- }
- return null;
- }
-
- private static List<String> getListOfIsoFiles(File directory) {
- List<String> isoFileList = new ArrayList<String>();
- File[] filterOvirtFiles = filterOvirtFiles(directory, getIsoPattern());
- for (File file : filterOvirtFiles) {
- isoFileList.add(file.getName());
- }
- return isoFileList;
}
private String[] readVdsmCompatibiltyVersion(String fileName) {
@@ -222,20 +178,6 @@
return isoVersionText;
}
- private static File[] filterOvirtFiles(File directory, final Pattern
pattern) {
- return directory.listFiles(new FilenameFilter() {
- @Override
- public boolean accept(File dir, String name) {
- return pattern.matcher(name).find();
- }
- });
- }
-
- private boolean isIsoVersionSupported(String isoVersion) {
- String supported = Config.<String>
getValue(ConfigValues.OvirtInitialSupportedIsoVersion);
- return RpmVersionUtils.compareRpmParts(isoVersion, supported) >= 0;
- }
-
public VDS getVdsByVdsId(Guid vdsId) {
VDS vds = null;
@@ -243,24 +185,6 @@
vds = getDbFacade().getVdsDao().get(vdsId);
}
return vds;
- }
-
- /** @return The prefix for oVirt ISO files, from the configuration */
- private static String getOvirtIsoPrefix() {
- return Config.<String> getValue(ConfigValues.OvirtIsoPrefix);
- }
-
- /**
- * Returns the pattern for ISO files.
- * Since the prefix from the configuration may change (reloadable
configuration), it is checked each time.
- * A cached version of pattern is saved, though, to avoid the overhead of
re-compiling it.
- */
- private static Pattern getIsoPattern() {
- String expectedPattern = getOvirtIsoPrefix() + "-.*.iso";
- if (isoPattern == null ||
!expectedPattern.equals(isoPattern.toString())) {
- isoPattern = Pattern.compile(expectedPattern);
- }
- return isoPattern;
}
private class IsoData {
diff --git
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InstallVdsCommand.java
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InstallVdsCommand.java
index 6a949d2..4cb0c64 100644
---
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InstallVdsCommand.java
+++
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InstallVdsCommand.java
@@ -3,9 +3,9 @@
import java.io.File;
import java.util.Collections;
import java.util.Map;
+import java.util.regex.Matcher;
import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang.exception.ExceptionUtils;
import org.ovirt.engine.core.bll.network.NetworkConfigurator;
import org.ovirt.engine.core.common.AuditLogType;
import org.ovirt.engine.core.common.FeatureSupported;
@@ -15,8 +15,6 @@
import org.ovirt.engine.core.common.businessentities.ProviderType;
import org.ovirt.engine.core.common.businessentities.VDSStatus;
import org.ovirt.engine.core.common.businessentities.VDSType;
-import org.ovirt.engine.core.common.config.Config;
-import org.ovirt.engine.core.common.config.ConfigValues;
import org.ovirt.engine.core.common.errors.VdcBllMessages;
import org.ovirt.engine.core.common.locks.LockingGroup;
import org.ovirt.engine.core.common.utils.Pair;
@@ -36,6 +34,51 @@
private static Log log = LogFactory.getLog(InstallVdsCommand.class);
private static final String GENERIC_ERROR = "Please refer to engine.log
and log files under /var/log/ovirt-engine/host-deploy/ on the engine for
further details.";
protected String _failureMessage = null;
+ protected File _iso = null;
+
+ private File resolveISO(String iso) {
+ File ret = null;
+
+ // do not allow exiting the designated paths
+ if (iso != null && iso.indexOf(File.pathSeparatorChar) == -1) {
+ for (OVirtNodeInfo.Entry info : OVirtNodeInfo.getInstance().get())
{
+ File path = new File(info.path, iso);
+ if (path.exists()) {
+ ret = path;
+ break;
+ }
+ }
+ }
+
+ return ret;
+ }
+
+ private boolean isISOCompatible(
+ File iso,
+ RpmVersion ovirtHostOsVersion
+ ) {
+ boolean ret = false;
+
+ log.debugFormat("Check if ISO compatible: {0}", iso);
+
+ for (OVirtNodeInfo.Entry info : OVirtNodeInfo.getInstance().get()) {
+ if (info.path.equals(iso.getParentFile())) {
+ Matcher matcher = info.isoPattern.matcher(iso.getName());
+ if (matcher.find()) {
+ String rpmLike = matcher.group(1).replaceAll("-", ".");
+ log.debugFormat("ISO version: {0} {1} {3}", iso, rpmLike,
ovirtHostOsVersion);
+ RpmVersion isoVersion = new RpmVersion(rpmLike, "", true);
+ if
(VdsHandler.isIsoVersionCompatibleForUpgrade(ovirtHostOsVersion, isoVersion)) {
+ log.debugFormat("ISO compatible: {0}", iso);
+ ret = true;
+ break;
+ }
+ }
+ }
+ }
+
+ return ret;
+ }
public InstallVdsCommand(T parameters) {
super(parameters);
@@ -43,40 +86,32 @@
@Override
protected boolean canDoAction() {
- boolean retValue=true;
if (getVdsId() == null || getVdsId().equals(Guid.Empty)) {
- addCanDoActionMessage(VdcBllMessages.VDS_INVALID_SERVER_ID);
- retValue = false;
- } else if (getVds() == null) {
-
addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_HOST_NOT_EXIST);
- retValue = false;
- } else if (isOvirtReInstallOrUpgrade()) {
- String isoFile = getParameters().getoVirtIsoFile();
+ return failCanDoAction(VdcBllMessages.VDS_INVALID_SERVER_ID);
+ }
+ if (getVds() == null) {
+ return
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_HOST_NOT_EXIST);
+ }
+ if (isOvirtReInstallOrUpgrade()) {
// Block re-install on non-operational Host
if (getVds().getStatus() == VDSStatus.NonOperational) {
-
addCanDoActionMessage(VdcBllMessages.VDS_CANNOT_INSTALL_STATUS_ILLEGAL);
- retValue = false;
+ return
failCanDoAction(VdcBllMessages.VDS_CANNOT_INSTALL_STATUS_ILLEGAL);
}
- if (!isIsoFileValid(isoFile)) {
-
addCanDoActionMessage(VdcBllMessages.VDS_CANNOT_INSTALL_MISSING_IMAGE_FILE);
- retValue = false;
- } else {
- RpmVersion ovirtHostOsVersion =
VdsHandler.getOvirtHostOsVersion(getVds());
- if (ovirtHostOsVersion != null &&
!isIsoVersionCompatible(ovirtHostOsVersion, isoFile)) {
+
+ File iso = resolveISO(getParameters().getoVirtIsoFile());
+ if (iso == null) {
+ return
failCanDoAction(VdcBllMessages.VDS_CANNOT_INSTALL_MISSING_IMAGE_FILE);
+ }
+
+ RpmVersion ovirtHostOsVersion =
VdsHandler.getOvirtHostOsVersion(getVds());
+ if (!isISOCompatible(iso, ovirtHostOsVersion)) {
addCanDoActionMessage(VdcBllMessages.VDS_CANNOT_UPGRADE_BETWEEN_MAJOR_VERSION);
addCanDoActionMessage(String.format("$IsoVersion %1$s",
ovirtHostOsVersion.getMajor()));
- retValue = false;
- }
+ return false;
}
+ _iso = iso;
}
- return retValue;
- }
-
- private boolean isIsoFileValid(String isoFile) {
- return (
- StringUtils.isNotBlank(isoFile) &&
- new File(Config.resolveOVirtISOsRepositoryPath() + File.separator
+ isoFile).exists()
- );
+ return true;
}
@Override
@@ -223,7 +258,7 @@
try (
final OVirtNodeUpgrade upgrade = new OVirtNodeUpgrade(
getVds(),
- getParameters().getoVirtIsoFile()
+ _iso
)
) {
upgrade.setCorrelationId(getCorrelationId());
@@ -297,40 +332,6 @@
e
);
}
- }
-
- /**
- * Upgrade of image version is allowed only between the same major version
of operating system. Both oVirt node OS
- * version and suggested ISO file version are compared to validate version
compatibility.
- *
- * @param ovirtOsVersion
- * the version of the RHEV-H host
- * @param isoFile
- * the ISO file for upgrade
- * @return true if ISO is compatible with oVirt node OS version or if
failed to resolve Host or RHEV-H version
- */
- public boolean isIsoVersionCompatible(RpmVersion ovirtOsVersion, String
isoFile) {
- boolean retValue = true;
- if (ovirtOsVersion != null) {
- try {
- RpmVersion isoVersion = new RpmVersion(
- isoFile,
- Config.<String> getValue(ConfigValues.OvirtIsoPrefix),
- true
- );
-
- if
(!VdsHandler.isIsoVersionCompatibleForUpgrade(ovirtOsVersion, isoVersion)) {
- retValue = false;
- }
- } catch (RuntimeException e) {
- log.warnFormat(
- "Failed to parse ISO file version {0} with error {1}",
- isoFile,
- ExceptionUtils.getMessage(e)
- );
- }
- }
- return retValue;
}
/**
diff --git
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/OVirtNodeInfo.java
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/OVirtNodeInfo.java
new file mode 100644
index 0000000..c48e4e2
--- /dev/null
+++
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/OVirtNodeInfo.java
@@ -0,0 +1,88 @@
+package org.ovirt.engine.core.bll;
+
+import java.io.File;
+import java.util.List;
+import java.util.LinkedList;
+import java.util.regex.Pattern;
+
+import org.ovirt.engine.core.utils.log.Log;
+import org.ovirt.engine.core.utils.log.LogFactory;
+import org.ovirt.engine.core.common.config.Config;
+import org.ovirt.engine.core.common.config.ConfigValues;
+
+public class OVirtNodeInfo {
+
+ public static class Entry {
+ public Pattern isoPattern;
+ public File path;
+ public String minimumVersion;
+ public Pattern osPattern;
+ }
+
+ private static final Log log = LogFactory.getLog(OVirtNodeInfo.class);
+ private static final String delimiter = ":";
+ private static volatile OVirtNodeInfo instance;
+
+ private List<Entry> info;
+
+ public static synchronized OVirtNodeInfo getInstance() {
+ if (instance == null) {
+ instance = new OVirtNodeInfo();
+ }
+ else {
+ if (instance == null) {
+ synchronized(OVirtNodeInfo.class) {
+ if (instance == null) {
+ instance = new OVirtNodeInfo();
+ }
+ }
+ }
+ }
+ return instance;
+ }
+
+ public static void clearInstance() {
+ synchronized(OVirtNodeInfo.class) {
+ instance = null;
+ }
+ }
+
+ private OVirtNodeInfo() {
+ final String[] path =
Config.resolveOVirtISOsRepositoryPath().split(delimiter);
+ final String minimumVersion[] = Config.<String>
getValue(ConfigValues.OvirtInitialSupportedIsoVersion).split(delimiter);
+
+ // Node prefix is part of regex to list ISOs (OvirtIsoPrefix)
+ // Regex: (ovirt-node)-(.*)\.iso (used to list ISOs)
+ // Prefix Found: ovirt-node
+ final String regexISO[] = Config.<String>
getValue(ConfigValues.OvirtIsoPrefix).split(delimiter);
+
+ // Node OS
+ final String regexNode[] = Config.<String>
getValue(ConfigValues.OvirtNodeOS).split(delimiter);
+
+ info = new LinkedList<Entry>();
+
+ log.debugFormat("NodeInfo: regexISO length {0} minimum length {1} path
length {2} regexNode {3}",
+ regexISO.length, minimumVersion.length, path.length,
regexNode.length);
+
+ if (regexISO.length != minimumVersion.length ||
+ regexISO.length != path.length ||
+ regexISO.length != regexNode.length) {
+ throw new IllegalArgumentException("Illegal NodeInfo - length");
+ }
+
+ for (int i=0; i < regexISO.length; i++) {
+ log.debugFormat("NodeInfo: regexISO {0} path {1}, minimumVersion
{2} regexNode {3}",
+ regexISO[i], path[i], minimumVersion[i], regexNode[i]);
+ Entry entry = new Entry();
+ entry.isoPattern = Pattern.compile(regexISO[i]);
+ entry.osPattern = Pattern.compile(regexNode[i],
Pattern.CASE_INSENSITIVE);
+ entry.path = new File(path[i]);
+ entry.minimumVersion = minimumVersion[i];
+ info.add(entry);
+ }
+ }
+
+ public List<Entry> get() {
+ return info;
+ }
+}
diff --git
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/OVirtNodeUpgrade.java
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/OVirtNodeUpgrade.java
index 15f2d02..e6b4d2d 100644
---
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/OVirtNodeUpgrade.java
+++
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/OVirtNodeUpgrade.java
@@ -39,7 +39,7 @@
private BufferedReader _incoming;
private VDS _vds;
- private String _iso;
+ private File _iso;
private Exception _failException = null;
private DeployStatus _deployStatus = DeployStatus.Failed;
@@ -83,9 +83,9 @@
* @param vds vds to install.
* @param iso image to send.
*/
- public OVirtNodeUpgrade(VDS vds, String iso) {
+ public OVirtNodeUpgrade(VDS vds, File iso) {
_vds = vds;
- _iso = Config.resolveOVirtISOsRepositoryPath() + File.separator + iso;
+ _iso = iso;
_messages = new InstallerMessages(_vds);
_dialog = new EngineSSHDialog();
@@ -198,7 +198,7 @@
throw _failException;
}
_dialog.sendFile(
- _iso,
+ _iso.getAbsolutePath(),
dest
);
diff --git
a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/GetoVirtISOsTest.java
b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/GetoVirtISOsTest.java
index 5c8a695..30a4b43 100644
---
a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/GetoVirtISOsTest.java
+++
b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/GetoVirtISOsTest.java
@@ -28,19 +28,21 @@
public class GetoVirtISOsTest extends AbstractQueryTest<VdsIdParametersBase,
GetoVirtISOsQuery<VdsIdParametersBase>> {
private static final String OVIRT_INIT_SUPPORTED_VERSION = "5.8";
- private static final String OVIRT_ISO_PREFIX = "rhevh";
+ private static final String OVIRT_ISO_PREFIX = "^rhevh-(.*)\\.*\\.iso$";
private static final String OVIRT_ISOS_REPOSITORY_PATH =
"src/test/resources/ovirt-isos";
private static final String OVIRT_ISOS_DATA_DIR = ".";
private static final String AVAILABLE_OVIRT_ISO_VERSION = "RHEV Hypervisor
- 6.2 - 20111010.0.el6";
private static final String UNAVAILABLE_OVIRT_ISO_VERSION = "RHEV
Hypervisor - 8.2 - 20111010.0.el6";
private static final Version EXISTING_CLUSTER_VERSION = new Version("3.1");
+ private static final String OVIRT_NODEOS = "^rhevh.*";
@Rule
public MockConfigRule mcr = new MockConfigRule(
mockConfig(ConfigValues.oVirtISOsRepositoryPath,
OVIRT_ISOS_REPOSITORY_PATH),
mockConfig(ConfigValues.DataDir, OVIRT_ISOS_DATA_DIR),
mockConfig(ConfigValues.OvirtIsoPrefix, OVIRT_ISO_PREFIX),
- mockConfig(ConfigValues.OvirtInitialSupportedIsoVersion,
OVIRT_INIT_SUPPORTED_VERSION)
+ mockConfig(ConfigValues.OvirtInitialSupportedIsoVersion,
OVIRT_INIT_SUPPORTED_VERSION),
+ mockConfig(ConfigValues.OvirtNodeOS, OVIRT_NODEOS)
);
@Mock
@@ -60,6 +62,7 @@
vds.setId(vdsId);
vds.setVdsType(VDSType.oVirtNode);
vds.setHostOs(AVAILABLE_OVIRT_ISO_VERSION);
+ vds.setVdsGroupCompatibilityVersion(EXISTING_CLUSTER_VERSION);
when(vdsDAO.get(any(Guid.class))).thenReturn(vds);
when(getQueryParameters().getVdsId()).thenReturn(vdsId);
@@ -68,7 +71,7 @@
getQuery().executeCommand();
checkSucceeded(getQuery(), true);
- checkReturnValue(getQuery());
+ checkReturnValueEmpty(getQuery());
}
@Test
@@ -87,7 +90,7 @@
getQuery().executeCommand();
checkSucceeded(getQuery(), true);
- checkReturnValue(getQuery());
+ checkReturnValueEmpty(getQuery());
}
@Test
@@ -97,7 +100,7 @@
getQuery().executeCommand();
checkSucceeded(getQuery(), true);
- checkReturnValue(getQuery());
+ checkReturnValueEmpty(getQuery());
}
@Test
@@ -106,7 +109,17 @@
getQuery().executeCommand();
checkSucceeded(getQuery(), true);
- checkReturnValue(getQuery());
+ checkReturnValueEmpty(getQuery());
+ }
+
+ @Test
+ public void testQueryMultiplePaths() {
+ mcr.mockConfigValue(ConfigValues.oVirtISOsRepositoryPath,
"src/test/resources/ovirt-isos:src/test/resources/rhev-isos");
+ getQuery().setInternalExecution(true);
+ getQuery().executeCommand();
+
+ checkSucceeded(getQuery(), true);
+ checkReturnValueEmpty(getQuery());
}
@SuppressWarnings("unchecked")
@@ -117,8 +130,7 @@
getQuery().executeCommand();
checkSucceeded(getQuery(), true);
- assertTrue("Prefix was changed, no ISOs should be returned",
- ((List<RpmVersion>)
getQuery().getQueryReturnValue().getReturnValue()).isEmpty());
+ checkReturnValueEmpty(getQuery());
}
@SuppressWarnings("unchecked")
@@ -127,4 +139,9 @@
assertTrue(!isosList.isEmpty());
}
+ @SuppressWarnings("unchecked")
+ private static void
checkReturnValueEmpty(GetoVirtISOsQuery<VdsIdParametersBase> query) {
+ List<RpmVersion> isosList = (List<RpmVersion>)
query.getQueryReturnValue().getReturnValue();
+ assertTrue(isosList.isEmpty());
+ }
}
diff --git
a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/InstallVdsCommandTest.java
b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/InstallVdsCommandTest.java
index 29ad7aa..bafdf38 100644
---
a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/InstallVdsCommandTest.java
+++
b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/InstallVdsCommandTest.java
@@ -26,18 +26,21 @@
@RunWith(MockitoJUnitRunner.class)
public class InstallVdsCommandTest {
- private static final String OVIRT_ISO_PREFIX = "rhevh";
+ private static final String OVIRT_ISO_PREFIX = "^rhevh-(.*)\\.*\\.iso$";
private static final String OVIRT_ISOS_REPOSITORY_PATH =
"src/test/resources/ovirt-isos";
private static final String VALID_VERSION_OVIRT_ISO_FILENAME =
"rhevh-6.2-20111010.0.el6.iso";
private static final String INVALID_VERSION_OVIRT_ISO_FILENAME =
"rhevh-5.5-20111010.0.el6.iso";
private static final String VALID_OVIRT_VERSION = "6.2";
private static final String INVALID_OVIRT_VERSION = "5.8";
+ private static final String OVIRT_NODEOS = "^rhevh.*";
@ClassRule
public static MockConfigRule mcr = new MockConfigRule(
mockConfig(ConfigValues.OvirtIsoPrefix, OVIRT_ISO_PREFIX),
mockConfig(ConfigValues.DataDir, "."),
- mockConfig(ConfigValues.oVirtISOsRepositoryPath,
OVIRT_ISOS_REPOSITORY_PATH)
+ mockConfig(ConfigValues.oVirtISOsRepositoryPath,
OVIRT_ISOS_REPOSITORY_PATH),
+ mockConfig(ConfigValues.OvirtInitialSupportedIsoVersion,
VALID_OVIRT_VERSION),
+ mockConfig(ConfigValues.OvirtNodeOS, OVIRT_NODEOS)
);
@Mock
diff --git
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java
index 1aab2da..5ad83c0 100644
---
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java
+++
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java
@@ -1239,6 +1239,9 @@
@DefaultValueAttribute("")
ProductKeyWindows2012x64,
+ @TypeConverterAttribute(String.class)
+ @DefaultValueAttribute("^ovirt.*$")
+ OvirtNodeOS,
@TypeConverterAttribute(Boolean.class)
@DefaultValueAttribute("true")
diff --git a/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql
b/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql
index 5d85222..a21dd45 100644
--- a/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql
+++ b/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql
@@ -368,9 +368,10 @@
select fn_db_add_config_value('OriginType','OVIRT','general');
select fn_db_add_config_value('OvfVirtualSystemType','ENGINE','general');
--Handling The ovirt-node installation files path
-select
fn_db_add_config_value('OvirtInitialSupportedIsoVersion','2.5.5','general');
-select fn_db_add_config_value('OvirtIsoPrefix','ovirt-node','general');
-select
fn_db_add_config_value('oVirtISOsRepositoryPath','/usr/share/ovirt-node-iso','general');
+select
fn_db_add_config_value('OvirtInitialSupportedIsoVersion','2.5.5:5.8','general');
+select
fn_db_add_config_value('OvirtIsoPrefix','^ovirt-node-iso-(.*)\.*\.iso$:^rhevh-(.*)\.*\.iso$','general');
+select fn_db_add_config_value('OvirtNodeOS','^ovirt.*$:^rhev.*$','general');
+select
fn_db_add_config_value('oVirtISOsRepositoryPath','/usr/share/ovirt-node-iso:/usr/share/rhev-hypervisor','general');
select
fn_db_add_config_value('oVirtUpgradeScriptName','/usr/share/vdsm-reg/vdsm-upgrade','general');
select
fn_db_add_config_value('oVirtUploadPath','/data/updates/ovirt-node-image.iso','general');
select fn_db_add_config_value('OvfUpdateIntervalInMinutes','60','general');
@@ -704,9 +705,10 @@
select fn_db_update_config_value('MigrationSupportForNativeUsb','false','3.0');
select fn_db_update_config_value('MigrationSupportForNativeUsb','false','3.1');
select fn_db_update_config_value('MinimalETLVersion','3.4.0','general');
-select
fn_db_update_config_value('OvirtInitialSupportedIsoVersion','2.5.5','general');
-select fn_db_update_config_value('OvirtIsoPrefix','ovirt-node','general');
-select
fn_db_update_config_value('oVirtISOsRepositoryPath','/usr/share/ovirt-node-iso','general');
+select
fn_db_update_config_value('OvirtInitialSupportedIsoVersion','2.5.5:5.8','general');
+select
fn_db_update_config_value('OvirtIsoPrefix','^ovirt-node-iso-(.*)\.*\.iso$:^rhevh-(.*)\.*\.iso$','general');
+select fn_db_update_config_value('OvirtNodeOS','^ovirt.*$:^rhev.*$','general');
+select
fn_db_update_config_value('oVirtISOsRepositoryPath','/usr/share/ovirt-node-iso:/usr/share/rhev-hypervisor','general');
select fn_db_update_config_value('PostgresPagingSyntax','OFFSET (%1$s -1)
LIMIT %2$s','general');
select fn_db_update_config_value('PostgresSearchTemplate','SELECT * FROM
(%2$s) %1$s) as T1 %3$s','general');
select
fn_db_update_config_value('RhevhLocalFSPath','/data/images/rhev','general');
--
To view, visit http://gerrit.ovirt.org/23538
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibfb9dc5d0dc8780b519107acbe0ae866831f782c
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.4
Gerrit-Owner: Douglas Schilling Landgraf <[email protected]>
Gerrit-Reviewer: Alon Bar-Lev <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches