summaryrefslogtreecommitdiffstats
path: root/openshift-storage-libs/openshiftstoragelibs
diff options
context:
space:
mode:
Diffstat (limited to 'openshift-storage-libs/openshiftstoragelibs')
-rw-r--r--openshift-storage-libs/openshiftstoragelibs/baseclass.py25
-rw-r--r--openshift-storage-libs/openshiftstoragelibs/openshift_ops.py29
2 files changed, 20 insertions, 34 deletions
diff --git a/openshift-storage-libs/openshiftstoragelibs/baseclass.py b/openshift-storage-libs/openshiftstoragelibs/baseclass.py
index 81327c11..b5969764 100644
--- a/openshift-storage-libs/openshiftstoragelibs/baseclass.py
+++ b/openshift-storage-libs/openshiftstoragelibs/baseclass.py
@@ -45,7 +45,6 @@ from openshiftstoragelibs.openshift_ops import (
get_pod_name_from_rc,
get_pv_name_from_pvc,
oc_create_app_dc_with_io,
- oc_create_busybox_app_dc_with_io,
oc_create_pvc,
oc_create_sc,
oc_create_secret,
@@ -127,6 +126,11 @@ class BaseClass(unittest.TestCase):
cls.heketi_logs_before_delete = bool(
g.config.get("common", {}).get("heketi_logs_before_delete", False))
+ cls.io_container_image_cirros = cls.openshift_config.get(
+ "io_container_images", {}).get("cirros", "cirros")
+ cls.io_container_image_busybox = cls.openshift_config.get(
+ "io_container_images", {}).get("busybox", "busybox")
+
cmd = "echo -n %s | base64" % cls.heketi_cli_key
ret, out, err = g.run(cls.ocp_master_node[0], cmd, "root")
if ret != 0:
@@ -434,7 +438,7 @@ class BaseClass(unittest.TestCase):
def create_dcs_with_pvc(
self, pvc_names, timeout=600, wait_step=5,
dc_name_prefix='autotests-dc', space_to_use=1048576, label=None,
- skip_cleanup=False, is_busybox=False):
+ skip_cleanup=False, image=None):
"""Create bunch of DCs with app PODs which use unique PVCs.
Args:
@@ -445,7 +449,7 @@ class BaseClass(unittest.TestCase):
dc_name_prefix(str): name prefix for deployement config.
space_to_use(int): space to use for io's in KB.
label (dict): keys and value for adding label into DC.
- is_busybox (bool): True for busybox app pod else default is False
+ image (str): container image used for I/O.
Returns: dictionary with following structure:
{
"pvc_name_1": ("dc_name_1", "pod_name_1"),
@@ -454,16 +458,17 @@ class BaseClass(unittest.TestCase):
"pvc_name_n": ("dc_name_n", "pod_name_n"),
}
"""
+ if not image:
+ image = self.io_container_image_cirros
+
pvc_names = (
pvc_names
if isinstance(pvc_names, (list, set, tuple)) else [pvc_names])
dc_and_pod_names, dc_names = {}, {}
- function = (oc_create_busybox_app_dc_with_io if is_busybox else
- oc_create_app_dc_with_io)
for pvc_name in pvc_names:
- dc_name = function(self.ocp_client[0], pvc_name,
- space_to_use=space_to_use,
- dc_name_prefix=dc_name_prefix, label=label)
+ dc_name = oc_create_app_dc_with_io(
+ self.ocp_client[0], pvc_name, space_to_use=space_to_use,
+ dc_name_prefix=dc_name_prefix, label=label, image=image)
dc_names[pvc_name] = dc_name
if not skip_cleanup:
self.addCleanup(oc_delete, self.ocp_client[0], 'dc', dc_name)
@@ -484,11 +489,11 @@ class BaseClass(unittest.TestCase):
def create_dc_with_pvc(
self, pvc_name, timeout=300, wait_step=10,
dc_name_prefix='autotests-dc', label=None,
- skip_cleanup=False, is_busybox=False):
+ skip_cleanup=False, image=None):
return self.create_dcs_with_pvc(
pvc_name, timeout, wait_step,
dc_name_prefix=dc_name_prefix, label=label,
- skip_cleanup=skip_cleanup, is_busybox=is_busybox)[pvc_name]
+ skip_cleanup=skip_cleanup, image=image)[pvc_name]
def create_heketi_volume_with_name_and_wait(
self, name, size, raise_on_cleanup_error=True,
diff --git a/openshift-storage-libs/openshiftstoragelibs/openshift_ops.py b/openshift-storage-libs/openshiftstoragelibs/openshift_ops.py
index fb60a009..b8ba40ef 100644
--- a/openshift-storage-libs/openshiftstoragelibs/openshift_ops.py
+++ b/openshift-storage-libs/openshiftstoragelibs/openshift_ops.py
@@ -411,7 +411,7 @@ def _oc_create_app_dc_with_io_image(hostname, pvc_name, dc_name_prefix,
def oc_create_app_dc_with_io(
hostname, pvc_name, dc_name_prefix="autotests-dc-with-app-io",
- replicas=1, space_to_use=1048576, label=None):
+ replicas=1, space_to_use=1048576, label=None, image="cirros"):
"""Create DC with app PODs and attached PVC, constantly running I/O.
Args:
@@ -423,34 +423,15 @@ def oc_create_app_dc_with_io(
replicas (int): amount of application POD replicas.
space_to_use (int): value in bytes which will be used for I/O.
label (dict): dict of keys and values to add labels in DC.
+ image (str): Container image for I/O.
"""
return _oc_create_app_dc_with_io_image(
hostname, pvc_name, dc_name_prefix, replicas, space_to_use,
- label, "cirros")
-
-
-def oc_create_busybox_app_dc_with_io(
- hostname, pvc_name, dc_name_prefix="autotests-dc-with-app-io",
- replicas=1, space_to_use=1048576, label=None):
- """Create DC with app PODs and attached PVC, constantly running I/O.
-
- Args:
- hostname (str): Node on which 'oc create' command will be executed.
- pvc_name (str): name of the Persistent Volume Claim to attach to
- the application PODs where constant I/O will run.
- dc_name_prefix (str): DC name will consist of this prefix and
- random str.
- replicas (int): amount of application POD replicas.
- space_to_use (int): value in bytes which will be used for I/O.
- label (dict): dict of keys and values to add labels in DC.
- """
- return _oc_create_app_dc_with_io_image(
- hostname, pvc_name, dc_name_prefix, replicas, space_to_use,
- label, "busybox")
+ label, image=image)
def oc_create_tiny_pod_with_volume(hostname, pvc_name, pod_name_prefix='',
- mount_path='/mnt'):
+ mount_path='/mnt', image='cirros'):
"""Create tiny POD from image in 10Mb with attached volume at /mnt"""
pod_name = "%s-%s" % (pod_name_prefix, utils.get_random_str())
pod_data = json.dumps({
@@ -463,7 +444,7 @@ def oc_create_tiny_pod_with_volume(hostname, pvc_name, pod_name_prefix='',
"terminationGracePeriodSeconds": 20,
"containers": [{
"name": pod_name,
- "image": "cirros", # noqa: 10 Mb! linux image
+ "image": image, # noqa: 10 Mb! linux image
"volumeMounts": [{"mountPath": mount_path, "name": "vol"}],
"command": [
"/bin/sh", "-ec",