From 1221cf1b24484d61622f16937f1d3a08a5c2c27f Mon Sep 17 00:00:00 2001 From: Mitya_Eremeev Date: Tue, 27 Jul 2021 21:14:02 +0300 Subject: [PATCH] Agent RPC step size in config. Number of resources for neutron to divide the large RPC call data sets always equals 100. In "big" networks even these numbers can be still huge and cause service timeouts. Now we can decrease these numbers in config. Default value equals 20 now. Closes-Bug: 1938202 Change-Id: Idf545ad31398ded460b6c2ae1675dd5e9ae71440 --- neutron/agent/rpc.py | 3 +-- neutron/agent/securitygroups_rpc.py | 3 +-- neutron/conf/agent/database/agents_db.py | 7 +++++++ ...g-option-for-rpc-agent-step-size-dd9595875de2b885.yaml | 8 ++++++++ 4 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 releasenotes/notes/introduced-config-option-for-rpc-agent-step-size-dd9595875de2b885.yaml diff --git a/neutron/agent/rpc.py b/neutron/agent/rpc.py index a5e75a69b4b..33475d7f8c2 100644 --- a/neutron/agent/rpc.py +++ b/neutron/agent/rpc.py @@ -34,7 +34,6 @@ from oslo_utils import uuidutils from neutron.agent import resource_cache from neutron.api.rpc.callbacks import resources -from neutron.common import _constants as n_const from neutron import objects LOG = logging.getLogger(__name__) @@ -182,7 +181,7 @@ class PluginApi(object): ret_devices_down = [] failed_devices_down = [] - step = n_const.RPC_RES_PROCESSING_STEP + step = cfg.CONF.rpc_resources_processing_step devices_up = list(devices_up) devices_down = list(devices_down) for i in range(0, max(len(devices_up), len(devices_down)), step): diff --git a/neutron/agent/securitygroups_rpc.py b/neutron/agent/securitygroups_rpc.py index 3ada8599338..a65904c6e97 100644 --- a/neutron/agent/securitygroups_rpc.py +++ b/neutron/agent/securitygroups_rpc.py @@ -27,7 +27,6 @@ from oslo_config import cfg from oslo_log import log as logging from neutron.agent import firewall -from neutron.common import _constants as common_constants from neutron.conf.agent import securitygroups_rpc as sc_cfg @@ -155,7 +154,7 @@ class SecurityGroupAgentRpc(object): @_port_filter_lock def _apply_port_filter(self, device_ids, update_filter=False): - step = common_constants.AGENT_RES_PROCESSING_STEP + step = cfg.CONF.rpc_resources_processing_step devices = {} security_groups = {} security_group_member_ips = {} diff --git a/neutron/conf/agent/database/agents_db.py b/neutron/conf/agent/database/agents_db.py index 10abf434bfd..aad0582bf5a 100644 --- a/neutron/conf/agent/database/agents_db.py +++ b/neutron/conf/agent/database/agents_db.py @@ -13,6 +13,7 @@ from oslo_config import cfg from neutron._i18n import _ +from neutron.common import _constants AGENT_OPTS = [ cfg.IntOpt('agent_down_time', default=75, @@ -41,6 +42,12 @@ AGENT_OPTS = [ "enable_new_agents=False. In the case, user's " "resources will not be scheduled automatically to the " "agent until admin changes admin_state_up to True.")), + cfg.IntOpt("rpc_resources_processing_step", + default=_constants.RPC_RES_PROCESSING_STEP, min=1, + help=_("Number of resources for neutron to divide " + "the large RPC call data sets. It can be reduced " + "if RPC timeout occurred. The best value can be " + "determined empirically in your environment.")) ] diff --git a/releasenotes/notes/introduced-config-option-for-rpc-agent-step-size-dd9595875de2b885.yaml b/releasenotes/notes/introduced-config-option-for-rpc-agent-step-size-dd9595875de2b885.yaml new file mode 100644 index 00000000000..b4f55dbedcb --- /dev/null +++ b/releasenotes/notes/introduced-config-option-for-rpc-agent-step-size-dd9595875de2b885.yaml @@ -0,0 +1,8 @@ +--- +fixes: + - | + Introduced config option for RPC agent step size customization: + rpc_resources_processing_step - Number of resources for neutron to divide + the large RPC call data sets. It can be reduced if RPC timeout occurred. + Default value equals 20. The best value can be determined empirically in + your environment.