Repository: cloudstack Updated Branches: refs/heads/pytest d002c52a1 -> 49b401e14 (forced update)
wait for user vm template is up Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/49b401e1 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/49b401e1 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/49b401e1 Branch: refs/heads/pytest Commit: 49b401e14bf33c70de59e7d34a901580221ee15f Parents: b155b8a Author: edison <[email protected]> Authored: Thu Sep 25 15:32:56 2014 -0700 Committer: edison <[email protected]> Committed: Thu Sep 25 15:32:56 2014 -0700 ---------------------------------------------------------------------- tools/marvin/marvin/marvinInit.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/49b401e1/tools/marvin/marvin/marvinInit.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/marvinInit.py b/tools/marvin/marvin/marvinInit.py index dd71211..379c13e 100644 --- a/tools/marvin/marvin/marvinInit.py +++ b/tools/marvin/marvin/marvinInit.py @@ -29,13 +29,14 @@ from marvin.marvinLog import MarvinLog from marvin.deployDataCenter import DeployDataCenters from marvin.cloudstackTestClient import CSTestClient from marvin.cloudstackException import GetDetailExceptionInfo +from marvin.lib.common import get_template,get_zone from marvin.codes import( XEN_SERVER, SUCCESS, FAILED ) import os - +import time class MarvinInit: @@ -148,7 +149,8 @@ class MarvinInit: (self.__setTestDataPath() != FAILED) and (self.__initLogging() != FAILED) and (self.__createTestClient() != FAILED) and - (self.__deployDC() != FAILED)): + (self.__deployDC() != FAILED) and + (self._waitZoneIsReady() != FAILED)): print "\n==== Marvin Init Successful ====" return SUCCESS print "\n==== Marvin Init Failed ====" @@ -158,6 +160,21 @@ class MarvinInit: "%s" % GetDetailExceptionInfo(e) return FAILED + def _waitZoneIsReady(self): + testClient = self.getTestClient() + apiClient = testClient.getApiClient() + zone = get_zone(apiClient, testClient.getZoneForTests()) + retries = 5 * 60 / 10 + while retries > 0: + template = get_template(apiClient, zone.id) + if template: + return SUCCESS + self.__tcRunLogger.debug("waiting for user vm template is up") + retries -= 1 + time.sleep(10) + + return FAILED + def __initLogging(self): ''' @Name : __initLogging
