Move hash ring initialization to init_host() for ironic
The hash ring initialization code requires calling to conductor over
RPC. Nova's service startup initializes the manager and the virt
driver, then goes into a polling loop waiting for a conductor to
respond to make sure it is ready. Finally, it calls init_host()
once things are expected to be working. That is where we should
do our initialization that requires conductor to be up.
This patch moves the initial refresh into the Ironic driver's
init_host() routine.
Change-Id: If92f4b1df061f91ffffa7900532a978649efb933
Closes-Bug: #1713095
(cherry picked from commit 361287debf
)
This commit is contained in:
parent
a98a52d85e
commit
e53115da7f
@ -2659,7 +2659,9 @@ class HashRingTestCase(test.NoDBTestCase):
|
|||||||
|
|
||||||
@mock.patch.object(ironic_driver.IronicDriver, '_refresh_hash_ring')
|
@mock.patch.object(ironic_driver.IronicDriver, '_refresh_hash_ring')
|
||||||
def test_hash_ring_refreshed_on_init(self, mock_hr):
|
def test_hash_ring_refreshed_on_init(self, mock_hr):
|
||||||
ironic_driver.IronicDriver(None)
|
d = ironic_driver.IronicDriver(None)
|
||||||
|
self.assertFalse(mock_hr.called)
|
||||||
|
d.init_host('foo')
|
||||||
mock_hr.assert_called_once_with(mock.ANY)
|
mock_hr.assert_called_once_with(mock.ANY)
|
||||||
|
|
||||||
@mock.patch.object(hash_ring, 'HashRing')
|
@mock.patch.object(hash_ring, 'HashRing')
|
||||||
@ -2718,6 +2720,7 @@ class NodeCacheTestCase(test.NoDBTestCase):
|
|||||||
super(NodeCacheTestCase, self).setUp()
|
super(NodeCacheTestCase, self).setUp()
|
||||||
|
|
||||||
self.driver = ironic_driver.IronicDriver(None)
|
self.driver = ironic_driver.IronicDriver(None)
|
||||||
|
self.driver.init_host('foo')
|
||||||
self.driver.virtapi = fake.FakeVirtAPI()
|
self.driver.virtapi = fake.FakeVirtAPI()
|
||||||
self.ctx = nova_context.get_admin_context()
|
self.ctx = nova_context.get_admin_context()
|
||||||
|
|
||||||
|
@ -152,7 +152,6 @@ class IronicDriver(virt_driver.ComputeDriver):
|
|||||||
self.node_cache = {}
|
self.node_cache = {}
|
||||||
self.node_cache_time = 0
|
self.node_cache_time = 0
|
||||||
self.servicegroup_api = servicegroup.API()
|
self.servicegroup_api = servicegroup.API()
|
||||||
self._refresh_hash_ring(nova_context.get_admin_context())
|
|
||||||
|
|
||||||
self.ironicclient = client_wrapper.IronicClientWrapper()
|
self.ironicclient = client_wrapper.IronicClientWrapper()
|
||||||
|
|
||||||
@ -508,7 +507,7 @@ class IronicDriver(virt_driver.ComputeDriver):
|
|||||||
:param host: the hostname of the compute host.
|
:param host: the hostname of the compute host.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return
|
self._refresh_hash_ring(nova_context.get_admin_context())
|
||||||
|
|
||||||
def _pike_flavor_migration(self, node_uuids):
|
def _pike_flavor_migration(self, node_uuids):
|
||||||
"""This code is needed in Pike to prevent problems where an operator
|
"""This code is needed in Pike to prevent problems where an operator
|
||||||
|
Loading…
Reference in New Issue
Block a user