Shireesh Anjal has uploaded a new change for review.

Change subject: gluster: Introducing GlusterFeatureSupported
......................................................................

gluster: Introducing GlusterFeatureSupported

This class provides methods to check compatibility of various gluster
related features against a given compatibility version. This is done by
checking if the "supported-from" version for that feature is <= the
passed compatibility version.

Normally, there will be one config entry for every gluster feature. In
rare cases where a feature is discontinued in a version, another config
entry for "supported-to" can be introduced.

Change-Id: I58ddb9bdcfa99b7f12926e414dd40a4b311a2163
Signed-off-by: Shireesh Anjal <[email protected]>
---
M backend/manager/dbscripts/upgrade/pre_upgrade/0000_config.sql
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java
A 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/gluster/GlusterFeatureSupported.java
3 files changed, 42 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/91/13491/1

diff --git a/backend/manager/dbscripts/upgrade/pre_upgrade/0000_config.sql 
b/backend/manager/dbscripts/upgrade/pre_upgrade/0000_config.sql
index b1741f4..f8b6df8 100644
--- a/backend/manager/dbscripts/upgrade/pre_upgrade/0000_config.sql
+++ b/backend/manager/dbscripts/upgrade/pre_upgrade/0000_config.sql
@@ -486,6 +486,9 @@
 -- Gluster refresh rates (in seconds)
 select fn_db_add_config_value('GlusterRefreshRateLight', '5', 'general');
 select fn_db_add_config_value('GlusterRefreshRateHeavy', '300', 'general');
+-- Gluster features supported versions
+select fn_db_add_config_value('GlusterRefreshHeavyWeightSupportedFrom', '3.2', 
'general');
+select fn_db_add_config_value('GlusterSupportedFrom', '3.1', 'general');
 
 select fn_db_add_config_value('LogMaxPhysicalMemoryUsedThresholdInPercentage', 
'95', 'general');
 select fn_db_add_config_value('LogMaxCpuUsedThresholdInPercentage', '95', 
'general');
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 d14a482..2a81267 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
@@ -1343,6 +1343,14 @@
     @DefaultValueAttribute("Auto")
     ClientConsoleModeDefault(501),
 
+    @TypeConverterAttribute(String.class)
+    @DefaultValueAttribute("3.1")
+    GlusterSupportedFrom(502),
+
+    @TypeConverterAttribute(String.class)
+    @DefaultValueAttribute("3.2")
+    GlusterRefreshHeavyWeightSupportedFrom(503),
+
     Invalid(65535);
 
     private int intValue;
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/gluster/GlusterFeatureSupported.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/gluster/GlusterFeatureSupported.java
new file mode 100644
index 0000000..bcdd4a6
--- /dev/null
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/gluster/GlusterFeatureSupported.java
@@ -0,0 +1,31 @@
+package org.ovirt.engine.core.common.gluster;
+
+import static 
org.ovirt.engine.core.common.utils.CompatibilityUtils.featureSupported;
+
+import org.ovirt.engine.core.common.config.ConfigValues;
+import org.ovirt.engine.core.compat.Version;
+
+/**
+ * Convenience class to check if a gluster feature is supported or not in any 
given version.<br>
+ * Methods should be named by feature and accept version to check against.
+ */
+public class GlusterFeatureSupported {
+
+    /**
+     * @param version
+     *            Compatibility version to check for.
+     * @return <code>true</code> if gluster support is enabled, 
<code>false</code> if it's not.
+     */
+    public static boolean gluster(Version version) {
+        return featureSupported(ConfigValues.GlusterSupportedFrom, null, 
version);
+    }
+
+    /**
+     * @param version
+     *            Compatibility version to check for.
+     * @return <code>true</code> if gluster heavyweight refresh is enabled, 
<code>false</code> if it's not.
+     */
+    public static boolean refreshHeavyWeight(Version version) {
+        return 
featureSupported(ConfigValues.GlusterRefreshHeavyWeightSupportedFrom, null, 
version);
+    }
+}


--
To view, visit http://gerrit.ovirt.org/13491
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I58ddb9bdcfa99b7f12926e414dd40a4b311a2163
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Shireesh Anjal <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to