Merge "Stop introspection if set boot device failed"
This commit is contained in:
commit
ef0bc413ae
|
@ -106,15 +106,15 @@ def _background_introspect_locked(node_info, ironic):
|
||||||
ironic.node.set_boot_device(node_info.uuid, 'pxe',
|
ironic.node.set_boot_device(node_info.uuid, 'pxe',
|
||||||
persistent=False)
|
persistent=False)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
LOG.warning('Failed to set boot device to PXE: %s',
|
raise utils.Error(_('Failed to set boot device to PXE: %s') % exc,
|
||||||
exc, node_info=node_info)
|
node_info=node_info)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
ironic.node.set_power_state(node_info.uuid, 'reboot')
|
ironic.node.set_power_state(node_info.uuid, 'reboot')
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
raise utils.Error(_('Failed to power on the node, check it\'s '
|
raise utils.Error(_('Failed to power on the node, check it\'s '
|
||||||
'power management configuration: %s'),
|
'power management configuration: %s') % exc,
|
||||||
exc, node_info=node_info)
|
node_info=node_info)
|
||||||
LOG.info('Introspection started successfully',
|
LOG.info('Introspection started successfully',
|
||||||
node_info=node_info)
|
node_info=node_info)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -122,7 +122,6 @@ class TestIntrospect(BaseTest):
|
||||||
|
|
||||||
def test_power_failure(self, client_mock, start_mock):
|
def test_power_failure(self, client_mock, start_mock):
|
||||||
cli = self._prepare(client_mock)
|
cli = self._prepare(client_mock)
|
||||||
cli.node.set_boot_device.side_effect = exceptions.BadRequest()
|
|
||||||
cli.node.set_power_state.side_effect = exceptions.BadRequest()
|
cli.node.set_power_state.side_effect = exceptions.BadRequest()
|
||||||
start_mock.return_value = self.node_info
|
start_mock.return_value = self.node_info
|
||||||
|
|
||||||
|
@ -163,6 +162,28 @@ class TestIntrospect(BaseTest):
|
||||||
self.node_info.acquire_lock.assert_called_once_with()
|
self.node_info.acquire_lock.assert_called_once_with()
|
||||||
self.node_info.release_lock.assert_called_once_with()
|
self.node_info.release_lock.assert_called_once_with()
|
||||||
|
|
||||||
|
def test_set_boot_device_failure(self, client_mock, start_mock):
|
||||||
|
cli = self._prepare(client_mock)
|
||||||
|
cli.node.set_boot_device.side_effect = exceptions.BadRequest()
|
||||||
|
start_mock.return_value = self.node_info
|
||||||
|
|
||||||
|
introspect.introspect(self.node.uuid)
|
||||||
|
|
||||||
|
cli.node.get.assert_called_once_with(self.uuid)
|
||||||
|
|
||||||
|
start_mock.assert_called_once_with(self.uuid,
|
||||||
|
bmc_address=self.bmc_address,
|
||||||
|
manage_boot=True,
|
||||||
|
ironic=cli)
|
||||||
|
cli.node.set_boot_device.assert_called_once_with(self.uuid,
|
||||||
|
'pxe',
|
||||||
|
persistent=False)
|
||||||
|
cli.node.set_power_state.assert_not_called()
|
||||||
|
start_mock.return_value.finished.assert_called_once_with(
|
||||||
|
introspect.istate.Events.error, error=mock.ANY)
|
||||||
|
self.node_info.acquire_lock.assert_called_once_with()
|
||||||
|
self.node_info.release_lock.assert_called_once_with()
|
||||||
|
|
||||||
def test_no_macs(self, client_mock, start_mock):
|
def test_no_macs(self, client_mock, start_mock):
|
||||||
cli = self._prepare(client_mock)
|
cli = self._prepare(client_mock)
|
||||||
self.node_info.ports.return_value = []
|
self.node_info.ports.return_value = []
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
Stops introspection when setting boot device is failed, as the node is
|
||||||
|
not guarenteed to perform a PXE boot in this case.
|
Loading…
Reference in New Issue