(self, hosts, zoneId, podId, clusterId, hypervisor)
| 116 | self.__cleanUp["order"].append(type) |
| 117 | |
| 118 | def addHosts(self, hosts, zoneId, podId, clusterId, hypervisor): |
| 119 | if hosts is None: |
| 120 | print("\n === Invalid Hosts Information ====") |
| 121 | return |
| 122 | failed_cnt = 0 |
| 123 | for host in hosts: |
| 124 | try: |
| 125 | hostcmd = addHost.addHostCmd() |
| 126 | hostcmd.clusterid = clusterId |
| 127 | hostcmd.hosttags = host.hosttags |
| 128 | hostcmd.hypervisor = host.hypervisor |
| 129 | hostcmd.password = host.password |
| 130 | hostcmd.podid = podId |
| 131 | hostcmd.url = host.url |
| 132 | hostcmd.username = host.username |
| 133 | hostcmd.zoneid = zoneId |
| 134 | hostcmd.hypervisor = hypervisor |
| 135 | if hostcmd.hypervisor.lower() == "baremetal": |
| 136 | hostcmd.hostmac=host.hostmac |
| 137 | hostcmd.cpunumber=host.cpunumber |
| 138 | hostcmd.cpuspeed=host.cpuspeed |
| 139 | hostcmd.memory=host.memory |
| 140 | hostcmd.hosttags=host.hosttags |
| 141 | ret = self.__apiClient.addHost(hostcmd) |
| 142 | if ret: |
| 143 | self.__tcRunLogger.debug("=== Add Host Successful ===") |
| 144 | self.__addToCleanUp("Host", ret[0].id) |
| 145 | except Exception as e: |
| 146 | failed_cnt = failed_cnt + 1 |
| 147 | print("Exception Occurred :%s" % GetDetailExceptionInfo(e)) |
| 148 | self.__tcRunLogger.exception( |
| 149 | "=== Adding Host Failed :%s===" % str( |
| 150 | host.url)) |
| 151 | if failed_cnt == len(hosts): |
| 152 | self.__cleanAndExit() |
| 153 | continue |
| 154 | |
| 155 | def addVmWareDataCenter(self, vmwareDc): |
| 156 | try: |
no test coverage detected