summaryrefslogtreecommitdiffstats
path: root/openshift-storage-libs
diff options
context:
space:
mode:
authorNitin Goyal <nigoyal@redhat.com>2019-06-20 19:03:40 +0530
committervponomar <vponomar@redhat.com>2019-07-19 10:15:04 +0000
commit89ce809334ab6b5de84a84dea6cd205116082e84 (patch)
tree9c7c5e03ef022f5bc17077e1d735e7059c303f29 /openshift-storage-libs
parent1f3bb5b08d05f5711af842edc3dbf924acc14bf5 (diff)
Add TC run IOs when tcmu-runner service is down
This test case verifies that when tcmu-runner is down we are able to run IOs on block volumes, and stoping tcmu-runner would effect gluster-blockd and gluster-block-target services. Change-Id: I0b4a23f7c2dce909f07a22893f83a6c1d0285091
Diffstat (limited to 'openshift-storage-libs')
-rw-r--r--openshift-storage-libs/openshiftstoragelibs/openshift_ops.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/openshift-storage-libs/openshiftstoragelibs/openshift_ops.py b/openshift-storage-libs/openshiftstoragelibs/openshift_ops.py
index c8275c5..24dcbfd 100644
--- a/openshift-storage-libs/openshiftstoragelibs/openshift_ops.py
+++ b/openshift-storage-libs/openshiftstoragelibs/openshift_ops.py
@@ -696,7 +696,8 @@ def get_gluster_pod_names_by_pvc_name(ocp_node, pvc_name):
return data
-def cmd_run_on_gluster_pod_or_node(ocp_client_node, cmd, gluster_node=None):
+def cmd_run_on_gluster_pod_or_node(
+ ocp_client_node, cmd, gluster_node=None, raise_on_error=True):
"""Run shell command on either Gluster PODs or Gluster nodes.
Args:
@@ -727,7 +728,9 @@ def cmd_run_on_gluster_pod_or_node(ocp_client_node, cmd, gluster_node=None):
for gluster_pod_name in gluster_pod_names:
try:
pod_cmd = "oc exec %s -- %s" % (gluster_pod_name, cmd)
- return command.cmd_run(pod_cmd, hostname=ocp_client_node)
+ return command.cmd_run(
+ pod_cmd, hostname=ocp_client_node,
+ raise_on_error=raise_on_error)
except Exception as e:
err = ("Failed to run '%s' command on '%s' Gluster POD. "
"Error: %s\n" % (cmd, gluster_pod_name, e))
@@ -742,7 +745,8 @@ def cmd_run_on_gluster_pod_or_node(ocp_client_node, cmd, gluster_node=None):
g_hosts = list(g.config.get("gluster_servers", {}).keys())
for g_host in g_hosts:
try:
- return command.cmd_run(cmd, hostname=g_host)
+ return command.cmd_run(
+ cmd, hostname=g_host, raise_on_error=raise_on_error)
except Exception as e:
err = ("Failed to run '%s' command on '%s' Gluster node. "
"Error: %s\n" % (cmd, g_host, e))
@@ -1336,7 +1340,7 @@ def check_service_status_on_pod(
def wait_for_service_status_on_gluster_pod_or_node(
ocp_client, service, status, state, gluster_node,
- timeout=180, wait_step=3):
+ raise_on_error=True, timeout=180, wait_step=3):
"""Wait for a service specific status on a Gluster POD or node.
Args:
@@ -1358,7 +1362,8 @@ def wait_for_service_status_on_gluster_pod_or_node(
for w in waiter.Waiter(timeout, wait_step):
out = cmd_run_on_gluster_pod_or_node(
- ocp_client, SERVICE_STATUS % service, gluster_node)
+ ocp_client, SERVICE_STATUS % service, gluster_node,
+ raise_on_error=raise_on_error)
for line in out.splitlines():
status_match = re.search(SERVICE_STATUS_REGEX, line)
if (status_match and status_match.group(1) == status and