Browse Source

Merge "Use connect_retries when creating clients" into stable/stein

stable/stein
Zuul 2 weeks ago
parent
commit
05bb446637

+ 2
- 0
heat/engine/clients/os/aodh.py View File

@@ -13,6 +13,7 @@
13 13
 
14 14
 from aodhclient import client as ac
15 15
 from aodhclient import exceptions
16
+from oslo_config import cfg
16 17
 
17 18
 from heat.engine.clients import client_plugin
18 19
 
@@ -37,6 +38,7 @@ class AodhClientPlugin(client_plugin.ClientPlugin):
37 38
             session=self.context.keystone_session,
38 39
             interface=interface,
39 40
             service_type=self.ALARMING,
41
+            connect_retries=cfg.CONF.client_retry_limit,
40 42
             region_name=self._get_region_name())
41 43
 
42 44
     def is_not_found(self, ex):

+ 2
- 0
heat/engine/clients/os/barbican.py View File

@@ -14,6 +14,7 @@
14 14
 from barbicanclient import exceptions
15 15
 from barbicanclient.v1 import client as barbican_client
16 16
 from barbicanclient.v1 import containers
17
+from oslo_config import cfg
17 18
 from oslo_log import log as logging
18 19
 
19 20
 from heat.common import exception
@@ -35,6 +36,7 @@ class BarbicanClientPlugin(client_plugin.ClientPlugin):
35 36
             session=self.context.keystone_session,
36 37
             service_type=self.KEY_MANAGER,
37 38
             interface=interface,
39
+            connect_retries=cfg.CONF.client_retry_limit,
38 40
             region_name=self._get_region_name())
39 41
         return client
40 42
 

+ 2
- 0
heat/engine/clients/os/blazar.py View File

@@ -13,6 +13,7 @@
13 13
 
14 14
 from blazarclient import client as blazar_client
15 15
 from blazarclient import exception as client_exception
16
+from oslo_config import cfg
16 17
 
17 18
 from heat.engine.clients import client_plugin
18 19
 
@@ -30,6 +31,7 @@ class BlazarClientPlugin(client_plugin.ClientPlugin):
30 31
             'service_type': self.RESERVATION,
31 32
             'interface': interface,
32 33
             'region_name': self._get_region_name(),
34
+            'connect_retries': cfg.CONF.client_retry_limit
33 35
         }
34 36
 
35 37
         client = blazar_client.Client(**args)

+ 2
- 0
heat/engine/clients/os/cinder.py View File

@@ -14,6 +14,7 @@
14 14
 from cinderclient import client as cc
15 15
 from cinderclient import exceptions
16 16
 from keystoneauth1 import exceptions as ks_exceptions
17
+from oslo_config import cfg
17 18
 from oslo_log import log as logging
18 19
 
19 20
 from heat.common import exception
@@ -62,6 +63,7 @@ class CinderClientPlugin(client_plugin.ClientPlugin):
62 63
             'interface': self.interface,
63 64
             'service_type': self.service_type,
64 65
             'region_name': self._get_region_name(),
66
+            'connect_retries': cfg.CONF.client_retry_limit,
65 67
             'http_log_debug': self._get_client_option(CLIENT_NAME,
66 68
                                                       'http_log_debug')
67 69
         }

+ 2
- 0
heat/engine/clients/os/glance.py View File

@@ -11,6 +11,7 @@
11 11
 #    License for the specific language governing permissions and limitations
12 12
 #    under the License.
13 13
 
14
+from oslo_config import cfg
14 15
 from oslo_utils import uuidutils
15 16
 
16 17
 from glanceclient import client as gc
@@ -41,6 +42,7 @@ class GlanceClientPlugin(client_plugin.ClientPlugin):
41 42
         return gc.Client(version, session=con.keystone_session,
42 43
                          interface=interface,
43 44
                          service_type=self.IMAGE,
45
+                         connect_retries=cfg.CONF.client_retry_limit,
44 46
                          region_name=self._get_region_name())
45 47
 
46 48
     def _find_with_attr(self, entity, **kwargs):

+ 1
- 0
heat/engine/clients/os/heat_plugin.py View File

@@ -38,6 +38,7 @@ class HeatClientPlugin(client_plugin.ClientPlugin):
38 38
             args['username'] = self.context.username
39 39
             args['password'] = self.context.password
40 40
 
41
+        args['connect_retries'] = cfg.CONF.client_retry_limit
41 42
         return hc.Client('1', endpoint_override=endpoint,
42 43
                          session=self.context.keystone_session,
43 44
                          **args)

+ 2
- 0
heat/engine/clients/os/keystone/heat_keystoneclient.py View File

@@ -157,12 +157,14 @@ class KsClientWrapper(object):
157 157
             self._domain_admin_client = kc_v3.Client(
158 158
                 session=self.session,
159 159
                 auth=self.domain_admin_auth,
160
+                connect_retries=cfg.CONF.client_retry_limit,
160 161
                 region_name=self.auth_region_name)
161 162
 
162 163
         return self._domain_admin_client
163 164
 
164 165
     def _v3_client_init(self):
165 166
         client = kc_v3.Client(session=self.session,
167
+                              connect_retries=cfg.CONF.client_retry_limit,
166 168
                               region_name=self.auth_region_name)
167 169
 
168 170
         if hasattr(self.context.auth_plugin, 'get_access'):

+ 2
- 0
heat/engine/clients/os/magnum.py View File

@@ -13,6 +13,7 @@
13 13
 
14 14
 from magnumclient import exceptions as mc_exc
15 15
 from magnumclient.v1 import client as magnum_client
16
+from oslo_config import cfg
16 17
 
17 18
 from heat.common import exception
18 19
 from heat.engine.clients import client_plugin
