Fix fast track following managed inspection
The managed inspection does not provide ipa-api-url and the ramdisk cannot heartbeat, thus requiring a reboot. This change fixes it. Change-Id: I7bb190c82fa3f166902884d1ea0da485cc743a65
This commit is contained in:
parent
0b0fd64282
commit
f9eb43d1c0
@ -33,6 +33,7 @@ from ironic.conductor import task_manager
|
|||||||
from ironic.conductor import utils as cond_utils
|
from ironic.conductor import utils as cond_utils
|
||||||
from ironic.conf import CONF
|
from ironic.conf import CONF
|
||||||
from ironic.drivers import base
|
from ironic.drivers import base
|
||||||
|
from ironic.drivers.modules import deploy_utils
|
||||||
|
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
@ -194,6 +195,8 @@ def _start_managed_inspection(task):
|
|||||||
endpoint = _get_callback_endpoint(client)
|
endpoint = _get_callback_endpoint(client)
|
||||||
params = dict(_parse_kernel_params(),
|
params = dict(_parse_kernel_params(),
|
||||||
**{'ipa-inspection-callback-url': endpoint})
|
**{'ipa-inspection-callback-url': endpoint})
|
||||||
|
if CONF.deploy.fast_track:
|
||||||
|
params['ipa-api-url'] = deploy_utils.get_ironic_api_url()
|
||||||
|
|
||||||
cond_utils.node_power_action(task, states.POWER_OFF)
|
cond_utils.node_power_action(task, states.POWER_OFF)
|
||||||
with cond_utils.power_state_for_network_configuration(task):
|
with cond_utils.power_state_for_network_configuration(task):
|
||||||
|
@ -228,6 +228,39 @@ class InspectHardwareTestCase(BaseTestCase):
|
|||||||
self.assertFalse(self.driver.network.remove_inspection_network.called)
|
self.assertFalse(self.driver.network.remove_inspection_network.called)
|
||||||
self.assertFalse(self.driver.boot.clean_up_ramdisk.called)
|
self.assertFalse(self.driver.boot.clean_up_ramdisk.called)
|
||||||
|
|
||||||
|
@mock.patch('ironic.drivers.modules.deploy_utils.get_ironic_api_url',
|
||||||
|
autospec=True)
|
||||||
|
def test_managed_fast_track(self, mock_ironic_url, mock_client):
|
||||||
|
CONF.set_override('fast_track', True, group='deploy')
|
||||||
|
CONF.set_override('extra_kernel_params',
|
||||||
|
'ipa-inspection-collectors=default,logs '
|
||||||
|
'ipa-collect-dhcp=1',
|
||||||
|
group='inspector')
|
||||||
|
endpoint = 'http://192.169.0.42:5050/v1'
|
||||||
|
mock_ironic_url.return_value = 'http://192.169.0.42:6385'
|
||||||
|
mock_client.return_value.get_endpoint.return_value = endpoint
|
||||||
|
mock_introspect = mock_client.return_value.start_introspection
|
||||||
|
self.iface.validate(self.task)
|
||||||
|
self.assertEqual(states.INSPECTWAIT,
|
||||||
|
self.iface.inspect_hardware(self.task))
|
||||||
|
mock_introspect.assert_called_once_with(self.node.uuid,
|
||||||
|
manage_boot=False)
|
||||||
|
self.driver.boot.prepare_ramdisk.assert_called_once_with(
|
||||||
|
self.task, ramdisk_params={
|
||||||
|
'ipa-inspection-callback-url': endpoint + '/continue',
|
||||||
|
'ipa-inspection-collectors': 'default,logs',
|
||||||
|
'ipa-collect-dhcp': '1',
|
||||||
|
'ipa-api-url': 'http://192.169.0.42:6385',
|
||||||
|
})
|
||||||
|
self.driver.network.add_inspection_network.assert_called_once_with(
|
||||||
|
self.task)
|
||||||
|
self.driver.power.set_power_state.assert_has_calls([
|
||||||
|
mock.call(self.task, states.POWER_OFF, timeout=None),
|
||||||
|
mock.call(self.task, states.POWER_ON, timeout=None),
|
||||||
|
])
|
||||||
|
self.assertFalse(self.driver.network.remove_inspection_network.called)
|
||||||
|
self.assertFalse(self.driver.boot.clean_up_ramdisk.called)
|
||||||
|
|
||||||
@mock.patch.object(task_manager, 'acquire', autospec=True)
|
@mock.patch.object(task_manager, 'acquire', autospec=True)
|
||||||
def test_managed_error(self, mock_acquire, mock_client):
|
def test_managed_error(self, mock_acquire, mock_client):
|
||||||
endpoint = 'http://192.169.0.42:5050/v1'
|
endpoint = 'http://192.169.0.42:5050/v1'
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
Fixes fast track deployment preceeded by managed inspection by providing
|
||||||
|
the ironic API URL to the ramdisk so that it can heartbeat.
|
Loading…
x
Reference in New Issue
Block a user