Skip to content

Commit

Permalink
Merge "Fix resize revert to use non-legacy alloc handling"
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and openstack-gerrit committed Aug 8, 2018
2 parents e8a73c4 + 3311d57 commit c52c2ca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
5 changes: 2 additions & 3 deletions nova/compute/manager.py
Expand Up @@ -3949,9 +3949,8 @@ def _delete_allocation_after_move(self, context, instance, migration,
# made it past the check above), so we need to check to
# see if the source did migration-based allocation
# accounting
allocs = (
self.reportclient.get_allocations_for_consumer_by_provider(
context, cn_uuid, migration.uuid))
allocs = self.reportclient.get_allocations_for_consumer(
context, migration.uuid)
if allocs:
# NOTE(danms): The source did migration-based allocation
# accounting, so we should let the source node rejigger
Expand Down
8 changes: 3 additions & 5 deletions nova/tests/unit/compute/test_compute_mgr.py
Expand Up @@ -6960,8 +6960,8 @@ def test_delete_allocation_after_move_revert_by_migration(self, mock_rff):
@mock.patch.object(self.compute, '_get_resource_tracker')
@mock.patch.object(self.compute, 'reportclient')
def doit(new_rules, mock_report, mock_rt):
a = new_rules and {'allocations': 'fake'} or {}
ga = mock_report.get_allocations_for_consumer_by_provider
a = new_rules and {'fake'} or {}
ga = mock_report.get_allocations_for_consumer
ga.return_value = a
self.migration.source_node = 'src'
self.migration.dest_node = 'dst'
Expand All @@ -6972,9 +6972,7 @@ def doit(new_rules, mock_report, mock_rt):
mock.sentinel.flavor,
'dst')
self.assertFalse(mock_report.delete_allocation_for_instance.called)
cn_uuid = mock_rt().get_node_uuid.return_value
ga.assert_called_once_with(self.context, cn_uuid,
self.migration.uuid)
ga.assert_called_once_with(self.context, self.migration.uuid)

old = mock_report.remove_provider_from_instance_allocation
if new_rules:
Expand Down

0 comments on commit c52c2ca

Please sign in to comment.