diff --git a/etc/nsx.ini b/etc/nsx.ini index 05046f28c2..4911d78587 100644 --- a/etc/nsx.ini +++ b/etc/nsx.ini @@ -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 diff --git a/vmware_nsx/common/config.py b/vmware_nsx/common/config.py index 97fc0d020c..66c0e9b95f 100644 --- a/vmware_nsx/common/config.py +++ b/vmware_nsx/common/config.py @@ -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.")), diff --git a/vmware_nsx/nsxlib/v3/cluster.py b/vmware_nsx/nsxlib/v3/cluster.py index 9ab709dbf0..6ebf59c238 100644 --- a/vmware_nsx/nsxlib/v3/cluster.py +++ b/vmware_nsx/nsxlib/v3/cluster.py @@ -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 diff --git a/vmware_nsx/tests/unit/nsxlib/v3/test_cluster.py b/vmware_nsx/tests/unit/nsxlib/v3/test_cluster.py index 1dc150ca3a..1669f000ba 100644 --- a/vmware_nsx/tests/unit/nsxlib/v3/test_cluster.py +++ b/vmware_nsx/tests/unit/nsxlib/v3/test_cluster.py @@ -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')