From: Eugene Nikanorov Date: Tue, 22 Sep 2015 14:51:56 +0000 (+0400) Subject: Use separate queue for agent state reports. X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=7267d75fdd3f90af759d71e9490cd41d41ba6d98;p=openstack-build%2Fneutron-build.git Use separate queue for agent state reports. This optimization is needed for big clusters with hundreds of agents where the spike of activity may trigger a burst of RPC requests that would prevent neutron-server from processing agent heart beats in time, triggering resource rescheduling. This will be further optimized by running dedicated RPC workers for state reports processing. Related-Bug: #1496410 Change-Id: Id86a1f962aaa4f64011d57ae55d240f890cca4f7 --- diff --git a/neutron/agent/dhcp/agent.py b/neutron/agent/dhcp/agent.py index af0ccf5c7..4e4da5036 100644 --- a/neutron/agent/dhcp/agent.py +++ b/neutron/agent/dhcp/agent.py @@ -544,7 +544,7 @@ class NetworkCache(object): class DhcpAgentWithStateReport(DhcpAgent): def __init__(self, host=None, conf=None): super(DhcpAgentWithStateReport, self).__init__(host=host, conf=conf) - self.state_rpc = agent_rpc.PluginReportStateAPI(topics.PLUGIN) + self.state_rpc = agent_rpc.PluginReportStateAPI(topics.REPORTS) self.agent_state = { 'binary': 'neutron-dhcp-agent', 'host': host, diff --git a/neutron/agent/l3/agent.py b/neutron/agent/l3/agent.py index 3c698fa09..6f2b90772 100644 --- a/neutron/agent/l3/agent.py +++ b/neutron/agent/l3/agent.py @@ -611,7 +611,7 @@ class L3NATAgentWithStateReport(L3NATAgent): def __init__(self, host, conf=None): self.use_call = True super(L3NATAgentWithStateReport, self).__init__(host=host, conf=conf) - self.state_rpc = agent_rpc.PluginReportStateAPI(topics.PLUGIN) + self.state_rpc = agent_rpc.PluginReportStateAPI(topics.REPORTS) self.agent_state = { 'binary': 'neutron-l3-agent', 'host': host, diff --git a/neutron/agent/metadata/agent.py b/neutron/agent/metadata/agent.py index c458c6d04..b2ef3a30e 100644 --- a/neutron/agent/metadata/agent.py +++ b/neutron/agent/metadata/agent.py @@ -287,7 +287,7 @@ class UnixDomainMetadataProxy(object): def _init_state_reporting(self): self.context = context.get_admin_context_without_session() - self.state_rpc = agent_rpc.PluginReportStateAPI(topics.PLUGIN) + self.state_rpc = agent_rpc.PluginReportStateAPI(topics.REPORTS) self.agent_state = { 'binary': 'neutron-metadata-agent', 'host': cfg.CONF.host, diff --git a/neutron/common/topics.py b/neutron/common/topics.py index d0cc55a57..b8993aa8f 100644 --- a/neutron/common/topics.py +++ b/neutron/common/topics.py @@ -28,6 +28,7 @@ UPDATE = 'update' AGENT = 'q-agent-notifier' PLUGIN = 'q-plugin' L3PLUGIN = 'q-l3-plugin' +REPORTS = 'q-reports-plugin' DHCP = 'q-dhcp-notifer' FIREWALL_PLUGIN = 'q-firewall-plugin' METERING_PLUGIN = 'q-metering-plugin' diff --git a/neutron/plugins/hyperv/agent/l2_agent.py b/neutron/plugins/hyperv/agent/l2_agent.py index 956e1ec38..5a23c1c55 100644 --- a/neutron/plugins/hyperv/agent/l2_agent.py +++ b/neutron/plugins/hyperv/agent/l2_agent.py @@ -100,7 +100,7 @@ class HyperVNeutronAgent(hyperv_neutron_agent.HyperVNeutronAgentMixin): self.plugin_rpc = agent_rpc.PluginApi(topics.PLUGIN) self.sg_plugin_rpc = sg_rpc.SecurityGroupServerRpcApi(topics.PLUGIN) - self.state_rpc = agent_rpc.PluginReportStateAPI(topics.PLUGIN) + self.state_rpc = agent_rpc.PluginReportStateAPI(topics.REPORTS) # RPC network init self.context = context.get_admin_context_without_session() diff --git a/neutron/plugins/ml2/drivers/linuxbridge/agent/linuxbridge_neutron_agent.py b/neutron/plugins/ml2/drivers/linuxbridge/agent/linuxbridge_neutron_agent.py index 5c0949840..54c767ebd 100644 --- a/neutron/plugins/ml2/drivers/linuxbridge/agent/linuxbridge_neutron_agent.py +++ b/neutron/plugins/ml2/drivers/linuxbridge/agent/linuxbridge_neutron_agent.py @@ -910,7 +910,7 @@ class LinuxBridgeNeutronAgentRPC(service.Service): LOG.info(_LI("RPC agent_id: %s"), self.agent_id) self.topic = topics.AGENT - self.state_rpc = agent_rpc.PluginReportStateAPI(topics.PLUGIN) + self.state_rpc = agent_rpc.PluginReportStateAPI(topics.REPORTS) # RPC network init # Handle updates from service self.endpoints = [LinuxBridgeRpcCallbacks(self.context, self, diff --git a/neutron/plugins/ml2/drivers/mech_sriov/agent/sriov_nic_agent.py b/neutron/plugins/ml2/drivers/mech_sriov/agent/sriov_nic_agent.py index 9b1c3116f..1918b4950 100644 --- a/neutron/plugins/ml2/drivers/mech_sriov/agent/sriov_nic_agent.py +++ b/neutron/plugins/ml2/drivers/mech_sriov/agent/sriov_nic_agent.py @@ -119,7 +119,7 @@ class SriovNicSwitchAgent(object): LOG.info(_LI("RPC agent_id: %s"), self.agent_id) self.topic = topics.AGENT - self.state_rpc = agent_rpc.PluginReportStateAPI(topics.PLUGIN) + self.state_rpc = agent_rpc.PluginReportStateAPI(topics.REPORTS) # RPC network init # Handle updates from service self.endpoints = [SriovNicSwitchRpcCallbacks(self.context, self, diff --git a/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py b/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py index b18716e86..0d02ce4ce 100644 --- a/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py +++ b/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py @@ -366,7 +366,7 @@ class OVSNeutronAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin, self.plugin_rpc = OVSPluginApi(topics.PLUGIN) self.sg_plugin_rpc = sg_rpc.SecurityGroupServerRpcApi(topics.PLUGIN) self.dvr_plugin_rpc = dvr_rpc.DVRServerRpcApi(topics.PLUGIN) - self.state_rpc = agent_rpc.PluginReportStateAPI(topics.PLUGIN) + self.state_rpc = agent_rpc.PluginReportStateAPI(topics.REPORTS) # RPC network init self.context = context.get_admin_context_without_session() diff --git a/neutron/plugins/ml2/plugin.py b/neutron/plugins/ml2/plugin.py index a8a406b05..d6f98f26c 100644 --- a/neutron/plugins/ml2/plugin.py +++ b/neutron/plugins/ml2/plugin.py @@ -188,6 +188,9 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2, 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(topics.REPORTS, + [agents_db.AgentExtRpcCallback()], + fanout=False) return self.conn.consume_in_threads() def _filter_nets_provider(self, context, networks, filters): diff --git a/neutron/services/metering/agents/metering_agent.py b/neutron/services/metering/agents/metering_agent.py index 10ead2b37..930515c1a 100644 --- a/neutron/services/metering/agents/metering_agent.py +++ b/neutron/services/metering/agents/metering_agent.py @@ -248,7 +248,7 @@ class MeteringAgentWithStateReport(MeteringAgent): def __init__(self, host, conf=None): super(MeteringAgentWithStateReport, self).__init__(host=host, conf=conf) - self.state_rpc = agent_rpc.PluginReportStateAPI(topics.PLUGIN) + self.state_rpc = agent_rpc.PluginReportStateAPI(topics.REPORTS) self.agent_state = { 'binary': 'neutron-metering-agent', 'host': host,