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:
Boden R 2016-02-02 05:59:05 -07:00
parent 1e1df3bdcb
commit 111415d06e
4 changed files with 19 additions and 3 deletions

View File

@ -341,7 +341,7 @@
# Default Edge Cluster Identifier
# 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
# 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.
# 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.
# concurrent_connections = 10

View File

@ -203,7 +203,8 @@ nsx_v3_opts = [
"gateway service plugin.")),
cfg.IntOpt('retries',
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',
help=_('Specify a CA bundle file to use in verifying the NSX '
'Manager server certificate. This option is ignored if '
@ -224,6 +225,9 @@ nsx_v3_opts = [
default=180,
help=_('The time in seconds before aborting a HTTP read '
'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,
help=_("Maximum concurrent connections to each NSX "
"manager.")),

View File

@ -437,7 +437,7 @@ class NSXClusteredAPI(ClusteredAPI):
http_provider=None):
self.username = username or cfg.CONF.nsx_v3.nsx_api_user
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.ca_file = ca_file or cfg.CONF.nsx_v3.ca_file
self.conns_per_pool = (concurrent_connections or

View File

@ -111,6 +111,15 @@ class NsxV3ClusteredAPITestCase(nsxlib_testcase.NsxClientTestCase):
self._assert_providers(
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):
cfg.CONF.set_override(
'concurrent_connections', 11, 'nsx_v3')