summaryrefslogtreecommitdiff
path: root/nova/scheduler
diff options
context:
space:
mode:
authorBalazs Gibizer <balazs.gibizer@est.tech>2019-10-04 13:54:03 +0200
committerBalazs Gibizer <balazs.gibizer@est.tech>2019-10-08 12:43:12 +0200
commit15c71ccf8eae7b1a02fc72beed7c72663c0ac549 (patch)
tree271eb0047db43cff98f0dd61af71443b871a8652 /nova/scheduler
parentbf37bec80baa527ac013dfaa7480ef2761ed2cb9 (diff)
downloadnova-15c71ccf8eae7b1a02fc72beed7c72663c0ac549.tar.gz
Remove @safe_connect from put_allocations
The only user of put_allocations of the report client is heal_allocations. It is easy to remove the @safe_connect decorator from put_allocations as heal_allocations already handles PlacementAPIConnectFailure exception. This patch changes heal_allocations to raise PlacementAPIConnectFailure instead of relying on @safe_connect. Change-Id: I6b3f61525883a019703cf564e693516b3b61febc
Diffstat (limited to 'nova/scheduler')
-rw-r--r--nova/scheduler/client/report.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/nova/scheduler/client/report.py b/nova/scheduler/client/report.py
index 98eb8164db..f9660da565 100644
--- a/nova/scheduler/client/report.py
+++ b/nova/scheduler/client/report.py
@@ -1913,8 +1913,6 @@ class SchedulerReportClient(object):
'text': r.text})
return r.status_code == 204
- # TODO(gibi): kill safe_connect
- @safe_connect
@retries
def put_allocations(self, context, consumer_uuid, payload):
"""Creates allocation records for the supplied consumer UUID based on
@@ -1926,12 +1924,18 @@ class SchedulerReportClient(object):
PUT /allocations/{consumer_uuid} API
:returns: True if the allocations were created, False otherwise.
:raises: Retry if the operation should be retried due to a concurrent
- resource provider update.
+ resource provider update.
:raises: AllocationUpdateFailed if placement returns a consumer
- generation conflict
+ generation conflict
+ :raises: PlacementAPIConnectFailure on failure to communicate with the
+ placement API
"""
- r = self._put_allocations(context, consumer_uuid, payload)
+ try:
+ r = self._put_allocations(context, consumer_uuid, payload)
+ except ks_exc.ClientException:
+ raise exception.PlacementAPIConnectFailure()
+
if r.status_code != 204:
err = r.json()['errors'][0]
# NOTE(jaypipes): Yes, it sucks doing string comparison like this