diff options
author | Valerii Ponomarov <vponomar@redhat.com> | 2018-12-21 17:18:22 +0530 |
---|---|---|
committer | Valerii Ponomarov <vponomar@redhat.com> | 2018-12-26 15:52:13 +0000 |
commit | cfd6ca362386219646c010cde3ec60f0e5e9b140 (patch) | |
tree | c7e0cadd382efbc7a797ecde40596ee7480611df | |
parent | a118c991bfd5368aee517cc26188b1e3fee82d1f (diff) |
Add events info for 'verify_pvc_status_is_bound' common func
For the moment, we write events of failed PVC only to glusto logs.
And only info of one type of events - 'ProvisioningFailed'.
But in case of CI, it is not really suitable. We need to have info in
the exception message.
So, add all the pvc-related events to the message of raised exception when
PVC fails to reach the "Bound" state.
Change-Id: I60e3b9a86acdf251d282059cd2e494c70ae07c70
-rw-r--r-- | cns-libs/cnslibs/common/openshift_ops.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/cns-libs/cnslibs/common/openshift_ops.py b/cns-libs/cnslibs/common/openshift_ops.py index 172a3d6a..9a84ee83 100644 --- a/cns-libs/cnslibs/common/openshift_ops.py +++ b/cns-libs/cnslibs/common/openshift_ops.py @@ -1033,12 +1033,16 @@ def verify_pvc_status_is_bound(hostname, pvc_name, timeout=120, wait_step=3): if msg: raise AssertionError(msg) if w.expired: - # for debug purpose to see why provisioning failed - cmd = "oc describe pvc %s | grep ProvisioningFailed" % pvc_name - ret, out, err = g.run(hostname, cmd, "root") - g.log.info("cmd %s - out- %s err- %s" % (cmd, out, err)) msg = ("Exceeded timeout of '%s' seconds for verifying PVC '%s' " - "to reach the 'Bound' status." % (timeout, pvc_name)) + "to reach the 'Bound' state." % (timeout, pvc_name)) + + # Gather more info for ease of debugging + try: + pvc_events = get_events(hostname, obj_name=pvc_name) + except Exception: + pvc_events = '?' + msg += "\nPVC events: %s" % pvc_events + g.log.error(msg) raise AssertionError(msg) |