You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by gi...@apache.org on 2014/02/12 13:06:13 UTC

[3/3] git commit: updated refs/heads/marvin to c78292e

CLOUDSTACK-6082: Add alternate zone creation under deploy DC


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/c78292e9
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/c78292e9
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/c78292e9

Branch: refs/heads/marvin
Commit: c78292e9cdd904c9cc58a33f5114baf4b1ba793b
Parents: 3dbb2ae
Author: Santhosh Edukulla <Sa...@citrix.com>
Authored: Wed Feb 12 17:35:19 2014 +0530
Committer: Girish Shilamkar <gi...@clogeny.com>
Committed: Wed Feb 12 17:35:19 2014 +0530

----------------------------------------------------------------------
 tools/marvin/marvin/deployDataCenter.py | 59 ++++++++++++++++++----------
 1 file changed, 38 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c78292e9/tools/marvin/marvin/deployDataCenter.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/deployDataCenter.py b/tools/marvin/marvin/deployDataCenter.py
index c8feaaf..bf4b688 100644
--- a/tools/marvin/marvin/deployDataCenter.py
+++ b/tools/marvin/marvin/deployDataCenter.py
@@ -27,6 +27,7 @@ from os import path
 from time import sleep
 from optparse import OptionParser
 from marvin.codes import (FAILED, SUCCESS)
+from marvin.lib.utils import (random_gen)
 from sys import exit
 
 
@@ -479,32 +480,48 @@ class DeployDataCenters(object):
         else:
             return ret
 
+    def createZone(self, zone, rec=0):
+        try:
+            zoneresponse = self.apiClient.createZone(zone)
+            if zoneresponse == FAILED:
+                self.tcRunLogger.\
+                    exception("====Zone : %s Creation Failed=====" %
+                              str(zone.name))
+                if not rec:
+                    zone.name = zone.name + random_gen()
+                    self.tcRunLogger.\
+                        debug("====Recreating Zone With New Name : "
+                              "%s" % zone.name)
+                    return self.createZone(zone, 1)
+            else:
+                self.tcRunLogger.\
+                    debug("Zone Name : %s Id : %s Created Successfully" %
+                          (str(zone.name), str(zoneresponse.id)))
+                return zoneresponse.id
+        except Exception, e:
+            print "\nException Occurred under createZone %s" % \
+                  GetDetailExceptionInfo(e)
+            return FAILED
+
     def createZones(self, zones):
         for zone in zones:
-            createzone = createZone.createZoneCmd()
-            createzone.dns1 = zone.dns1
-            createzone.dns2 = zone.dns2
-            createzone.internaldns1 = zone.internaldns1
-            createzone.internaldns2 = zone.internaldns2
-            createzone.name = zone.name
-            createzone.securitygroupenabled = zone.securitygroupenabled
-            createzone.localstorageenabled = zone.localstorageenabled
-            createzone.networktype = zone.networktype
+            zonecmd = createZone.createZoneCmd()
+            zonecmd.dns1 = zone.dns1
+            zonecmd.dns2 = zone.dns2
+            zonecmd.internaldns1 = zone.internaldns1
+            zonecmd.internaldns2 = zone.internaldns2
+            zonecmd.name = zone.name
+            zonecmd.securitygroupenabled = zone.securitygroupenabled
+            zonecmd.localstorageenabled = zone.localstorageenabled
+            zonecmd.networktype = zone.networktype
             if zone.securitygroupenabled != "true":
-                createzone.guestcidraddress = zone.guestcidraddress
-
-            zoneresponse = self.apiClient.createZone(createzone)
-            if zoneresponse != FAILED and zoneresponse.id is not None:
-                zoneId = zoneresponse.id
-                self.tcRunLogger.debug("Zone Name : %s Id : %s "
-                                       "Created Successfully" %
-                                       (str(zone.name), str(zoneId)))
-            else:
+                zonecmd.guestcidraddress = zone.guestcidraddress
+            ret = self.createZone(zonecmd)
+            if ret == FAILED:
                 self.tcRunLogger.\
-                    exception("====ZoneCreation :  %s Failed=====" %
-                              str(zone.name))
+                    exception("====Zone Creation Failed. So Exiting=====")
                 exit(1)
-
+            zoneId = ret
             for pnet in zone.physical_networks:
                 phynetwrk = self.createPhysicalNetwork(pnet, zoneId)
                 self.configureProviders(phynetwrk, pnet.providers)