def create_rpc_dispatcher(self): '''Get the rpc dispatcher for this manager. If a manager would like to set an rpc API version, or support more than one class as the target of rpc messages, override this method. ''' return dispatcher.RpcDispatcher([self])
def setup_rpc(self): self.host = socket.gethostname() self.agent_id = 'nec-q-agent.%s' % self.host LOG.info(_("RPC agent_id: %s"), self.agent_id) self.topic = topics.AGENT self.context = q_context.get_admin_context_without_session() self.plugin_rpc = NECPluginApi(topics.PLUGIN) self.state_rpc = agent_rpc.PluginReportStateAPI(topics.PLUGIN) self.sg_agent = SecurityGroupAgentRpc(self.context) # RPC network init # Handle updates from service self.callback_nec = NECAgentRpcCallback(self.context, self, self.sg_agent) self.callback_sg = SecurityGroupAgentRpcCallback(self.context, self.sg_agent) self.dispatcher = dispatcher.RpcDispatcher([self.callback_nec, self.callback_sg]) # Define the listening consumer for the agent consumers = [[topics.PORT, topics.UPDATE], [topics.SECURITY_GROUP, topics.UPDATE]] self.connection = agent_rpc.create_consumers(self.dispatcher, self.topic, consumers) report_interval = config.CONF.AGENT.report_interval if report_interval: heartbeat = loopingcall.FixedIntervalLoopingCall( self._report_state) heartbeat.start(interval=report_interval)
def start(self): super(Service, self).start() self.conn = rpc.create_connection(new=True) LOG.debug( _("Creating Consumer connection for Service %s") % self.topic) dispatcher = rpc_dispatcher.RpcDispatcher([self.manager], self.serializer) # Share this same connection for these Consumers self.conn.create_consumer(self.topic, dispatcher, fanout=False) node_topic = '%s.%s' % (self.topic, self.host) self.conn.create_consumer(node_topic, dispatcher, fanout=False) self.conn.create_consumer(self.topic, dispatcher, fanout=True) # Hook to allow the manager to do other initializations after # the rpc connection is created. if callable(getattr(self.manager, 'initialize_service_hook', None)): self.manager.initialize_service_hook(self) # Consume from all consumers in a thread self.conn.consume_in_thread()
def _setup_rpc(self): self.topic = topics.AGENT self.plugin_rpc = PluginApi(topics.PLUGIN) self.context = q_context.get_admin_context_without_session() self.dispatcher = dispatcher.RpcDispatcher([self]) consumers = [[topics.PORT, topics.UPDATE], [topics.SECURITY_GROUP, topics.UPDATE]] self.connection = agent_rpc.create_consumers(self.dispatcher, self.topic, consumers)
def setup_rpc(self): self.host = socket.gethostname() self.agent_id = 'nvsd-q-agent.%s' % self.host LOG.info(_("RPC agent_id: %s"), self.agent_id) self.topic = topics.AGENT self.context = n_context.get_admin_context_without_session() self.sg_agent = SecurityGroupAgentRpc(self.context, self.root_helper) # RPC network init # Handle updates from service self.callback_oc = NVSDAgentRpcCallback(self.context, self, self.sg_agent) self.callback_sg = SecurityGroupAgentRpcCallback( self.context, self.sg_agent) self.dispatcher = dispatcher.RpcDispatcher( [self.callback_oc, self.callback_sg]) # Define the listening consumer for the agent consumers = [[topics.PORT, topics.UPDATE], [topics.SECURITY_GROUP, topics.UPDATE]] self.connection = agent_rpc.create_consumers(self.dispatcher, self.topic, consumers)
def _create_rpc_dispatcher(self): return dispatcher.RpcDispatcher([self])
def _create_rpc_dispatcher(self): rpc_callback = HyperVSecurityCallbackMixin(self) return dispatcher.RpcDispatcher([rpc_callback])
def _create_rpc_dispatcher(self): LOG.info(_('_create_rpc_dispatcher')) return dispatcher.RpcDispatcher([self])
def _setup_rpc(self): # LBaaS Callbacks API topic = lbaasv1constants.TOPIC_PROCESS_ON_HOST if self.conf.environment_specific_plugin: topic = topic + '_' + self.conf.environment_prefix LOG.debug('agent in %s environment will send callbacks to %s' % (self.conf.environment_prefix, topic)) self.plugin_rpc = agent_api.LbaasAgentApi( topic, self.context, self.conf.environment_prefix, self.conf.environment_group_number, self.agent_host ) # Allow driver to make callbacks using the # same RPC proxy as the manager self.lbdriver.set_plugin_rpc(self.plugin_rpc) # Agent state Callbacks API self.state_rpc = agent_rpc.PluginReportStateAPI(topic) report_interval = self.conf.AGENT.report_interval if report_interval: heartbeat = loopingcall.FixedIntervalLoopingCall( self._report_state) heartbeat.start(interval=report_interval) # The LBaaS agent listener with it's host are registered # as part of the rpc.Service. Here we are setting up # other message queues to listen for updates from # Neutron. if not self.conf.f5_global_routed_mode: # Core plugin Callbacks API for tunnel updates self.lbdriver.set_tunnel_rpc(agent_api.CoreAgentApi(topics.PLUGIN)) # L2 Populate plugin Callbacks API if self.conf.l2_population: self.lbdriver.set_l2pop_rpc(agent_api.L2PopulationApi()) # Besides LBaaS Plugin calls... what else to consume # tunnel updates to support vxlan and gre endpoint # NOTE: the driver can decide to handle endpoint # membership based on the rpc notification or through # other means (i.e. as part of a service definition) consumers = [[constants.TUNNEL, topics.UPDATE]] # L2 populate fdb calls # NOTE: the driver can decide to handle fdb updates # or use some other mechanism (i.e. flooding) to # learn about port updates. if self.conf.l2_population: consumers.append( [topics.L2POPULATION, topics.UPDATE, self.agent_host] ) if preJuno: self.dispatcher = dispatcher.RpcDispatcher([self]) else: self.endpoints = [self] LOG.debug(_('registering to %s consumer on RPC topic: %s' % (consumers, topics.AGENT))) if preJuno: self.connection = agent_rpc.create_consumers( self.dispatcher, topics.AGENT, consumers ) else: self.connection = agent_rpc.create_consumers( self.endpoints, topics.AGENT, consumers )