Merge "NSXv3: Fix rpc code"
This commit is contained in:
commit
b661e41110
@ -93,6 +93,8 @@ class NsxV3Plugin(addr_pair_db.AllowedAddressPairsMixin,
|
|||||||
"quotas",
|
"quotas",
|
||||||
"binding",
|
"binding",
|
||||||
"extra_dhcp_opt",
|
"extra_dhcp_opt",
|
||||||
|
"agent",
|
||||||
|
"dhcp_agent_scheduler",
|
||||||
"ext-gw-mode",
|
"ext-gw-mode",
|
||||||
"security-group",
|
"security-group",
|
||||||
"port-security",
|
"port-security",
|
||||||
@ -112,7 +114,8 @@ class NsxV3Plugin(addr_pair_db.AllowedAddressPairsMixin,
|
|||||||
pbin.CAP_PORT_FILTER:
|
pbin.CAP_PORT_FILTER:
|
||||||
'security-group' in self.supported_extension_aliases}}
|
'security-group' in self.supported_extension_aliases}}
|
||||||
self.tier0_groups_dict = {}
|
self.tier0_groups_dict = {}
|
||||||
self._setup_rpc()
|
self._setup_dhcp()
|
||||||
|
self._start_rpc_notifiers()
|
||||||
self._nsx_client = nsx_client.NSX3Client()
|
self._nsx_client = nsx_client.NSX3Client()
|
||||||
self._port_client = nsx_resources.LogicalPort(self._nsx_client)
|
self._port_client = nsx_resources.LogicalPort(self._nsx_client)
|
||||||
self.nsgroup_container, self.default_section = (
|
self.nsgroup_container, self.default_section = (
|
||||||
@ -168,23 +171,32 @@ class NsxV3Plugin(addr_pair_db.AllowedAddressPairsMixin,
|
|||||||
return self._get_port_security_profile()
|
return self._get_port_security_profile()
|
||||||
|
|
||||||
def _setup_rpc(self):
|
def _setup_rpc(self):
|
||||||
self.topic = topics.PLUGIN
|
|
||||||
self.conn = n_rpc.create_connection(new=True)
|
|
||||||
self.endpoints = [dhcp_rpc.DhcpRpcCallback(),
|
self.endpoints = [dhcp_rpc.DhcpRpcCallback(),
|
||||||
agents_db.AgentExtRpcCallback(),
|
agents_db.AgentExtRpcCallback(),
|
||||||
metadata_rpc.MetadataRpcCallback()]
|
metadata_rpc.MetadataRpcCallback()]
|
||||||
|
|
||||||
|
def _setup_dhcp(self):
|
||||||
|
"""Initialize components to support DHCP."""
|
||||||
|
self.network_scheduler = importutils.import_object(
|
||||||
|
cfg.CONF.network_scheduler_driver
|
||||||
|
)
|
||||||
|
self.start_periodic_dhcp_agent_status_check()
|
||||||
|
|
||||||
|
def _start_rpc_notifiers(self):
|
||||||
|
"""Initialize RPC notifiers for agents."""
|
||||||
|
self.agent_notifiers[const.AGENT_TYPE_DHCP] = (
|
||||||
|
dhcp_rpc_agent_api.DhcpAgentNotifyAPI()
|
||||||
|
)
|
||||||
|
|
||||||
|
def start_rpc_listeners(self):
|
||||||
|
self._setup_rpc()
|
||||||
|
self.topic = topics.PLUGIN
|
||||||
|
self.conn = n_rpc.create_connection(new=True)
|
||||||
self.conn.create_consumer(self.topic, self.endpoints, fanout=False)
|
self.conn.create_consumer(self.topic, self.endpoints, fanout=False)
|
||||||
self.conn.create_consumer(topics.REPORTS,
|
self.conn.create_consumer(topics.REPORTS,
|
||||||
[agents_db.AgentExtRpcCallback()],
|
[agents_db.AgentExtRpcCallback()],
|
||||||
fanout=False)
|
fanout=False)
|
||||||
self.agent_notifiers[const.AGENT_TYPE_DHCP] = (
|
return self.conn.consume_in_threads()
|
||||||
dhcp_rpc_agent_api.DhcpAgentNotifyAPI())
|
|
||||||
self.conn.consume_in_threads()
|
|
||||||
self.network_scheduler = importutils.import_object(
|
|
||||||
cfg.CONF.network_scheduler_driver
|
|
||||||
)
|
|
||||||
self.supported_extension_aliases.extend(
|
|
||||||
['agent', 'dhcp_agent_scheduler'])
|
|
||||||
|
|
||||||
def _validate_provider_create(self, context, network_data):
|
def _validate_provider_create(self, context, network_data):
|
||||||
physical_net = network_data.get(pnet.PHYSICAL_NETWORK)
|
physical_net = network_data.get(pnet.PHYSICAL_NETWORK)
|
||||||
|
Loading…
Reference in New Issue
Block a user