diff --git a/nova/scheduler/host_manager.py b/nova/scheduler/host_manager.py index 4a9a372523d6..aab4b90ac53f 100644 --- a/nova/scheduler/host_manager.py +++ b/nova/scheduler/host_manager.py @@ -750,7 +750,13 @@ class HostManager(object): 'instance info for this host.', host_name) return {} with context_module.target_cell(context, hm.cell_mapping) as cctxt: - inst_list = objects.InstanceList.get_by_host(cctxt, host_name) + # NOTE(mriedem): We pass expected_attrs=[] to avoid a default + # join on info_cache and security_groups, which at present none + # of the in-tree filters/weighers rely on that information. Any + # out of tree filters which rely on it will end up lazy-loading + # the field but we don't have a contract on out of tree filters. + inst_list = objects.InstanceList.get_by_host( + cctxt, host_name, expected_attrs=[]) return {inst.uuid: inst for inst in inst_list} def _get_instance_info(self, context, compute): diff --git a/nova/tests/unit/scheduler/test_host_manager.py b/nova/tests/unit/scheduler/test_host_manager.py index cec47588f779..bfddb0ce6ec4 100644 --- a/nova/tests/unit/scheduler/test_host_manager.py +++ b/nova/tests/unit/scheduler/test_host_manager.py @@ -750,7 +750,8 @@ class HostManagerTestCase(test.NoDBTestCase): mock_get_by_host.return_value = objects.InstanceList(objects=[inst1]) host_state.update( inst_dict=hm._get_instance_info(context, cn1)) - mock_get_by_host.assert_called_once_with(context, cn1.host) + mock_get_by_host.assert_called_once_with( + context, cn1.host, expected_attrs=[]) self.assertTrue(host_state.instances) self.assertEqual(host_state.instances[uuids.instance], inst1)