NSX-v3 HTTP retries conf property
This patch adds a new conf property to the nsx.ini under the nsx_v3 group called http_retries. This value is used for the max retries used on HTTP requests. Additionally this patch clarifies the use of http_retries vs retries in the conf properties. A unit test is also included. backport: liberty Change-Id: Ifb0d1aaa6a11163f6520a6472ef743e3eab3ce38 Closes-Bug: #1540885
This commit is contained in:
parent
1e1df3bdcb
commit
111415d06e
@ -341,7 +341,7 @@
|
|||||||
# Default Edge Cluster Identifier
|
# Default Edge Cluster Identifier
|
||||||
# default_edge_cluster_uuid = afc40f8a-4967-477e-a17a-9d560d1786c7
|
# default_edge_cluster_uuid = afc40f8a-4967-477e-a17a-9d560d1786c7
|
||||||
|
|
||||||
# Maximum number of times to retry API requests
|
# Maximum number of times to retry API requests upon stale revision errors.
|
||||||
# retries = 10
|
# retries = 10
|
||||||
|
|
||||||
# Specify a CA bundle file to use in verifying the NSX Manager
|
# Specify a CA bundle file to use in verifying the NSX Manager
|
||||||
@ -361,6 +361,9 @@
|
|||||||
# The time in seconds before aborting a HTTP read response from a NSX manager.
|
# The time in seconds before aborting a HTTP read response from a NSX manager.
|
||||||
# http_read_timeout = 180
|
# http_read_timeout = 180
|
||||||
|
|
||||||
|
# Maximum number of times to retry a HTTP connection.
|
||||||
|
# http_retries = 3
|
||||||
|
|
||||||
# Maxiumum number of connection connections to each NSX manager.
|
# Maxiumum number of connection connections to each NSX manager.
|
||||||
# concurrent_connections = 10
|
# concurrent_connections = 10
|
||||||
|
|
||||||
|
@ -203,7 +203,8 @@ nsx_v3_opts = [
|
|||||||
"gateway service plugin.")),
|
"gateway service plugin.")),
|
||||||
cfg.IntOpt('retries',
|
cfg.IntOpt('retries',
|
||||||
default=10,
|
default=10,
|
||||||
help=_('Maximum number of times to retry API request')),
|
help=_('Maximum number of times to retry API requests upon '
|
||||||
|
'stale revision errors.')),
|
||||||
cfg.StrOpt('ca_file',
|
cfg.StrOpt('ca_file',
|
||||||
help=_('Specify a CA bundle file to use in verifying the NSX '
|
help=_('Specify a CA bundle file to use in verifying the NSX '
|
||||||
'Manager server certificate. This option is ignored if '
|
'Manager server certificate. This option is ignored if '
|
||||||
@ -224,6 +225,9 @@ nsx_v3_opts = [
|
|||||||
default=180,
|
default=180,
|
||||||
help=_('The time in seconds before aborting a HTTP read '
|
help=_('The time in seconds before aborting a HTTP read '
|
||||||
'response from a NSX manager.')),
|
'response from a NSX manager.')),
|
||||||
|
cfg.IntOpt('http_retries',
|
||||||
|
default=3,
|
||||||
|
help=_('Maximum number of times to retry a HTTP connection.')),
|
||||||
cfg.IntOpt('concurrent_connections', default=10,
|
cfg.IntOpt('concurrent_connections', default=10,
|
||||||
help=_("Maximum concurrent connections to each NSX "
|
help=_("Maximum concurrent connections to each NSX "
|
||||||
"manager.")),
|
"manager.")),
|
||||||
|
@ -437,7 +437,7 @@ class NSXClusteredAPI(ClusteredAPI):
|
|||||||
http_provider=None):
|
http_provider=None):
|
||||||
self.username = username or cfg.CONF.nsx_v3.nsx_api_user
|
self.username = username or cfg.CONF.nsx_v3.nsx_api_user
|
||||||
self.password = password or cfg.CONF.nsx_v3.nsx_api_password
|
self.password = password or cfg.CONF.nsx_v3.nsx_api_password
|
||||||
self.retries = retries or cfg.CONF.nsx_v3.retries
|
self.retries = retries or cfg.CONF.nsx_v3.http_retries
|
||||||
self.insecure = insecure or cfg.CONF.nsx_v3.insecure
|
self.insecure = insecure or cfg.CONF.nsx_v3.insecure
|
||||||
self.ca_file = ca_file or cfg.CONF.nsx_v3.ca_file
|
self.ca_file = ca_file or cfg.CONF.nsx_v3.ca_file
|
||||||
self.conns_per_pool = (concurrent_connections or
|
self.conns_per_pool = (concurrent_connections or
|
||||||
|
@ -111,6 +111,15 @@ class NsxV3ClusteredAPITestCase(nsxlib_testcase.NsxClientTestCase):
|
|||||||
self._assert_providers(
|
self._assert_providers(
|
||||||
api, [(urlparse.urlparse(p).netloc, p) for p in conf_managers])
|
api, [(urlparse.urlparse(p).netloc, p) for p in conf_managers])
|
||||||
|
|
||||||
|
def test_http_retries(self):
|
||||||
|
cfg.CONF.set_override(
|
||||||
|
'http_retries', 9, 'nsx_v3')
|
||||||
|
|
||||||
|
api = self.mock_nsx_clustered_api()
|
||||||
|
with api.endpoints['1.2.3.4'].pool.item() as session:
|
||||||
|
self.assertEqual(
|
||||||
|
session.adapters['https://'].max_retries.total, 9)
|
||||||
|
|
||||||
def test_conns_per_pool(self):
|
def test_conns_per_pool(self):
|
||||||
cfg.CONF.set_override(
|
cfg.CONF.set_override(
|
||||||
'concurrent_connections', 11, 'nsx_v3')
|
'concurrent_connections', 11, 'nsx_v3')
|
||||||
|
Loading…
Reference in New Issue
Block a user