summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNitin Goyal <nigoyal@redhat.com>2020-02-11 10:12:07 +0530
committerNitin Goyal <nigoyal@redhat.com>2020-03-23 10:17:05 +0530
commit847f4e70c1e15a373b0c4f2851256f05f5dac5c8 (patch)
tree314f4160baf7948348e7b1bb3e274f66cb9f3f6a
parenta94123529633b1c6f9024d64cdb6e3aea559d76f (diff)
[Lib] Add _create_storage_class helper method
Add helper method for passing provisioner argument. Which will allow to pass provisioner argument from other BaseClasses. Change-Id: I475717ac5d4575d96aff82148cf2c98e035df1d5 Signed-off-by: Nitin Goyal <nigoyal@redhat.com>
-rw-r--r--openshift-storage-libs/openshiftstoragelibs/baseclass.py56
1 files changed, 42 insertions, 14 deletions
diff --git a/openshift-storage-libs/openshiftstoragelibs/baseclass.py b/openshift-storage-libs/openshiftstoragelibs/baseclass.py
index b173c3b..7a7b425 100644
--- a/openshift-storage-libs/openshiftstoragelibs/baseclass.py
+++ b/openshift-storage-libs/openshiftstoragelibs/baseclass.py
@@ -209,19 +209,19 @@ class BaseClass(unittest.TestCase):
oc_delete, self.ocp_client[0], 'secret', secret_name)
return secret_name
- def create_storage_class(self, secret_name=None,
- sc_name_prefix="autotests-sc",
- sc_name=None,
- create_vol_name_prefix=False,
- vol_name_prefix=None,
- allow_volume_expansion=False,
- reclaim_policy="Delete",
- set_hacount=None,
- clusterid=None,
- hacount=None,
- is_arbiter_vol=False, arbiter_avg_file_size=None,
- heketi_zone_checking=None, volumeoptions=None,
- skip_cleanup=False):
+ def _create_storage_class(self, provisioner, secret_name=None,
+ sc_name_prefix="autotests-sc",
+ sc_name=None,
+ create_vol_name_prefix=False,
+ vol_name_prefix=None,
+ allow_volume_expansion=False,
+ reclaim_policy="Delete",
+ set_hacount=None,
+ clusterid=None,
+ hacount=None,
+ is_arbiter_vol=False, arbiter_avg_file_size=None,
+ heketi_zone_checking=None, volumeoptions=None,
+ skip_cleanup=False):
# Create secret if one is not specified
if not secret_name:
@@ -230,7 +230,6 @@ class BaseClass(unittest.TestCase):
# Create storage class
secret_name_option = "secretname"
secret_namespace_option = "secretnamespace"
- provisioner = self.get_provisioner_for_sc()
if provisioner != "kubernetes.io/glusterfs":
secret_name_option = "rest%s" % secret_name_option
secret_namespace_option = "rest%s" % secret_namespace_option
@@ -285,6 +284,35 @@ class BaseClass(unittest.TestCase):
self.addCleanup(oc_delete, self.ocp_client[0], "sc", self.sc_name)
return self.sc_name
+ def create_storage_class(self, secret_name=None,
+ sc_name_prefix="autotests-sc",
+ sc_name=None,
+ create_vol_name_prefix=False,
+ vol_name_prefix=None,
+ allow_volume_expansion=False,
+ reclaim_policy="Delete",
+ set_hacount=None,
+ clusterid=None,
+ hacount=None,
+ is_arbiter_vol=False, arbiter_avg_file_size=None,
+ heketi_zone_checking=None, volumeoptions=None,
+ skip_cleanup=False):
+
+ provisioner = self.get_provisioner_for_sc()
+
+ return self._create_storage_class(
+ provisioner=provisioner, secret_name=secret_name,
+ sc_name_prefix=sc_name_prefix, sc_name=sc_name,
+ create_vol_name_prefix=create_vol_name_prefix,
+ vol_name_prefix=vol_name_prefix,
+ allow_volume_expansion=allow_volume_expansion,
+ reclaim_policy=reclaim_policy, set_hacount=set_hacount,
+ clusterid=clusterid, hacount=hacount,
+ is_arbiter_vol=is_arbiter_vol,
+ arbiter_avg_file_size=arbiter_avg_file_size,
+ heketi_zone_checking=heketi_zone_checking,
+ volumeoptions=volumeoptions, skip_cleanup=skip_cleanup)
+
def get_provisioner_for_sc(self):
return "kubernetes.io/glusterfs"