mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-11-04 00:02:37 +01:00 
			
		
		
		
	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>
This commit is contained in:
		
							parent
							
								
									16bf065a0d
								
							
						
					
					
						commit
						8b39e2ff71
					
				@ -154,11 +154,8 @@ class host(object):
 | 
			
		||||
        self.podid = None
 | 
			
		||||
        self.clusterid = None
 | 
			
		||||
        self.clustername = None
 | 
			
		||||
        self.cpunumber = None
 | 
			
		||||
        self.cpuspeed = None
 | 
			
		||||
        self.hostmac = None
 | 
			
		||||
        self.hosttags = None
 | 
			
		||||
        self.memory = None
 | 
			
		||||
        self.allocationstate = None
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class physicalNetwork(object):
 | 
			
		||||
 | 
			
		||||
@ -117,18 +117,16 @@ class DeployDataCenters(object):
 | 
			
		||||
            self.__cleanUp["order"].append(type)
 | 
			
		||||
 | 
			
		||||
    def addHosts(self, hosts, zoneId, podId, clusterId, hypervisor):
 | 
			
		||||
        try:
 | 
			
		||||
        if hosts is None:
 | 
			
		||||
            print "\n === Invalid Hosts Information ===="
 | 
			
		||||
            return
 | 
			
		||||
        failed_cnt = 0
 | 
			
		||||
        for host in hosts:
 | 
			
		||||
            try:
 | 
			
		||||
                hostcmd = addHost.addHostCmd()
 | 
			
		||||
                hostcmd.clusterid = clusterId
 | 
			
		||||
                hostcmd.cpunumber = host.cpunumer
 | 
			
		||||
                hostcmd.cpuspeed = host.cpuspeed
 | 
			
		||||
                hostcmd.hostmac = host.hostmac
 | 
			
		||||
                hostcmd.hosttags = host.hosttags
 | 
			
		||||
                hostcmd.hypervisor = host.hypervisor
 | 
			
		||||
                hostcmd.memory = host.memory
 | 
			
		||||
                hostcmd.password = host.password
 | 
			
		||||
                hostcmd.podid = podId
 | 
			
		||||
                hostcmd.url = host.url
 | 
			
		||||
@ -140,9 +138,14 @@ class DeployDataCenters(object):
 | 
			
		||||
                    self.__tcRunLogger.debug("=== Add Host Successful ===")
 | 
			
		||||
                    self.__addToCleanUp("Host", ret[0].id)
 | 
			
		||||
            except Exception as e:
 | 
			
		||||
            print "Exception Occurred %s" % GetDetailExceptionInfo(e)
 | 
			
		||||
            self.__tcRunLogger.exception("=== Adding Host Failed ===")
 | 
			
		||||
                failed_cnt = failed_cnt + 1
 | 
			
		||||
                print "Exception Occurred :%s" % GetDetailExceptionInfo(e)
 | 
			
		||||
                self.__tcRunLogger.exception(
 | 
			
		||||
                    "=== Adding Host Failed :%s===" % str(
 | 
			
		||||
                        host.url))
 | 
			
		||||
                if failed_cnt == len(hosts):
 | 
			
		||||
                    self.__cleanAndExit()
 | 
			
		||||
                continue
 | 
			
		||||
 | 
			
		||||
    def addVmWareDataCenter(self, vmwareDc):
 | 
			
		||||
        try:
 | 
			
		||||
@ -516,7 +519,8 @@ class DeployDataCenters(object):
 | 
			
		||||
                        self.enableProvider(pnetprovres[0].id)
 | 
			
		||||
                    elif provider.name == 'SecurityGroupProvider':
 | 
			
		||||
                        self.enableProvider(pnetprovres[0].id)
 | 
			
		||||
                elif provider.name in ['JuniperContrailRouter', 'JuniperContrailVpcRouter']:
 | 
			
		||||
                elif provider.name in ['JuniperContrailRouter',
 | 
			
		||||
                                       'JuniperContrailVpcRouter']:
 | 
			
		||||
                    netprov = addNetworkServiceProvider.\
 | 
			
		||||
                        addNetworkServiceProviderCmd()
 | 
			
		||||
                    netprov.name = provider.name
 | 
			
		||||
@ -1073,6 +1077,10 @@ if __name__ == "__main__":
 | 
			
		||||
    '''
 | 
			
		||||
    Step1: Create the Logger
 | 
			
		||||
    '''
 | 
			
		||||
    if (options.input) and not (os.path.isfile(options.input)):
 | 
			
		||||
        print "\n=== Invalid Input Config File Path, Please Check ==="
 | 
			
		||||
        exit(1)
 | 
			
		||||
 | 
			
		||||
    log_obj = MarvinLog("CSLog")
 | 
			
		||||
    cfg = configGenerator.getSetupConfig(options.input)
 | 
			
		||||
    log = cfg.logger
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user