summaryrefslogtreecommitdiffstats
path: root/openshift-storage-libs
diff options
context:
space:
mode:
authorSri Vignesh <sselvan@redhat.com>2019-09-19 11:53:27 +0530
committervponomar <vponomar@redhat.com>2019-09-25 11:39:37 +0000
commit203410a740e275cce78e840c30c583c82e563c28 (patch)
tree1b266d8acfa17b1aafae68d04acc4c69e3fc4c2e /openshift-storage-libs
parentb255aef7fd1c7c8fae34a5e685efc52956b12d48 (diff)
[Lib+tc]Add testcase and library to validate total count of volumes
Add library to check db results Validate count of volumes of heketi and db are same Change-Id: I6e75f2d8d5f19a94c1dced5a07f9c948b4de9ef4 Signed-off-by: Sri Vignesh <sselvan@redhat.com>
Diffstat (limited to 'openshift-storage-libs')
-rw-r--r--openshift-storage-libs/openshiftstoragelibs/heketi_ops.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/openshift-storage-libs/openshiftstoragelibs/heketi_ops.py b/openshift-storage-libs/openshiftstoragelibs/heketi_ops.py
index d2fa656..fb87237 100644
--- a/openshift-storage-libs/openshiftstoragelibs/heketi_ops.py
+++ b/openshift-storage-libs/openshiftstoragelibs/heketi_ops.py
@@ -1591,3 +1591,36 @@ def heketi_server_operation_cleanup(
"after %s second" % timeout)
g.log.error(err_msg)
raise exceptions.ExecutionError(err_msg)
+
+
+def heketi_db_check(heketi_client_node, heketi_server_url, **kwargs):
+ """Execute 'heketi db check' command.
+
+ Args:
+ - heketi_client_node (str): Node where we want to run our commands.
+ - heketi_server_url (str): This is a heketi server url.
+
+ Raises:
+ NotImplementedError: if heketi version is not expected
+ exceptions.AssertionError: if command fails.
+
+ Returns:
+ dictionary: if successful
+ """
+
+ version = heketi_version.get_heketi_version(heketi_client_node)
+ if version < '8.0.0-7':
+ msg = "heketi-client package %s does not support db check" % (
+ version.v_str)
+ g.log.error(msg)
+ raise NotImplementedError(msg)
+
+ heketi_server_url, json_arg, secret, user = _set_heketi_global_flags(
+ heketi_server_url, **kwargs)
+
+ # output is always json-like and we do not need to provide "--json" CLI arg
+ cmd = "heketi-cli db check %s %s %s" % (
+ heketi_server_url, user, secret)
+ cmd = TIMEOUT_PREFIX + cmd
+ out = heketi_cmd_run(heketi_client_node, cmd)
+ return json.loads(out)