diff --git a/ironic/common/neutron.py b/ironic/common/neutron.py index f667e7bfba..b2834c90c4 100644 --- a/ironic/common/neutron.py +++ b/ironic/common/neutron.py @@ -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): diff --git a/ironic/conf/neutron.py b/ironic/conf/neutron.py index 567625543b..d2d7f41fb2 100644 --- a/ironic/conf/neutron.py +++ b/ironic/conf/neutron.py @@ -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.')), + ] diff --git a/ironic/tests/unit/common/test_neutron.py b/ironic/tests/unit/common/test_neutron.py index b4464edc19..1813659280 100644 --- a/ironic/tests/unit/common/test_neutron.py +++ b/ironic/tests/unit/common/test_neutron.py @@ -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) diff --git a/releasenotes/notes/add-neutron-request-timeout-1f7372af81f14ddd.yaml b/releasenotes/notes/add-neutron-request-timeout-1f7372af81f14ddd.yaml new file mode 100644 index 0000000000..eca1df044c --- /dev/null +++ b/releasenotes/notes/add-neutron-request-timeout-1f7372af81f14ddd.yaml @@ -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.