summaryrefslogtreecommitdiffstats
path: root/cns-libs/cnslibs/common/openshift_ops.py
diff options
context:
space:
mode:
authorValerii Ponomarov <vponomar@redhat.com>2018-09-21 19:36:52 +0530
committerValerii Ponomarov <vponomar@redhat.com>2018-09-21 19:40:29 +0530
commitab4c4a625ae3defba70230282269079177491239 (patch)
tree04949de5bb7231829dd9a9b5312560f4aabb780e /cns-libs/cnslibs/common/openshift_ops.py
parente96fa6676fa6a41164169686c0309fd9539edcf7 (diff)
Enhance 'oc_create_app_dc_with_io' function
List of enhancements: - Add handler for SIGTERM, which allows us to stop POD execution gracefully instead of timing out for grace period and killing it. - Use separate data file name for each of the PODs based on their unique names. It is much more useful approach when we create more than 1 POD in a DC. Without it we write to one single file with locks, with this change we write data to different files by each POD in parallel. Change-Id: If4bba1c017df1cf3240896522720fa08d5cf138b
Diffstat (limited to 'cns-libs/cnslibs/common/openshift_ops.py')
-rw-r--r--cns-libs/cnslibs/common/openshift_ops.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/cns-libs/cnslibs/common/openshift_ops.py b/cns-libs/cnslibs/common/openshift_ops.py
index 3cba8e00..a4877687 100644
--- a/cns-libs/cnslibs/common/openshift_ops.py
+++ b/cns-libs/cnslibs/common/openshift_ops.py
@@ -346,7 +346,7 @@ def oc_create_pvc(hostname, sc_name, pvc_name_prefix="autotests-pvc",
def oc_create_app_dc_with_io(
hostname, pvc_name, dc_name_prefix="autotests-dc-with-app-io",
- replicas=1, space_to_use=92274688):
+ replicas=1, space_to_use=1048576):
"""Create DC with app PODs and attached PVC, constantly running I/O.
Args:
@@ -366,9 +366,10 @@ def oc_create_app_dc_with_io(
"command": ["sh"],
"args": [
"-ec",
+ "trap \"rm -f /mnt/random-data-$HOSTNAME.log ; exit 0\" SIGTERM; "
"while true; do "
" (mount | grep '/mnt') && "
- " (head -c %s < /dev/urandom > /mnt/random-data.log) || "
+ " (head -c %s < /dev/urandom > /mnt/random-data-$HOSTNAME.log) || "
" exit 1; "
" sleep 1 ; "
"done" % space_to_use,
@@ -379,7 +380,7 @@ def oc_create_app_dc_with_io(
"exec": {"command": [
"sh", "-ec",
"mount | grep '/mnt' && "
- " head -c 1 < /dev/urandom >> /mnt/random-data.log"
+ " head -c 1 < /dev/urandom >> /mnt/random-data-$HOSTNAME.log"
]},
},
}
@@ -401,6 +402,7 @@ def oc_create_app_dc_with_io(
"persistentVolumeClaim": {"claimName": pvc_name},
}],
"containers": [container_data],
+ "terminationGracePeriodSeconds": 20,
}
}
}