-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make get_allocations_for_resource_provider raise
In preparation for reshaper work, and because it's The Right Thing To Do, this patch makes the report client's get_allocations_for_resource_provider method stop acting like something didn't go wrong when its placement API request fails. We remove the @safe_connect decorator so it raises (a subclass of) ksa's ClientException when something goes wrong with the API communication. And the method now raises a new ResourceProviderAllocationRetrievalFailed exception on non-200. In the spirit of the aggregate and trait retrieval methods, it now returns a namedtuple containing the allocation information. Unit tests, which were entirely absent, are added for the method. The resource tracker's _remove_deleted_instances_allocations, which is get_allocations_for_resource_provider's only consumer (for now, until reshaper work starts using it) is refactored to behave the same way it used to, which is to no-op if the placement API request fails. However, a) we take an earlier short-circuit out of the method, which saves a little work copying context stuff; and b) we now emit a warning log message if the no-op is due to the newly-raised exceptions. Change-Id: I020e7dc47efc79f8907b7bfb753ec779a8da69a1
- Loading branch information
Eric Fried
committed
Aug 23, 2018
1 parent
d13e5a5
commit f534495
Showing
5 changed files
with
115 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters