diff options
author | Rabi Mishra <ramishra@redhat.com> | 2019-08-22 19:03:16 +0530 |
---|---|---|
committer | Rabi Mishra <ramishra@redhat.com> | 2019-08-23 09:25:35 +0530 |
commit | 364716725a4767f8d9e3e5e1c76ecf4f969a6613 (patch) | |
tree | 1ea73cd7aec3b210f7329f7515814596dd9357b3 | |
parent | f3efe1de2963218a881bb3c9bdd3bbcfc688db94 (diff) | |
download | heat-364716725a4767f8d9e3e5e1c76ecf4f969a6613.tar.gz |
Use connect_retries when creating clients
When creating session clients we should use 'connect_retries'
for clients that use Adapter interface. This will
allow retries when we get ConnectTimeout errors.
Task: 36331
Change-Id: Ic526c8039c91353e772eee7b55f1d263470c86bb
-rw-r--r-- | heat/engine/clients/os/aodh.py | 2 | ||||
-rw-r--r-- | heat/engine/clients/os/barbican.py | 2 | ||||
-rw-r--r-- | heat/engine/clients/os/blazar.py | 2 | ||||
-rw-r--r-- | heat/engine/clients/os/cinder.py | 2 | ||||
-rw-r--r-- | heat/engine/clients/os/glance.py | 2 | ||||
-rw-r--r-- | heat/engine/clients/os/heat_plugin.py | 1 | ||||
-rw-r--r-- | heat/engine/clients/os/keystone/heat_keystoneclient.py | 1 | ||||
-rw-r--r-- | heat/engine/clients/os/magnum.py | 2 | ||||
-rw-r--r-- | heat/engine/clients/os/manila.py | 2 | ||||
-rw-r--r-- | heat/engine/clients/os/neutron/__init__.py | 4 | ||||
-rw-r--r-- | heat/engine/clients/os/nova.py | 1 | ||||
-rw-r--r-- | heat/engine/clients/os/sahara.py | 2 | ||||
-rw-r--r-- | heat/engine/clients/os/trove.py | 2 | ||||
-rw-r--r-- | heat/tests/clients/test_heat_client.py | 1 |
14 files changed, 25 insertions, 1 deletions
diff --git a/heat/engine/clients/os/aodh.py b/heat/engine/clients/os/aodh.py index f734f8778..e8aab0957 100644 --- a/heat/engine/clients/os/aodh.py +++ b/heat/engine/clients/os/aodh.py @@ -13,6 +13,7 @@ from aodhclient import client as ac from aodhclient import exceptions +from oslo_config import cfg from heat.engine.clients import client_plugin @@ -37,6 +38,7 @@ class AodhClientPlugin(client_plugin.ClientPlugin): session=self.context.keystone_session, interface=interface, service_type=self.ALARMING, + connect_retries=cfg.CONF.client_retry_limit, region_name=self._get_region_name()) def is_not_found(self, ex): diff --git a/heat/engine/clients/os/barbican.py b/heat/engine/clients/os/barbican.py index 9e4b66e3b..0ddbe966f 100644 --- a/heat/engine/clients/os/barbican.py +++ b/heat/engine/clients/os/barbican.py @@ -14,6 +14,7 @@ from barbicanclient import exceptions from barbicanclient.v1 import client as barbican_client from barbicanclient.v1 import containers +from oslo_config import cfg from oslo_log import log as logging from heat.common import exception @@ -35,6 +36,7 @@ class BarbicanClientPlugin(client_plugin.ClientPlugin): session=self.context.keystone_session, service_type=self.KEY_MANAGER, interface=interface, + connect_retries=cfg.CONF.client_retry_limit, region_name=self._get_region_name()) return client diff --git a/heat/engine/clients/os/blazar.py b/heat/engine/clients/os/blazar.py index 099c6af5b..24429d442 100644 --- a/heat/engine/clients/os/blazar.py +++ b/heat/engine/clients/os/blazar.py @@ -13,6 +13,7 @@ from blazarclient import client as blazar_client from blazarclient import exception as client_exception +from oslo_config import cfg from heat.engine.clients import client_plugin @@ -30,6 +31,7 @@ class BlazarClientPlugin(client_plugin.ClientPlugin): 'service_type': self.RESERVATION, 'interface': interface, 'region_name': self._get_region_name(), + 'connect_retries': cfg.CONF.client_retry_limit } client = blazar_client.Client(**args) diff --git a/heat/engine/clients/os/cinder.py b/heat/engine/clients/os/cinder.py index 02903c9ce..caa9603bb 100644 --- a/heat/engine/clients/os/cinder.py +++ b/heat/engine/clients/os/cinder.py @@ -14,6 +14,7 @@ from cinderclient import client as cc from cinderclient import exceptions from keystoneauth1 import exceptions as ks_exceptions +from oslo_config import cfg from oslo_log import log as logging from heat.common import exception @@ -62,6 +63,7 @@ class CinderClientPlugin(client_plugin.ClientPlugin): 'interface': self.interface, 'service_type': self.service_type, 'region_name': self._get_region_name(), + 'connect_retries': cfg.CONF.client_retry_limit, 'http_log_debug': self._get_client_option(CLIENT_NAME, 'http_log_debug') } diff --git a/heat/engine/clients/os/glance.py b/heat/engine/clients/os/glance.py index 59970b4cc..caa306d4f 100644 --- a/heat/engine/clients/os/glance.py +++ b/heat/engine/clients/os/glance.py @@ -11,6 +11,7 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo_config import cfg from oslo_utils import uuidutils from glanceclient import client as gc @@ -41,6 +42,7 @@ class GlanceClientPlugin(client_plugin.ClientPlugin): return gc.Client(version, session=con.keystone_session, interface=interface, service_type=self.IMAGE, + connect_retries=cfg.CONF.client_retry_limit, region_name=self._get_region_name()) def _find_with_attr(self, entity, **kwargs): diff --git a/heat/engine/clients/os/heat_plugin.py b/heat/engine/clients/os/heat_plugin.py index fb5132893..76cdf990d 100644 --- a/heat/engine/clients/os/heat_plugin.py +++ b/heat/engine/clients/os/heat_plugin.py @@ -38,6 +38,7 @@ class HeatClientPlugin(client_plugin.ClientPlugin): args['username'] = self.context.username args['password'] = self.context.password + args['connect_retries'] = cfg.CONF.client_retry_limit return hc.Client('1', endpoint_override=endpoint, session=self.context.keystone_session, **args) diff --git a/heat/engine/clients/os/keystone/heat_keystoneclient.py b/heat/engine/clients/os/keystone/heat_keystoneclient.py index 494d48d6d..c35a1f058 100644 --- a/heat/engine/clients/os/keystone/heat_keystoneclient.py +++ b/heat/engine/clients/os/keystone/heat_keystoneclient.py @@ -163,6 +163,7 @@ class KsClientWrapper(object): def _v3_client_init(self): client = kc_v3.Client(session=self.session, + connect_retries=cfg.CONF.client_retry_limit, region_name=self.auth_region_name) if hasattr(self.context.auth_plugin, 'get_access'): diff --git a/heat/engine/clients/os/magnum.py b/heat/engine/clients/os/magnum.py index 216f4ece9..310b81c8d 100644 --- a/heat/engine/clients/os/magnum.py +++ b/heat/engine/clients/os/magnum.py @@ -13,6 +13,7 @@ from magnumclient import exceptions as mc_exc from magnumclient.v1 import client as magnum_client +from oslo_config import cfg from heat.common import exception from heat.engine.clients import client_plugin @@ -31,6 +32,7 @@ class MagnumClientPlugin(client_plugin.ClientPlugin): 'interface': interface, 'service_type': self.CONTAINER, 'session': self.context.keystone_session, + 'connect_retries': cfg.CONF.client_retry_limit, 'region_name': self._get_region_name() } client = magnum_client.Client(**args) diff --git a/heat/engine/clients/os/manila.py b/heat/engine/clients/os/manila.py index 15f612e63..f5adf1937 100644 --- a/heat/engine/clients/os/manila.py +++ b/heat/engine/clients/os/manila.py @@ -16,6 +16,7 @@ from heat.engine.clients import client_plugin from heat.engine import constraints from manilaclient import client as manila_client from manilaclient import exceptions +from oslo_config import cfg MANILACLIENT_VERSION = "2" CLIENT_NAME = 'manila' @@ -33,6 +34,7 @@ class ManilaClientPlugin(client_plugin.ClientPlugin): 'endpoint_type': endpoint_type, 'service_type': self.SHARE, 'session': self.context.keystone_session, + 'connect_retries': cfg.CONF.client_retry_limit, 'region_name': self._get_region_name() } client = manila_client.Client(MANILACLIENT_VERSION, **args) diff --git a/heat/engine/clients/os/neutron/__init__.py b/heat/engine/clients/os/neutron/__init__.py index 847552673..c520cce9f 100644 --- a/heat/engine/clients/os/neutron/__init__.py +++ b/heat/engine/clients/os/neutron/__init__.py @@ -14,6 +14,7 @@ from neutronclient.common import exceptions from neutronclient.neutron import v2_0 as neutronV20 from neutronclient.v2_0 import client as nc +from oslo_config import cfg from oslo_utils import uuidutils from heat.common import exception @@ -60,7 +61,8 @@ class NeutronClientPlugin(client_plugin.ClientPlugin): 'session': con.keystone_session, 'service_type': self.NETWORK, 'interface': interface, - 'region_name': self._get_region_name() + 'region_name': self._get_region_name(), + 'connect_retries': cfg.CONF.client_retry_limit } return nc.Client(**args) diff --git a/heat/engine/clients/os/nova.py b/heat/engine/clients/os/nova.py index d19fa19c3..b39eb0821 100644 --- a/heat/engine/clients/os/nova.py +++ b/heat/engine/clients/os/nova.py @@ -90,6 +90,7 @@ class NovaClientPlugin(microversion_mixin.MicroversionMixin, 'endpoint_type': endpoint_type, 'service_type': self.COMPUTE, 'region_name': self._get_region_name(), + 'connect_retries': cfg.CONF.client_retry_limit, 'http_log_debug': self._get_client_option(CLIENT_NAME, 'http_log_debug') } diff --git a/heat/engine/clients/os/sahara.py b/heat/engine/clients/os/sahara.py index 0718fc877..2627f6127 100644 --- a/heat/engine/clients/os/sahara.py +++ b/heat/engine/clients/os/sahara.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +from oslo_config import cfg from saharaclient.api import base as sahara_base from saharaclient import client as sahara_client import six @@ -38,6 +39,7 @@ class SaharaClientPlugin(client_plugin.ClientPlugin): 'endpoint_type': endpoint_type, 'service_type': self.DATA_PROCESSING, 'session': con.keystone_session, + 'connect_retries': cfg.CONF.client_retry_limit, 'region_name': self._get_region_name() } client = sahara_client.Client('1.1', **args) diff --git a/heat/engine/clients/os/trove.py b/heat/engine/clients/os/trove.py index c645300b7..14fbc2880 100644 --- a/heat/engine/clients/os/trove.py +++ b/heat/engine/clients/os/trove.py @@ -11,6 +11,7 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo_config import cfg from troveclient import client as tc from troveclient import exceptions @@ -36,6 +37,7 @@ class TroveClientPlugin(client_plugin.ClientPlugin): 'endpoint_type': endpoint_type, 'service_type': self.DATABASE, 'session': con.keystone_session, + 'connect_retries': cfg.CONF.client_retry_limit, 'region_name': self._get_region_name() } diff --git a/heat/tests/clients/test_heat_client.py b/heat/tests/clients/test_heat_client.py index aad2179ad..1c8265e07 100644 --- a/heat/tests/clients/test_heat_client.py +++ b/heat/tests/clients/test_heat_client.py @@ -167,6 +167,7 @@ class KeystoneClientTest(common.HeatTestCase): if self.client: self.m_client.assert_any_call( session=utils.AnyInstance(ks_session.Session), + connect_retries=2, region_name=None) if self.stub_admin_auth: self.mock_admin_ks_auth.get_user_id.assert_called_once_with( |