Placement client: do not swallow exceptions

Placement client unconditionally swallowed many exceptions. I cannot
tell why that was ever considered a good idea. I can imagine some
users wanting to ignore some of those error conditions, but it should
be the responsibility of the user to decide. The client should not
unconditionally ignore all errors, but leave this choice for the user
of the client.

Particularly this placement client will be used by later patches for
minimum-bandwidth-allocation-placement-api where we do want to know
about some of these errors and retry placement operations when they
fail.

Change-Id: Ia14ba8cb273166fe3075328229f30d0cebae0480
Related-Bug: #1578989
This commit is contained in:
Bence Romsics 2018-11-21 17:07:55 +01:00
parent 74600f1d9c
commit 5227491b8a
1 changed files with 3 additions and 16 deletions

View File

@ -43,22 +43,9 @@ def _check_placement_api_available(f):
"""
@functools.wraps(f)
def wrapper(self, *a, **k):
try:
if not self._client:
self._client = self._create_client()
return f(self, *a, **k)
except ks_exc.EndpointNotFound:
LOG.warning('Please enable the placement service.')
except ks_exc.MissingAuthPlugin:
LOG.warning('No authentication information found for placement '
'API. Please enable the placement service.')
except ks_exc.Unauthorized:
LOG.warning('Placement service credentials do not work. '
'Please enable the placement service.')
except ks_exc.DiscoveryFailure:
LOG.warning('Discovering suitable URL for placement API failed.')
except ks_exc.ConnectFailure:
LOG.warning('Placement API service is not responding.')
if not self._client:
self._client = self._create_client()
return f(self, *a, **k)
return wrapper