List StoragePools and check if its state is as expected @returnValue - List[Result, Reason] 1) Result - FAIL if there is any exception in the operation or pool state does not change to expected state in given time else PAS
(cls, apiclient, poolid, state, timeout=600)
| 3623 | |
| 3624 | @classmethod |
| 3625 | def getState(cls, apiclient, poolid, state, timeout=600): |
| 3626 | """List StoragePools and check if its state is as expected |
| 3627 | @returnValue - List[Result, Reason] |
| 3628 | 1) Result - FAIL if there is any exception |
| 3629 | in the operation or pool state does not change |
| 3630 | to expected state in given time else PASS |
| 3631 | 2) Reason - Reason for failure""" |
| 3632 | |
| 3633 | returnValue = [FAIL, "VM state not trasited to %s,\ |
| 3634 | operation timed out" % state] |
| 3635 | |
| 3636 | while timeout > 0: |
| 3637 | try: |
| 3638 | pools = StoragePool.list(apiclient, |
| 3639 | id=poolid, listAll=True) |
| 3640 | validationresult = validateList(pools) |
| 3641 | if validationresult[0] == FAIL: |
| 3642 | raise Exception("Pool list validation failed: %s" % validationresult[2]) |
| 3643 | elif str(pools[0].state).lower() == str(state).lower(): |
| 3644 | returnValue = [PASS, None] |
| 3645 | break |
| 3646 | except Exception as e: |
| 3647 | returnValue = [FAIL, e] |
| 3648 | break |
| 3649 | time.sleep(60) |
| 3650 | timeout -= 60 |
| 3651 | return returnValue |
| 3652 | |
| 3653 | @classmethod |
| 3654 | def listObjects(cls, apiclient, path="/"): |
nothing calls this directly
no test coverage detected