[
https://issues.apache.org/jira/browse/CLOUDSTACK-9323?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15231397#comment-15231397
]
ASF GitHub Bot commented on CLOUDSTACK-9323:
--------------------------------------------
Github user jburwell commented on a diff in the pull request:
https://github.com/apache/cloudstack/pull/1454#discussion_r58965445
--- Diff: tools/marvin/marvin/lib/utils.py ---
@@ -520,4 +520,22 @@ def verifyRouterState(apiclient, routerid,
allowedstates):
if routers[0].state.lower() not in allowedstates:
return [FAIL, "state of the router should be in %s but is %s" %
(allowedstates, routers[0].state)]
- return [PASS, None]
\ No newline at end of file
+ return [PASS, None]
+
+
+
+def wait_until(retry_interval=2, no_of_times=2, callback=None,
*callback_args):
+ """ Utility method to try out the callback method at most no_of_times
with a interval of retry_interval,
+ Will return immediately if callback returns True. The callback method
should be written to return a list of values first being a boolean """
+
+ if callback is None:
+ return INVALID_INPUT
+ success = False
+ for i in range(0,no_of_times):
+ time.sleep(retry_interval)
+ success = callback(*callback_args)
+ if success[0]:
+ break
+
+ return success
--- End diff --
Consider a multi-return -- allowing callers to unambiguously determine
success/failure vs the results of the method
```
return (success, result)
```
> Cancelling host maintenance results in ""Internal error cancelling
> maintenance.”
> --------------------------------------------------------------------------------
>
> Key: CLOUDSTACK-9323
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-9323
> Project: CloudStack
> Issue Type: Bug
> Security Level: Public(Anyone can view this level - this is the
> default.)
> Reporter: Abhinandan Prateek
> Assignee: Abhinandan Prateek
> Fix For: Future
>
>
> When we try to cancel the host from maintenance, all the hosts are
> complaining ""Internal error cancelling maintenance.” but successfully
> enabling the host back.
> In both scenarios like host is in up or disconnected state.
> This causes problem when we programmatically cancel maintenance….
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)