diff --git a/neutron/conf/common.py b/neutron/conf/common.py index a1a46570148..a557bc37c1b 100644 --- a/neutron/conf/common.py +++ b/neutron/conf/common.py @@ -125,7 +125,15 @@ core_opts = [ 'this value without modification. For overlay networks ' 'such as VXLAN, neutron automatically subtracts the ' 'overlay protocol overhead from this value. Defaults ' - 'to 1500, the standard value for Ethernet.')) + 'to 1500, the standard value for Ethernet.')), + cfg.IntOpt('http_retries', default=3, min=0, + help=_("Number of times client connections (nova, ironic) " + "should be retried on a failed HTTP call. 0 (zero) means" + "connection is attempted only once (not retried). " + "Setting to any positive integer means that on failure " + "the connection is retried that many times. " + "For example, setting to 3 means total attempts to " + "connect will be 4.")) ] core_cli_opts = [ diff --git a/neutron/notifiers/nova.py b/neutron/notifiers/nova.py index 29d00ae0752..622ed5d8020 100644 --- a/neutron/notifiers/nova.py +++ b/neutron/notifiers/nova.py @@ -70,6 +70,7 @@ class Notifier(object): session=session, region_name=cfg.CONF.nova.region_name, endpoint_type=cfg.CONF.nova.endpoint_type, + connect_retries=cfg.CONF.http_retries, extensions=extensions) self.batch_notifier = batch_notifier.BatchNotifier( cfg.CONF.send_events_interval, self.send_events) diff --git a/neutron/tests/unit/notifiers/test_nova.py b/neutron/tests/unit/notifiers/test_nova.py index a82d065c74d..463aed62864 100644 --- a/neutron/tests/unit/notifiers/test_nova.py +++ b/neutron/tests/unit/notifiers/test_nova.py @@ -334,6 +334,7 @@ class TestNovaNotify(base.BaseTestCase): nova.Notifier() mock_client.assert_called_once_with( api_versions.APIVersion(nova.NOVA_API_VERSION), + connect_retries=3, session=mock.ANY, region_name=cfg.CONF.nova.region_name, endpoint_type='public', @@ -344,6 +345,7 @@ class TestNovaNotify(base.BaseTestCase): nova.Notifier() mock_client.assert_called_once_with( api_versions.APIVersion(nova.NOVA_API_VERSION), + connect_retries=3, session=mock.ANY, region_name=cfg.CONF.nova.region_name, endpoint_type='internal', diff --git a/releasenotes/notes/Add-http_retries-config-option-b81dd29c03ba8c6a.yaml b/releasenotes/notes/Add-http_retries-config-option-b81dd29c03ba8c6a.yaml new file mode 100644 index 00000000000..5a2ecc5b174 --- /dev/null +++ b/releasenotes/notes/Add-http_retries-config-option-b81dd29c03ba8c6a.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + A new configuration option ``http_retries`` was added. This option allows + configuring the number of times the nova or ironic client should retry on + a failed HTTP call.