Browse Source

Merge "Fix listing deleted servers with a marker" into stable/rocky

changes/17/696217/1
Zuul 2 months ago
parent
commit
8800b90bdf
2 changed files with 8 additions and 8 deletions
  1. +7
    -5
      nova/objects/build_request.py
  2. +1
    -3
      nova/tests/functional/regressions/test_bug_1849409.py

+ 7
- 5
nova/objects/build_request.py View File

@@ -372,14 +372,16 @@ class BuildRequestList(base.ObjectListBase, base.NovaObject):
@base.remotable_classmethod
def get_by_filters(cls, context, filters, limit=None, marker=None,
sort_keys=None, sort_dirs=None):
if limit == 0:
return cls(context, objects=[])
# Short-circuit on anything that will not yield results.
# 'deleted' records can not be returned from here since build_requests
# are not soft deleted.
if filters.get('deleted', False):
return cls(context, objects=[])
# 'cleaned' records won't exist as they would need to be deleted.
if filters.get('cleaned', False):
if (limit == 0 or
filters.get('deleted', False) or
filters.get('cleaned', False)):
# If we have a marker honor the MarkerNotFound semantics.
if marker:
raise exception.MarkerNotFound(marker=marker)
return cls(context, objects=[])

# Because the build_requests table stores an instance as a serialized

+ 1
- 3
nova/tests/functional/regressions/test_bug_1849409.py View File

@@ -59,7 +59,5 @@ class ListDeletedServersWithMarker(test.TestCase,
servers = self.api.get_servers(detail=False,
search_opts={'deleted': True,
'marker': server['id']})
# FIXME(mriedem): This is bug 1849409 where the marker param is not
# honored correctly when using deleted=True.
server_names = [serv['name'] for serv in servers]
self.assertIn(server['name'], server_names)
self.assertNotIn(server['name'], server_names)

Loading…
Cancel
Save