@@ -31,6 +32,7 @@ class MagnumClientPlugin(client_plugin.ClientPlugin):
31 32
             'interface': interface,
32 33
             'service_type': self.CONTAINER,
33 34
             'session': self.context.keystone_session,
35
+            'connect_retries': cfg.CONF.client_retry_limit,
34 36
             'region_name': self._get_region_name()
35 37
         }
36 38
         client = magnum_client.Client(**args)

+ 2
- 0
heat/engine/clients/os/manila.py View File

@@ -16,6 +16,7 @@ from heat.engine.clients import client_plugin
16 16
 from heat.engine import constraints
17 17
 from manilaclient import client as manila_client
18 18
 from manilaclient import exceptions
19
+from oslo_config import cfg
19 20
 
20 21
 MANILACLIENT_VERSION = "2"
21 22
 CLIENT_NAME = 'manila'
@@ -33,6 +34,7 @@ class ManilaClientPlugin(client_plugin.ClientPlugin):
33 34
             'endpoint_type': endpoint_type,
34 35
             'service_type': self.SHARE,
35 36
             'session': self.context.keystone_session,
37
+            'connect_retries': cfg.CONF.client_retry_limit,
36 38
             'region_name': self._get_region_name()
37 39
         }
38 40
         client = manila_client.Client(MANILACLIENT_VERSION, **args)

+ 3
- 1
heat/engine/clients/os/neutron/__init__.py View File

@@ -14,6 +14,7 @@
14 14
 from neutronclient.common import exceptions
15 15
 from neutronclient.neutron import v2_0 as neutronV20
16 16
 from neutronclient.v2_0 import client as nc
17
+from oslo_config import cfg
17 18
 from oslo_utils import uuidutils
18 19
 
19 20
 from heat.common import exception
@@ -60,7 +61,8 @@ class NeutronClientPlugin(client_plugin.ClientPlugin):
60 61
             'session': con.keystone_session,
61 62
             'service_type': self.NETWORK,
62 63
             'interface': interface,
63
-            'region_name': self._get_region_name()
64
+            'region_name': self._get_region_name(),
65
+            'connect_retries': cfg.CONF.client_retry_limit
64 66
         }
65 67
 
66 68
         return nc.Client(**args)

+ 1
- 0
heat/engine/clients/os/nova.py View File

@@ -90,6 +90,7 @@ class NovaClientPlugin(microversion_mixin.MicroversionMixin,
90 90
             'endpoint_type': endpoint_type,
91 91
             'service_type': self.COMPUTE,
92 92
             'region_name': self._get_region_name(),
93
+            'connect_retries': cfg.CONF.client_retry_limit,
93 94
             'http_log_debug': self._get_client_option(CLIENT_NAME,
94 95
                                                       'http_log_debug')
95 96
             }

+ 2
- 0
heat/engine/clients/os/sahara.py View File

@@ -13,6 +13,7 @@
13 13
 # See the License for the specific language governing permissions and
14 14
 # limitations under the License.
15 15
 
16
+from oslo_config import cfg
16 17
 from saharaclient.api import base as sahara_base
17 18
 from saharaclient import client as sahara_client
18 19
 import six
@@ -38,6 +39,7 @@ class SaharaClientPlugin(client_plugin.ClientPlugin):
38 39
             'endpoint_type': endpoint_type,
39 40
             'service_type': self.DATA_PROCESSING,
40 41
             'session': con.keystone_session,
42
+            'connect_retries': cfg.CONF.client_retry_limit,
41 43
             'region_name': self._get_region_name()
42 44
         }
43 45
         client = sahara_client.Client('1.1', **args)

+ 2
- 0
heat/engine/clients/os/trove.py View File

@@ -11,6 +11,7 @@
11 11
 #    License for the specific language governing permissions and limitations
12 12
 #    under the License.
13 13
 
14
+from oslo_config import cfg
14 15
 from troveclient import client as tc
15 16
 from troveclient import exceptions
16 17
 
@@ -36,6 +37,7 @@ class TroveClientPlugin(client_plugin.ClientPlugin):
36 37
             'endpoint_type': endpoint_type,
37 38
             'service_type': self.DATABASE,
38 39
             'session': con.keystone_session,
40
+            'connect_retries': cfg.CONF.client_retry_limit,
39 41
             'region_name': self._get_region_name()
40 42
         }
41 43
 

+ 3
- 0
heat/tests/clients/test_heat_client.py View File

@@ -86,6 +86,7 @@ class KeystoneClientTest(common.HeatTestCase):
86 86
         self.m_client.assert_called_once_with(
87 87
             session=utils.AnyInstance(ks_session.Session),
88 88
             auth=self.mock_ks_auth,
89
+            connect_retries=2,
89 90
             region_name=None)
90 91
 
91 92
     def _stubs_auth(self, method='token', trust_scoped=True,
@@ -167,6 +168,7 @@ class KeystoneClientTest(common.HeatTestCase):
167 168
         if self.client:
168 169
             self.m_client.assert_any_call(
169 170
                 session=utils.AnyInstance(ks_session.Session),
171
+                connect_retries=2,
170 172
                 region_name=None)
171 173
         if self.stub_admin_auth:
172 174
             self.mock_admin_ks_auth.get_user_id.assert_called_once_with(
@@ -1456,6 +1458,7 @@ class KeystoneClientTestDomainName(KeystoneClientTest):
1456 1458
         self.m_client.assert_called_once_with(
1457 1459
             session=utils.AnyInstance(ks_session.Session),
1458 1460
             auth=self.mock_ks_auth,
1461
+            connect_retries=2,
1459 1462
             region_name=None)
1460 1463
 
1461 1464
     def _stub_domain_admin_client(self, domain_id='adomain123'):

Loading…
Cancel
Save