Github user gauravaradhye commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/268#discussion_r30691290
  
    --- Diff: tools/marvin/marvin/lib/base.py ---
    @@ -2520,6 +2520,35 @@ def reconnect(cls, apiclient, **kwargs):
             [setattr(cmd, k, v) for k, v in kwargs.items()]
             return(apiclient.reconnectHost(cmd))
     
    +    @classmethod
    +    def getState(cls, apiclient, hostid, state, resourcestate, 
timeout=600):
    +        """List Host and check if its resource state is as expected
    +        @returnValue - List[Result, Reason]
    +                       1) Result - FAIL if there is any exception
    +                       in the operation or Host state does not change
    +                       to expected state in given time else PASS
    +                       2) Reason - Reason for failure"""
    +
    +        returnValue = [FAIL, "VM state not trasited to %s,\
    +                        operation timed out" % state]
    +
    +        while timeout > 0:
    +            try:
    +                hosts = Host.list(apiclient, 
    +                          id=hostid, listall=True)
    +                validationresult = validateList(hosts)
    +                if validationresult[0] == FAIL:
    +                    raise Exception("Host list validation failed: %s" % 
validationresult[2])
    --- End diff --
    
    Fix pep8 issues


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to