summaryrefslogtreecommitdiffstats
path: root/cns-libs
diff options
context:
space:
mode:
authornigoyal <nigoyal@redhat.com>2018-10-02 11:53:00 +0530
committernigoyal <nigoyal@redhat.com>2018-11-06 14:13:30 +0530
commit0dd10df754e0f65a1354ff3d73fe3ce1fa0e892b (patch)
treef430414c4b18e8d79f0dc8e6d108cb3c86e178f4 /cns-libs
parent91145cbe810699fa45d1a680edc677800729cb4a (diff)
[CNS-584] [CNS-1390] test cases for glusterfs
CNS-584 Verify PVC deletion while pod is running This test case is verifying the glusterfs pvc deletion while pod is running and expectation is that pvc should not delete CNS-1390 - Retain policy - glusterfs - delete pvc This test case is verifying the retain policy of pvc and expectation is that when we delete pvc pv should not get deleted. Change-Id: Idefa36afdd8bc80835631863370273b4c86bccfc
Diffstat (limited to 'cns-libs')
-rw-r--r--cns-libs/cnslibs/common/heketi_ops.py9
-rw-r--r--cns-libs/cnslibs/common/openshift_ops.py4
2 files changed, 9 insertions, 4 deletions
diff --git a/cns-libs/cnslibs/common/heketi_ops.py b/cns-libs/cnslibs/common/heketi_ops.py
index 3025b813..fea574da 100644
--- a/cns-libs/cnslibs/common/heketi_ops.py
+++ b/cns-libs/cnslibs/common/heketi_ops.py
@@ -676,7 +676,8 @@ def heketi_volume_expand(heketi_client_node, heketi_server_url, volume_id,
def heketi_volume_delete(heketi_client_node, heketi_server_url, volume_id,
- mode='cli', raw_cli_output=False, **kwargs):
+ mode='cli', raw_cli_output=False,
+ raise_on_error=True, **kwargs):
"""Executes heketi volume delete command.
Args:
@@ -715,7 +716,8 @@ def heketi_volume_delete(heketi_client_node, heketi_server_url, volume_id,
if ret != 0:
err_msg += "Out: %s, \nErr: %s" % (out, err)
g.log.error(err_msg)
- raise exceptions.ExecutionError(err_msg)
+ if raise_on_error:
+ raise exceptions.ExecutionError(err_msg)
return out
else:
try:
@@ -725,7 +727,8 @@ def heketi_volume_delete(heketi_client_node, heketi_server_url, volume_id,
ret = conn.volume_delete(volume_id)
except Exception:
g.log.error(err_msg)
- raise
+ if raise_on_error:
+ raise
return ret
diff --git a/cns-libs/cnslibs/common/openshift_ops.py b/cns-libs/cnslibs/common/openshift_ops.py
index 9f836dae..523cc375 100644
--- a/cns-libs/cnslibs/common/openshift_ops.py
+++ b/cns-libs/cnslibs/common/openshift_ops.py
@@ -287,7 +287,8 @@ def oc_create_secret(hostname, secret_name_prefix="autotests-secret-",
def oc_create_sc(hostname, sc_name_prefix="autotests-sc",
provisioner="kubernetes.io/glusterfs",
- allow_volume_expansion=False, **parameters):
+ allow_volume_expansion=False,
+ reclaim_policy="Delete", **parameters):
"""Create storage class using data provided as stdin input.
Args:
@@ -316,6 +317,7 @@ def oc_create_sc(hostname, sc_name_prefix="autotests-sc",
"apiVersion": "storage.k8s.io/v1",
"metadata": {"name": sc_name},
"provisioner": provisioner,
+ "reclaimPolicy": reclaim_policy,
"parameters": parameters,
"allowVolumeExpansion": allow_volume_expansion,
})