def __update_template_params_for_proxy__(service, template_name, dict_params): for i in range(3): try: RefCPSService.update_template_params(service, template_name, dict_params) RefCPSService.cps_commit() log.info("update template params success, service: %s, template_name: %s" % (service, template_name)) time.sleep(1) return True except Exception as e: log.error("update template params error, try again, service: %s, template_name: %s, exception: %s" % (service, template_name, e.message)) time.sleep(1) continue log.error("update template params failed, service: %s, template_name: %s." % (service, template_name)) return False
def __enable_l2_remote_port_for_proxy__(proxy_name): service = 'neutron' # e.g. 'neutron-l2-proxy003' template = '-'.join(['neutron-l2', proxy_name]) updated_params = { 'remote_port_enabled': 'True' } for i in range(3): try: RefCPSService.update_template_params(service, template, updated_params) RefCPSService.cps_commit() log.info("enable l2 remote port success, proxy: %s" % proxy_name) return True except Exception as e: log.error("enable l2 remote port error, try again, proxy: %s, exception: %s" % (proxy_name, e.message)) time.sleep(1) continue log.error("enable l2 remote port failed, proxy: %s" % proxy_name) return False
def __enable_l2_remote_port_for_proxy__(proxy_name): service = 'neutron' # e.g. 'neutron-l2-proxy003' template = '-'.join(['neutron-l2', proxy_name]) updated_params = {'remote_port_enabled': 'True'} for i in range(3): try: RefCPSService.update_template_params(service, template, updated_params) RefCPSService.cps_commit() log.info("enable l2 remote port success, proxy: %s" % proxy_name) return True except Exception as e: log.error( "enable l2 remote port error, try again, proxy: %s, exception: %s" % (proxy_name, e.message)) time.sleep(1) continue log.error("enable l2 remote port failed, proxy: %s" % proxy_name) return False
def __update_template_params_for_proxy__(service, template_name, dict_params): for i in range(3): try: RefCPSService.update_template_params(service, template_name, dict_params) RefCPSService.cps_commit() log.info( "update template params success, service: %s, template_name: %s" % (service, template_name)) time.sleep(1) return True except Exception as e: log.error( "update template params error, try again, service: %s, template_name: %s, exception: %s" % (service, template_name, e.message)) time.sleep(1) continue log.error( "update template params failed, service: %s, template_name: %s." % (service, template_name)) return False
def _update_template_params_for_proxy(self, service, template_name, dict_params): result = RefCPSService.update_template_params(service, template_name, dict_params) return result