Merge "Allow configuration of neutronclient retries"
This commit is contained in:
commit
892e382c21
@ -1071,6 +1071,10 @@
|
||||
# value)
|
||||
#url_timeout=30
|
||||
|
||||
# Client retries in the case of a failed request. (integer
|
||||
# value)
|
||||
#retries=3
|
||||
|
||||
# Default authentication strategy to use when connecting to
|
||||
# neutron. Can be either "keystone" or "noauth". Running
|
||||
# neutron in noauth mode (related to but not affected by this
|
||||
|
@ -39,6 +39,9 @@ neutron_opts = [
|
||||
cfg.IntOpt('url_timeout',
|
||||
default=30,
|
||||
help='Timeout value for connecting to neutron in seconds.'),
|
||||
cfg.IntOpt('retries',
|
||||
default=3,
|
||||
help='Client retries in the case of a failed request.'),
|
||||
cfg.StrOpt('auth_strategy',
|
||||
default='keystone',
|
||||
help='Default authentication strategy to use when connecting '
|
||||
@ -58,6 +61,7 @@ def _build_client(token=None):
|
||||
"""Utility function to create Neutron client."""
|
||||
params = {
|
||||
'timeout': CONF.neutron.url_timeout,
|
||||
'retries': CONF.neutron.retries,
|
||||
'insecure': CONF.keystone_authtoken.insecure,
|
||||
'ca_cert': CONF.keystone_authtoken.certfile,
|
||||
}
|
||||
|
@ -39,6 +39,7 @@ class TestNeutron(db_base.DbTestCase):
|
||||
group='dhcp')
|
||||
self.config(url='test-url',
|
||||
url_timeout=30,
|
||||
retries=2,
|
||||
group='neutron')
|
||||
self.config(insecure=False,
|
||||
certfile='test-file',
|
||||
@ -61,6 +62,7 @@ class TestNeutron(db_base.DbTestCase):
|
||||
def test__build_client_with_token(self, mock_client_init):
|
||||
token = 'test-token-123'
|
||||
expected = {'timeout': 30,
|
||||
'retries': 2,
|
||||
'insecure': False,
|
||||
'ca_cert': 'test-file',
|
||||
'token': token,
|
||||
@ -74,6 +76,7 @@ class TestNeutron(db_base.DbTestCase):
|
||||
@mock.patch.object(client.Client, "__init__")
|
||||
def test__build_client_without_token(self, mock_client_init):
|
||||
expected = {'timeout': 30,
|
||||
'retries': 2,
|
||||
'insecure': False,
|
||||
'ca_cert': 'test-file',
|
||||
'endpoint_url': 'test-url',
|
||||
@ -93,6 +96,7 @@ class TestNeutron(db_base.DbTestCase):
|
||||
'insecure': False,
|
||||
'endpoint_url': 'test-url',
|
||||
'timeout': 30,
|
||||
'retries': 2,
|
||||
'auth_strategy': 'noauth'}
|
||||
|
||||
mock_client_init.return_value = None
|
||||
|
Loading…
x
Reference in New Issue
Block a user