def config_big_l2_layer_in_proxy_node(self): host_list = None for i in range(3): try: host_list = RefCPSService.host_list() log.info("get host list success.") break except Exception as e: log.error("get host list error, try again. error: %s" % e.message) time.sleep(1) continue if host_list is None: log.error("config big l2 layer for proxies failed, get host list failed.") return False for proxy in self.proxies: # enable l2 remote port self.__enable_l2_remote_port_for_proxy__(proxy) # copy file host_id = self.proxy_match_host[proxy] host_ip = None for host in host_list["hosts"]: if host_id == host["id"]: host_ip = host["manageip"] break if host_ip is None: log.error("proxy not exist, proxy: %s, proxy id: %s" % (proxy, host_id)) continue log.info('start to replace neutron l2 proxy json in proxy nodes. proxy: %s' % proxy) replace_result = False for i in range(3): try: # utils.remote_open_root_permit_for_host(proxy_host_ip) local_path_of_neutron_l2_proxy = os.path.join( utils.get_patches_tool_path(), CfgFilePath.NEUTRON_L2_PROXY_PATH_TEMPLATE) ssh = SSHConnection(host_ip, SysUserInfo.ROOT, SysUserInfo.ROOT_PWD) ssh.put(local_path_of_neutron_l2_proxy, CfgFilePath.NEUTRON_L2_PROXY_PATH) ssh.close() replace_result = True log.info('replace neutron l2 proxy json success, proxy: %s' % proxy) break except Exception, e: log.error('replace neutron l2 proxy json error, try again, proxy: %s, error: %s' % (proxy, e.message)) time.sleep(1) continue finally: ssh.close()
def patch_for_cascading_and_proxy_node(self): host_list = RefCPSService.host_list() for host in host_list['hosts']: roles_list = host['roles'] proxy_host_ip = host['manageip'] region = self._get_region_by_roles_list(roles_list) if region is not None: print('Start to patch for region - <%s>' % region) absolute_patch_path = self._get_path_by_region(region) PatchInstaller(absolute_patch_path, utils.get_openstack_installed_path(), ['.py'], proxy_host_ip).install() print('Finish to patch for region - <%s>' % region) else: print('Region of ip <%s> is None, can not patch for this proxy' % proxy_host_ip)
def patch_for_cascading_and_proxy_node(self): host_list = RefCPSService.host_list() for host in host_list['hosts']: roles_list = host['roles'] proxy_host_ip = host['manageip'] region = self._get_region_by_roles_list(roles_list) if region is not None: print('Start to patch for region - <%s>' % region) absolute_patch_path = self._get_path_by_region(region) PatchInstaller(absolute_patch_path, utils.get_openstack_installed_path(), ['.py'], proxy_host_ip).install() print('Finish to patch for region - <%s>' % region) else: print( 'Region of ip <%s> is None, can not patch for this proxy' % proxy_host_ip)
def config_big_l2_layer_in_proxy_node(self): self._config_big_l2_layer_in_proxy(self.current_proxy) host_list = RefCPSService.host_list() if host_list is not None: self._replace_neutron_l2_proxy_json(host_list)
def config_big_l2_layer_in_proxy_node(self): host_list = None for i in range(3): try: host_list = RefCPSService.host_list() log.info("get host list success.") break except Exception as e: log.error("get host list error, try again. error: %s" % e.message) time.sleep(1) continue if host_list is None: log.error( "config big l2 layer for proxies failed, get host list failed." ) return False for proxy in self.proxies: # enable l2 remote port self.__enable_l2_remote_port_for_proxy__(proxy) # copy file host_id = self.proxy_match_host[proxy] host_ip = None for host in host_list["hosts"]: if host_id == host["id"]: host_ip = host["manageip"] break if host_ip is None: log.error("proxy not exist, proxy: %s, proxy id: %s" % (proxy, host_id)) continue log.info( 'start to replace neutron l2 proxy json in proxy nodes. proxy: %s' % proxy) replace_result = False for i in range(3): try: # utils.remote_open_root_permit_for_host(proxy_host_ip) local_path_of_neutron_l2_proxy = os.path.join( utils.get_patches_tool_path(), CfgFilePath.NEUTRON_L2_PROXY_PATH_TEMPLATE) ssh = SSHConnection(host_ip, SysUserInfo.ROOT, SysUserInfo.ROOT_PWD) ssh.put(local_path_of_neutron_l2_proxy, CfgFilePath.NEUTRON_L2_PROXY_PATH) ssh.close() replace_result = True log.info( 'replace neutron l2 proxy json success, proxy: %s' % proxy) break except Exception, e: log.error( 'replace neutron l2 proxy json error, try again, proxy: %s, error: %s' % (proxy, e.message)) time.sleep(1) continue finally: ssh.close()