summaryrefslogtreecommitdiffstats
path: root/cns-libs
diff options
context:
space:
mode:
authornigoyal <nigoyal@redhat.com>2019-02-04 12:12:53 +0530
committernigoyal <nigoyal@redhat.com>2019-02-04 15:00:08 +0530
commit28e7e4812b442d1851ea34368622a003330e1b54 (patch)
tree0f87650d2401c4628789bed971dbbdc375e81446 /cns-libs
parentc1d44b0bed7fd54d056df1724009bd035fabe6d1 (diff)
Add Heketi version checks
Add Heketi version checks to the test cases and Heketi libraries. In case of incompatible Heketi version in a setup, test cases will be skipped and direct usage of Heketi libraries will cause them to raise the NotImplementedError exceptions. Change-Id: I462e76f615165140f2a8c7e796c1c582b8f4dc91
Diffstat (limited to 'cns-libs')
-rw-r--r--cns-libs/cnslibs/common/heketi_ops.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/cns-libs/cnslibs/common/heketi_ops.py b/cns-libs/cnslibs/common/heketi_ops.py
index a1248687..2fe75572 100644
--- a/cns-libs/cnslibs/common/heketi_ops.py
+++ b/cns-libs/cnslibs/common/heketi_ops.py
@@ -1345,6 +1345,13 @@ def set_arbiter_tag(heketi_client_node, heketi_server_url, source,
exceptions.ExecutionError : when command fails.
"""
+ version = heketi_version.get_heketi_version(heketi_client_node)
+ if version < '6.0.0-11':
+ msg = ("heketi-client package %s does not support arbiter "
+ "functionality" % version.v_str)
+ g.log.error(msg)
+ raise NotImplementedError(msg)
+
if arbiter_tag_value in ('required', 'disabled', 'supported'):
arbiter_tag_value = "arbiter:%s" % arbiter_tag_value
return set_tags(heketi_client_node, heketi_server_url,
@@ -1425,6 +1432,13 @@ def rm_arbiter_tag(heketi_client_node, heketi_server_url, source, source_id,
exceptions.ExecutionError : when command fails.
"""
+ version = heketi_version.get_heketi_version(heketi_client_node)
+ if version < '6.0.0-11':
+ msg = ("heketi-client package %s does not support arbiter "
+ "functionality" % version.v_str)
+ g.log.error(msg)
+ raise NotImplementedError(msg)
+
return rm_tags(heketi_client_node, heketi_server_url,
source, source_id, 'arbiter', **kwargs)
@@ -1447,6 +1461,13 @@ def get_heketi_metrics(heketi_client_node, heketi_server_url,
Metrics output: if successful
"""
+ version = heketi_version.get_heketi_version(heketi_client_node)
+ if version < '6.0.0-14':
+ msg = ("heketi-client package %s does not support heketi "
+ "metrics functionality" % version.v_str)
+ g.log.error(msg)
+ raise NotImplementedError(msg)
+
cmd = "curl --max-time 10 %s/metrics" % heketi_server_url
ret, out, err = g.run(heketi_client_node, cmd)
if ret != 0: