def _setup_service(host, name): try: utils.raise_if_old_compute() except exception.TooOldComputeService as e: if CONF.workarounds.disable_compute_service_check_for_ffu: LOG.warning(str(e)) else: raise binary = name if name.startswith('nova-') else "nova-%s" % name ctxt = context.get_admin_context() service_ref = objects.Service.get_by_host_and_binary(ctxt, host, binary) if service_ref: service._update_service_ref(service_ref) else: try: service_obj = objects.Service(ctxt) service_obj.host = host service_obj.binary = binary service_obj.topic = None service_obj.report_count = 0 service_obj.create() except (exception.ServiceTopicExists, exception.ServiceBinaryExists): # If we race to create a record with a sibling, don't # fail here. pass
def _setup_service(host, name): ctxt = context.get_admin_context() service_ref = objects.Service.get_by_host_and_binary(ctxt, host, name) if service_ref: service._update_service_ref(service_ref) else: try: service_obj = objects.Service(ctxt) service_obj.host = host service_obj.binary = 'nova-%s' % name service_obj.topic = None service_obj.report_count = 0 service_obj.create() except (exception.ServiceTopicExists, exception.ServiceBinaryExists): # If we race to create a record with a sibling, don't # fail here. pass
def _setup_service(host, name): ctxt = context.get_admin_context() service_ref = objects.Service.get_by_host_and_binary( ctxt, host, name) if service_ref: service._update_service_ref(service_ref) else: try: service_obj = objects.Service(ctxt) service_obj.host = host service_obj.binary = 'nova-%s' % name service_obj.topic = None service_obj.report_count = 0 service_obj.create() except (exception.ServiceTopicExists, exception.ServiceBinaryExists): # If we race to create a record with a sibling, don't # fail here. pass
def _setup_service(host, name): utils.raise_if_old_compute() binary = name if name.startswith('nova-') else "nova-%s" % name ctxt = context.get_admin_context() service_ref = objects.Service.get_by_host_and_binary(ctxt, host, binary) if service_ref: service._update_service_ref(service_ref) else: try: service_obj = objects.Service(ctxt) service_obj.host = host service_obj.binary = binary service_obj.topic = None service_obj.report_count = 0 service_obj.create() except (exception.ServiceTopicExists, exception.ServiceBinaryExists): # If we race to create a record with a sibling, don't # fail here. pass
def _setup_service(host, name): binary = name if name.startswith( 'nova-') else "nova-%s" % name #nova-osapi_compute ctxt = context.get_admin_context( ) #创建上下文context,nova/context/RequestContext service_ref = objects.Service.get_by_host_and_binary( ctxt, host, binary) #从数据库获取数据,生成sevice if service_ref: service._update_service_ref(service_ref) #版本号相关 else: try: service_obj = objects.Service(ctxt) service_obj.host = host service_obj.binary = binary service_obj.topic = None service_obj.report_count = 0 service_obj.create() except (exception.ServiceTopicExists, exception.ServiceBinaryExists): # If we race to create a record with a sibling, don't # fail here. pass