Add a request_timeout to neutron

Neutron's pre-commit processing can take some time
and even exceed 30 seconds in CI. Lets make it 45 and
have an explicit timeout passed for the request handling
to be setup with the python-neutronclient initialization.

Change-Id: I9947656c959af2128e7dbf30ba6b38cc2af35dae
Story: 2005371
Task: 30347
This commit is contained in:
Julia Kreger 2019-04-04 09:39:07 -07:00
parent d2d08c06a8
commit 56bec518b6
4 changed files with 23 additions and 3 deletions

View File

@ -87,7 +87,8 @@ def get_client(token=None, context=None):
auth=user_auth or service_auth,
endpoint_override=endpoint,
retries=CONF.neutron.retries,
global_request_id=context.global_id)
global_request_id=context.global_id,
timeout=CONF.neutron.request_timeout)
def unbind_neutron_port(port_id, client=None, context=None):

View File

@ -108,6 +108,15 @@ opts = [
'"neutron" network interface and not used for the '
'"flat" or "noop" network interfaces. If not '
'specified, the default security group is used.')),
cfg.IntOpt('request_timeout',
default=45,
help=_('Timeout for request processing when interacting '
'with Neutron. This value should be increased if '
'neutron port action timeouts are observed as neutron '
'performs pre-commit validation prior returning to '
'the API client which can take longer than normal '
'client/server interactions.')),
]

View File

@ -66,7 +66,8 @@ class TestNeutronClient(base.TestCase):
session=mock.sentinel.session,
auth=auth, retries=2,
endpoint_override=url,
global_request_id='global')
global_request_id='global',
timeout=45)
@mock.patch('ironic.common.context.RequestContext', autospec=True)
def test_get_neutron_client_with_token(self, mock_ctxt, mock_client_init,
@ -84,7 +85,8 @@ class TestNeutronClient(base.TestCase):
auth=mock.sentinel.sauth,
retries=2,
endpoint_override='neutron_url',
global_request_id=ctxt.global_id)
global_request_id=ctxt.global_id,
timeout=45)
# testing handling of default url_timeout
mock_session.assert_called_once_with('neutron', timeout=10)

View File

@ -0,0 +1,8 @@
---
fixes:
- |
Fixes an issue that can occur in CI and in physical deployments where the
Networking Service performs a pre-flight operation which can exceed
the prior default for ``30`` seconds. The new default is ``45`` seconds,
and operators can tune the setting via the ``[neutron]request_timeout``
setting.