summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkasturiNarra <knarra@redhat.com>2019-10-04 21:03:39 +0530
committervponomar <vponomar@redhat.com>2019-10-10 11:47:15 +0000
commit6d319cdec377dda3f0d49001a8d53c879bd43206 (patch)
treea18a2458f73676425048769c1eda2f63634d4757
parent316ba397876f98d4d128df0684ae566c8576f96a (diff)
Add support for new resource type
As of now user can only pass dc name as argument to validate iscsi and multipath session, with this support user can also pass pod name by specifying rtype=pod Change-Id: Iecc86edc2a2239fc05535f0e4f7e9ae93d5e76f5
-rw-r--r--openshift-storage-libs/openshiftstoragelibs/baseclass.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/openshift-storage-libs/openshiftstoragelibs/baseclass.py b/openshift-storage-libs/openshiftstoragelibs/baseclass.py
index 69985f6..715bbc6 100644
--- a/openshift-storage-libs/openshiftstoragelibs/baseclass.py
+++ b/openshift-storage-libs/openshiftstoragelibs/baseclass.py
@@ -430,7 +430,7 @@ class GlusterBlockBaseClass(BaseClass):
cls.sc = cls.storage_classes.get(
'storage_class2', cls.storage_classes.get('block_storage_class'))
- def verify_iscsi_sessions_and_multipath(self, pvc_name, dc_name):
+ def verify_iscsi_sessions_and_multipath(self, pvc_name, rname, rtype="dc"):
# Get storage ips of glusterfs pods
keys = self.gluster_servers
gluster_ips = []
@@ -449,9 +449,16 @@ class GlusterBlockBaseClass(BaseClass):
hacount = int(vol_info['hacount'])
# Find node on which pod is running
- pod_name = get_pod_name_from_dc(self.ocp_client[0], dc_name)
- pod_info = oc_get_pods(
- self.ocp_client[0], selector='deploymentconfig=%s' % dc_name)
+ if rtype == 'dc':
+ pod_name = get_pod_name_from_dc(self.ocp_client[0], rname)
+ pod_info = oc_get_pods(
+ self.ocp_client[0], selector='deploymentconfig=%s' % rname)
+ elif rtype == 'pod':
+ pod_info = oc_get_pods(self.ocp_client[0], name=rname)
+ pod_name = rname
+ else:
+ raise NameError("Value of rtype should be either 'dc' or 'pod'")
+
node = pod_info[pod_name]['node']
# Get the iscsi sessions info from the node