Detect the second zone for copyImage operation

When copying templates and ISOs detect that a second zone is available.
Else skip the test.

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
This commit is contained in:
Prasanna Santhanam 2013-05-20 17:50:32 +05:30
parent 8da7ec05f1
commit 92e6352287
2 changed files with 13 additions and 8 deletions

View File

@ -202,11 +202,9 @@ class TestISO(cloudstackTestCase):
cls.services["sourcezoneid"] = cls.zone.id
#populate second zone id for iso copy
cmd = listZones.listZonesCmd()
zones = cls.api_client.listZones(cmd)
if not isinstance(zones, list):
cls.zones = cls.api_client.listZones(cmd)
if not isinstance(cls.zones, list):
raise Exception("Failed to find zones.")
if len(zones) >= 2:
cls.services["destzoneid"] = zones[1].id
#Create an account, ISOs etc.
cls.account = Account.create(
@ -484,6 +482,10 @@ class TestISO(cloudstackTestCase):
#Validate the following
#1. copy ISO should be successful and secondary storage
# should contain new copied ISO.
if len(self.zones) <= 1:
self.skipTest("Not enough zones available to perform copy template")
self.services["destzoneid"] = filter(lambda z: z.id != self.zone.id, self.zones)[0]
self.debug("Copy ISO from %s to %s" % (
self.zone.id,

View File

@ -295,11 +295,9 @@ class TestTemplates(cloudstackTestCase):
cls.services['mode'] = cls.zone.networktype
#populate second zone id for iso copy
cmd = listZones.listZonesCmd()
zones = cls.api_client.listZones(cmd)
if not isinstance(zones, list):
cls.zones = cls.api_client.listZones(cmd)
if not isinstance(cls.zones, list):
raise Exception("Failed to find zones.")
if len(zones) >= 2:
cls.services["destzoneid"] = zones[1].id
cls.disk_offering = DiskOffering.create(
cls.api_client,
@ -664,6 +662,11 @@ class TestTemplates(cloudstackTestCase):
# 1. copy template should be successful and
# secondary storage should contain new copied template.
if len(self.zones) <= 1:
self.skipTest("Not enough zones available to perform copy template")
self.services["destzoneid"] = filter(lambda z: z.id != self.services["sourcezoneid"], self.zones)[0]
self.debug("Copy template from Zone: %s to %s" % (
self.services["sourcezoneid"],
self.services["destzoneid"]