summaryrefslogtreecommitdiff
path: root/nova/exception.py
diff options
context:
space:
mode:
authorChris Dent <cdent@anticdent.org>2018-07-26 12:00:14 +0100
committerChris Dent <cdent@anticdent.org>2018-08-03 14:41:15 +0100
commit66a47b7623035cff38a12fdace9a325bbfdd9a14 (patch)
tree3e05adc0d9c14c763aa21a3790fbcd4f2a63109c /nova/exception.py
parenta9c9285a5a68ab89a6543d143c364d90a01cd51c (diff)
downloadnova-66a47b7623035cff38a12fdace9a325bbfdd9a14.tar.gz
[placement] Retry allocation writes server side
This change adds a fast retry loop around AllocationList._set_allocations if a resource provider generation conflict happens. It turns out that under high concurrency of allocation claims being made on the same resource provider conflicts can be quite common and client side retries are insufficient. Because both consumer generation and resource provider generations had raised the same exception there was no way to distinguish between the two so a child of ConcurrentUpdateDetected has been created as ResourceProviderConcurrentUpdateDetected. In the future this will allow us to send different error codes to the client as well, but that change is not done here. When the conflict is detected, all the resource providers in the AllocationList are reloaded and the list objects refreshed. Logging is provided to indicate: * at debug that a retry is going to happen * at warning that all the retries failed and the client is going to see the conflict The tests for this are a bit funky: Some mocks are used to cause the conflicts, then the real actions after a couple of iterations. This was backported from 72e4c4c8d7fb146862b899337626485dad10f15b with conflicts because exceptions, tests and object files were moved to new locations with Rocky and the AllocationList.create_all method was renamed to the more accurate replace_all. Prior to Rocky there were no Consumer objects and fewer helper methods in functional tests, so the test is adjusted accordingly. Change-Id: Id614d609fc8f3ed2d2ff29a2b52143f53b3b1b9a Closes-Bug: #1719933 (cherry picked from commit 72e4c4c8d7fb146862b899337626485dad10f15b)
Diffstat (limited to 'nova/exception.py')
-rw-r--r--nova/exception.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/nova/exception.py b/nova/exception.py
index 01499a1f17..b60f4e0c0e 100644
--- a/nova/exception.py
+++ b/nova/exception.py
@@ -2122,6 +2122,11 @@ class ConcurrentUpdateDetected(NovaException):
"Please retry your update")
+class ResourceProviderConcurrentUpdateDetected(ConcurrentUpdateDetected):
+ msg_fmt = _("Another thread concurrently updated the resource provider "
+ "data. Please retry your update")
+
+
class ResourceClassNotFound(NotFound):
msg_fmt = _("No such resource class %(resource_class)s.")