Repository: cloudstack Updated Branches: refs/heads/pytest 49b401e14 -> 8b7f88ac9
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/8b7f88ac Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/8b7f88ac Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/8b7f88ac Branch: refs/heads/pytest Commit: 8b7f88ac90c5de8bd49cd045f1f13f6ebbf516f8 Parents: 49b401e Author: edison <sudi...@gmail.com> Authored: Thu Sep 25 16:49:18 2014 -0700 Committer: edison <sudi...@gmail.com> Committed: Thu Sep 25 16:49:18 2014 -0700 ---------------------------------------------------------------------- tools/marvin/marvin/deployDataCenter.py | 21 +++++++++++++++++++++ tools/marvin/marvin/marvinInit.py | 18 +----------------- 2 files changed, 22 insertions(+), 17 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8b7f88ac/tools/marvin/marvin/deployDataCenter.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/deployDataCenter.py b/tools/marvin/marvin/deployDataCenter.py index 85057d2..93cd6d0 100644 --- a/tools/marvin/marvin/deployDataCenter.py +++ b/tools/marvin/marvin/deployDataCenter.py @@ -33,6 +33,8 @@ from marvin.cloudstackAPI import * from marvin.codes import (FAILED, SUCCESS) from marvin.lib.utils import (random_gen) from marvin.config.test_data import test_data +from marvin.lib.common import get_template,get_zone +import time from sys import exit import os import pickle @@ -842,6 +844,24 @@ class DeployDataCenters(object): self.__tcRunLogger.exception("====AddS3 Failed===") self.__cleanAndExit() + def waitZoneIsReady(self, zoneName): + apiClient = self.__apiClient + zone = get_zone(apiClient, zoneName) + 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 waitForZonesReady(self): + for zone in self.__config.zones: + self.waitZoneIsReady(zone.name) + def deploy(self): try: print "\n==== Deploy DC Started ====" @@ -859,6 +879,7 @@ class DeployDataCenters(object): ''' self.createZones(self.__config.zones) self.configureS3(self.__config.s3) + self.waitForZonesReady() ''' Persist the Configuration to an external file post DC creation ''' http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8b7f88ac/tools/marvin/marvin/marvinInit.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/marvinInit.py b/tools/marvin/marvin/marvinInit.py index 379c13e..b9da61f 100644 --- a/tools/marvin/marvin/marvinInit.py +++ b/tools/marvin/marvin/marvinInit.py @@ -29,7 +29,6 @@ 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, @@ -149,8 +148,7 @@ class MarvinInit: (self.__setTestDataPath() != FAILED) and (self.__initLogging() != FAILED) and (self.__createTestClient() != FAILED) and - (self.__deployDC() != FAILED) and - (self._waitZoneIsReady() != FAILED)): + (self.__deployDC() != FAILED)): print "\n==== Marvin Init Successful ====" return SUCCESS print "\n==== Marvin Init Failed ====" @@ -160,20 +158,6 @@ 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): '''