summaryrefslogtreecommitdiff
path: root/nova/objects/build_request.py
diff options
context:
space:
mode:
authorMatt Riedemann <mriedem.os@gmail.com>2017-12-12 21:27:28 -0500
committerMatt Riedemann <mriedem.os@gmail.com>2018-01-04 10:02:08 -0500
commit808d36475103e373f1deb3344b6829ce68d6cdd5 (patch)
tree3cefb51179ed3ea6634d7d02ac93ecad59839ff1 /nova/objects/build_request.py
parent506e4f5fce02c743e149c051e0d2924291aa51aa (diff)
downloadnova-stable/newton.tar.gz
Raise MarkerNotFound if BuildRequestList.get_by_filters doesn't find markernewton-eol14.1.0stable/newton
For some reason, probably because build requests are meant to be short lived and we don't get a lot of bugs about paging misbehavior, when paging instances with a marker, we didn't raise MarkerNotFound if we didn't find the marker in the list of build requests. Doing so would match what we do when paging over cells and listing instances using a marker. Once we find the marker, be that in build_requests, or one of the cells, we need to set the marker to None to stop looking for it elsewhere if we have more space to fill our limit. For example, see change I8a957bebfcecd6ac712103c346e028d80f1ecd7c. This patch fixes the issue by raising MarkerNotFound from BuildRequestList get_by_filters if there is a marker and we didn't find a build request for it. The compute API get_all() method handles that as normal and continues looking for the marker in one of the cells. Change-Id: I1aa3ca6cc70cef65d24dec1e7db9491c9b73f7ab Closes-Bug: #1737856 (cherry picked from commit 1706e3989157f912bce99beb99c75216a064eb2d) (cherry picked from commit 344029b94ad7ff4667403a851d33c3ddb4e97b4b) (cherry picked from commit b00b2fe9be4394e7c9cf73c168d435a2333d12f6)
Diffstat (limited to 'nova/objects/build_request.py')
-rw-r--r--nova/objects/build_request.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/nova/objects/build_request.py b/nova/objects/build_request.py
index e0f2c6a81a..9404e1ba1c 100644
--- a/nova/objects/build_request.py
+++ b/nova/objects/build_request.py
@@ -370,7 +370,8 @@ class BuildRequestList(base.ObjectListBase, base.NovaObject):
filtered_build_reqs.append(build_req)
- if (len(filtered_build_reqs) < 2) or (not sort_keys):
+ if (((len(filtered_build_reqs) < 2) or (not sort_keys))
+ and not marker):
# No need to sort
return cls(context, objects=filtered_build_reqs)
@@ -383,6 +384,8 @@ class BuildRequestList(base.ObjectListBase, base.NovaObject):
if build_req.instance.uuid == marker:
marker_index = i
break
+ else:
+ raise exception.MarkerNotFound(marker=marker)
len_build_reqs = len(sorted_build_reqs)
limit_index = len_build_reqs
if limit: