Read instances from API cell for cells v1
Recent work on cells v2 has us reading instances from compute cells via target_cell, but that breaks the existing behavior of cells v1 because of the syncing between API cell and compute cells. When state changes are effected in the API cell, there is a slight delay before they are reflected in the compute cell. So, reading from the compute cell instead of the API cell results in behavior changes. This adds a conditional in compute/api get_all to read instances from the API cell if cells v1 is enabled. We are already doing this for compute/api get, and get_all was missed. Closes-Bug: #1660747 Change-Id: I7df5c4616ef386216c7bd7efea2be68173c61be0
This commit is contained in:
parent
91b4a56bc5
commit
826df45a40
@ -2451,10 +2451,21 @@ class API(base.Base):
|
||||
# instance lists should be proxied to project Searchlight, or a similar
|
||||
# alternative.
|
||||
if limit is None or limit > 0:
|
||||
if not CONF.cells.enable:
|
||||
cell_instances = self._get_instances_by_filters_all_cells(
|
||||
context, filters,
|
||||
limit=limit, marker=marker, expected_attrs=expected_attrs,
|
||||
sort_keys=sort_keys, sort_dirs=sort_dirs)
|
||||
limit=limit, marker=marker,
|
||||
expected_attrs=expected_attrs, sort_keys=sort_keys,
|
||||
sort_dirs=sort_dirs)
|
||||
else:
|
||||
# NOTE(melwitt): If we're on cells v1, we need to read
|
||||
# instances from the top-level database because reading from
|
||||
# cells results in changed behavior, because of the syncing.
|
||||
# We can remove this path once we stop supporting cells v1.
|
||||
cell_instances = self._get_instances_by_filters(
|
||||
context, filters, limit=limit, marker=marker,
|
||||
expected_attrs=expected_attrs, sort_keys=sort_keys,
|
||||
sort_dirs=sort_dirs)
|
||||
else:
|
||||
LOG.debug('Limit excludes any results from real cells')
|
||||
cell_instances = objects.InstanceList(objects=[])
|
||||
|
@ -4533,6 +4533,7 @@ class _ComputeAPIUnitTestMixIn(object):
|
||||
limit=10, marker='fake-marker', sort_keys=['baz'],
|
||||
sort_dirs=['desc'])
|
||||
|
||||
if self.cell_type is None:
|
||||
for cm in mock_cm_get_all.return_value:
|
||||
mock_target_cell.assert_any_call(self.context, cm)
|
||||
inst_get_calls = [mock.call(self.context, {'foo': 'bar'},
|
||||
@ -4588,6 +4589,7 @@ class _ComputeAPIUnitTestMixIn(object):
|
||||
limit=10, marker='fake-marker', sort_keys=['baz'],
|
||||
sort_dirs=['desc'])
|
||||
|
||||
if self.cell_type is None:
|
||||
for cm in mock_cm_get_all.return_value:
|
||||
mock_target_cell.assert_any_call(self.context, cm)
|
||||
inst_get_calls = [mock.call(self.context, {'foo': 'bar'},
|
||||
@ -4644,6 +4646,7 @@ class _ComputeAPIUnitTestMixIn(object):
|
||||
limit=10, marker=marker, sort_keys=['baz'],
|
||||
sort_dirs=['desc'])
|
||||
|
||||
if self.cell_type is None:
|
||||
for cm in mock_cm_get_all.return_value:
|
||||
mock_target_cell.assert_any_call(self.context, cm)
|
||||
inst_get_calls = [mock.call(self.context, {'foo': 'bar'},
|
||||
|
Loading…
Reference in New Issue
Block a user