Merge "Fix object assumption in remove_deleted_instances()"
This commit is contained in:
commit
d4b35152c0
@ -442,7 +442,7 @@ class SchedulerReportClient(object):
|
|||||||
if allocations is None:
|
if allocations is None:
|
||||||
allocations = {}
|
allocations = {}
|
||||||
|
|
||||||
instance_dict = {instance.uuid: instance
|
instance_dict = {instance['uuid']: instance
|
||||||
for instance in instance_uuids}
|
for instance in instance_uuids}
|
||||||
removed_instances = set(allocations.keys()) - set(instance_dict.keys())
|
removed_instances = set(allocations.keys()) - set(instance_dict.keys())
|
||||||
|
|
||||||
|
@ -769,9 +769,14 @@ class SchedulerReportClientTestCase(test.NoDBTestCase):
|
|||||||
inst2.uuid: fake_allocations,
|
inst2.uuid: fake_allocations,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# One instance still on the node, dict form as the
|
||||||
|
# RT tracks it
|
||||||
|
inst3 = {'uuid': 'foo'}
|
||||||
|
|
||||||
mock_delete.return_value = True
|
mock_delete.return_value = True
|
||||||
with mock.patch.object(self.client, '_allocations'):
|
with mock.patch.object(self.client, '_allocations'):
|
||||||
self.client.remove_deleted_instances(cn, [])
|
self.client.remove_deleted_instances(cn, [inst3])
|
||||||
mock_get.assert_called_once_with(
|
mock_get.assert_called_once_with(
|
||||||
'/resource_providers/%s/allocations' % cn.uuid)
|
'/resource_providers/%s/allocations' % cn.uuid)
|
||||||
expected_calls = [
|
expected_calls = [
|
||||||
|
Loading…
Reference in New Issue
Block a user