Merge "Fix IronicHostManager to skip get_by_host() call."

This commit is contained in:
Jenkins 2015-08-29 19:44:43 +00:00 committed by Gerrit Code Review
commit 5099bd5d1a
2 changed files with 12 additions and 3 deletions

View File

@ -106,3 +106,11 @@ class IronicHostManager(host_manager.HostManager):
return IronicNodeState(host, node, **kwargs)
else:
return host_manager.HostState(host, node, **kwargs)
def _init_instance_info(self):
"""Ironic hosts should not pass instance info."""
pass
def _add_instance_info(self, context, compute, host_state):
"""Ironic hosts should not pass instance info."""
host_state.instances = {}

View File

@ -64,7 +64,8 @@ class IronicHostManagerTestCase(test.NoDBTestCase):
"dummy")
)
def test_get_all_host_states(self):
@mock.patch.object(nova.objects.InstanceList, 'get_by_host')
def test_get_all_host_states(self, mock_gbh):
# Ensure .service is set and we have the values we expect to.
context = 'fake_context'
@ -76,8 +77,8 @@ class IronicHostManagerTestCase(test.NoDBTestCase):
ironic_fakes.COMPUTE_NODES)
self.mox.ReplayAll()
with mock.patch.object(nova.objects.InstanceList, 'get_by_host'):
self.host_manager.get_all_host_states(context)
self.host_manager.get_all_host_states(context)
self.assertEqual(0, mock_gbh.call_count)
host_states_map = self.host_manager.host_state_map
self.assertEqual(len(host_states_map), 4)