def setup_rpc(self): self.host = self.get_hostname() self.listen_topic = "sfc-consume" self.consumer_listener_topic = "crd-listener" # CRD RPC Notification self.listen_context = context.RequestContext('crd', 'crd', is_admin=False) # Handle updates from service self.dispatcher = self.create_rpc_dispatcher() # Define the listening consumers for the agent self.listen_conn = rpc.create_connection(new=True) LOG.debug(_("Creating CONSUMER with topic %s....\n"), self.listen_topic) self.listen_conn.join_consumer_pool(self.process_event, self.listen_topic, 'notifications.info', 'nova') self.listen_conn.join_consumer_pool(self.process_event, self.listen_topic, 'sfc-consume', 'crd') self.listen_conn.consume_in_thread() self.consumer_conn = rpc.create_connection(new=True) self.consumer_conn.create_consumer(self.consumer_listener_topic, self.dispatcher, fanout=False) self.consumer_conn.consume_in_thread()
def setup_rpc(self): # RPC support self.rpc_context = context.RequestContext('crd', 'crd', is_admin=True) self.conn = rpc.create_connection(new=True) self.dispatcher = dispatcher.RpcDispatcher([self]) self.conn.create_consumer(self.topic, self.dispatcher, fanout=False) # Consume from all consumers in a thread self.conn.consume_in_thread()
def _set_callbacks_on_plugin(self): # other agent based plugin driver might already set callbacks on plugin if hasattr(self.plugin, 'agent_callbacks'): return self.plugin.agent_callbacks = LoadBalancerCallbacks(self.plugin) self.plugin.conn = rpc.create_connection(new=True) self.plugin.conn.create_consumer( topics.LOADBALANCER_PLUGIN, self.plugin.agent_callbacks.create_rpc_dispatcher(), fanout=False) self.plugin.conn.consume_in_thread()
def setup_rpc(self): self.host = self.get_hostname() self.listen_topic = "generate_slb_config" # CRD RPC Notification self.listen_context = context.RequestContext("crd", "crd", is_admin=False) # Handle updates from service self.dispatcher = self.create_rpc_dispatcher() # Define the listening consumers for the agent self.listen_conn = rpc.create_connection(new=True) self.listen_conn.create_consumer(self.listen_topic, self.dispatcher, fanout=False) self.listen_conn.consume_in_thread()
def setup_rpc(self): self.host = get_hostname() self.topic = '%s.%s' % (topics.RELAY_AGENT, self.host) # RPC network init self.context = context.RequestContext('crd', 'crd', is_admin=False) # Handle updates from service self.dispatcher = self.create_rpc_dispatcher() # Define the listening consumers for the agent self.conn = rpc.create_connection(new=True) LOG.info(_('connection is created......' 'creating consumer with topic %s....\n'), self.topic) self.conn.create_consumer(self.topic, self.dispatcher, fanout=False) self.conn.consume_in_thread()
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]) # 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 __init__(self, topic): super(LoadBalancerAgentApi, self).__init__( topic, default_version=self.BASE_RPC_API_VERSION) self.db = loadbalancer_db.LoadBalancerPluginDb() self.nws_driver = importutils.import_object(nwservice_driver) self.listen_conn = rpc.create_connection(new=True)