diff --git a/neutron/agent/rpc.py b/neutron/agent/rpc.py index ad635dfd994..b8e6b27d58e 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.