diff options
author | Jenkins <jenkins@review.openstack.org> | 2016-09-16 03:51:55 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2016-09-16 03:51:56 +0000 |
commit | d4b35152c0ac2f3f2b4d158c83dba249d6d2ff0c (patch) | |
tree | e5a3ae5c3472285f56427cf16320afcc45b80cc0 | |
parent | ca9860ebbe895b8eb71d92204d7afe8a27f1faf5 (diff) | |
parent | 30a85c8bcfb9ba7a66364df7eb1dc3dfc61341ab (diff) | |
download | nova-d4b35152c0ac2f3f2b4d158c83dba249d6d2ff0c.tar.gz |
Merge "Fix object assumption in remove_deleted_instances()"14.0.0.0rc1
-rw-r--r-- | nova/scheduler/client/report.py | 2 | ||||
-rw-r--r-- | nova/tests/unit/scheduler/client/test_report.py | 7 |
2 files changed, 7 insertions, 2 deletions
diff --git a/nova/scheduler/client/report.py b/nova/scheduler/client/report.py index 7b0f70edfa..fa5041e664 100644 --- a/nova/scheduler/client/report.py +++ b/nova/scheduler/client/report.py @@ -442,7 +442,7 @@ class SchedulerReportClient(object): if allocations is None: allocations = {} - instance_dict = {instance.uuid: instance + instance_dict = {instance['uuid']: instance for instance in instance_uuids} removed_instances = set(allocations.keys()) - set(instance_dict.keys()) diff --git a/nova/tests/unit/scheduler/client/test_report.py b/nova/tests/unit/scheduler/client/test_report.py index 085351f49a..8209007964 100644 --- a/nova/tests/unit/scheduler/client/test_report.py +++ b/nova/tests/unit/scheduler/client/test_report.py @@ -769,9 +769,14 @@ class SchedulerReportClientTestCase(test.NoDBTestCase): 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 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( '/resource_providers/%s/allocations' % cn.uuid) expected_calls = [ |