Skip to content

Commit 8b39e2f

Browse files
sedukullAbhinandan Prateek
authored andcommitted
Added fix for CLOUDSTACK-6529
Fixed to continue adding all hosts, even if any addition fails and remove unused args from host class. Signed-off-by: santhosh <santhosh.edukulla@gmail.com> Signed-off-by: Abhinandan Prateek <aprateek@apache.org>
1 parent 16bf065 commit 8b39e2f

2 files changed

Lines changed: 22 additions & 17 deletions

File tree

tools/marvin/marvin/configGenerator.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,8 @@ def __init__(self):
154154
self.podid = None
155155
self.clusterid = None
156156
self.clustername = None
157-
self.cpunumber = None
158-
self.cpuspeed = None
159-
self.hostmac = None
160157
self.hosttags = None
161-
self.memory = None
158+
self.allocationstate = None
162159

163160

164161
class physicalNetwork(object):

tools/marvin/marvin/deployDataCenter.py

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -117,18 +117,16 @@ def __addToCleanUp(self, type, id):
117117
self.__cleanUp["order"].append(type)
118118

119119
def addHosts(self, hosts, zoneId, podId, clusterId, hypervisor):
120-
try:
121-
if hosts is None:
122-
return
123-
for host in hosts:
120+
if hosts is None:
121+
print "\n === Invalid Hosts Information ===="
122+
return
123+
failed_cnt = 0
124+
for host in hosts:
125+
try:
124126
hostcmd = addHost.addHostCmd()
125127
hostcmd.clusterid = clusterId
126-
hostcmd.cpunumber = host.cpunumer
127-
hostcmd.cpuspeed = host.cpuspeed
128-
hostcmd.hostmac = host.hostmac
129128
hostcmd.hosttags = host.hosttags
130129
hostcmd.hypervisor = host.hypervisor
131-
hostcmd.memory = host.memory
132130
hostcmd.password = host.password
133131
hostcmd.podid = podId
134132
hostcmd.url = host.url
@@ -139,10 +137,15 @@ def addHosts(self, hosts, zoneId, podId, clusterId, hypervisor):
139137
if ret:
140138
self.__tcRunLogger.debug("=== Add Host Successful ===")
141139
self.__addToCleanUp("Host", ret[0].id)
142-
except Exception as e:
143-
print "Exception Occurred %s" % GetDetailExceptionInfo(e)
144-
self.__tcRunLogger.exception("=== Adding Host Failed ===")
145-
self.__cleanAndExit()
140+
except Exception as e:
141+
failed_cnt = failed_cnt + 1
142+
print "Exception Occurred :%s" % GetDetailExceptionInfo(e)
143+
self.__tcRunLogger.exception(
144+
"=== Adding Host Failed :%s===" % str(
145+
host.url))
146+
if failed_cnt == len(hosts):
147+
self.__cleanAndExit()
148+
continue
146149

147150
def addVmWareDataCenter(self, vmwareDc):
148151
try:
@@ -516,7 +519,8 @@ def configureProviders(self, phynetwrk, providers):
516519
self.enableProvider(pnetprovres[0].id)
517520
elif provider.name == 'SecurityGroupProvider':
518521
self.enableProvider(pnetprovres[0].id)
519-
elif provider.name in ['JuniperContrailRouter', 'JuniperContrailVpcRouter']:
522+
elif provider.name in ['JuniperContrailRouter',
523+
'JuniperContrailVpcRouter']:
520524
netprov = addNetworkServiceProvider.\
521525
addNetworkServiceProviderCmd()
522526
netprov.name = provider.name
@@ -1073,6 +1077,10 @@ def removeDataCenter(self):
10731077
'''
10741078
Step1: Create the Logger
10751079
'''
1080+
if (options.input) and not (os.path.isfile(options.input)):
1081+
print "\n=== Invalid Input Config File Path, Please Check ==="
1082+
exit(1)
1083+
10761084
log_obj = MarvinLog("CSLog")
10771085
cfg = configGenerator.getSetupConfig(options.input)
10781086
log = cfg.logger

0 commit comments

Comments
 (0)