Merge "Catch unknown exceptions in validate driver ifaces"
This commit is contained in:
commit
a5a1a31761
@ -1467,6 +1467,18 @@ class ConductorManager(base_manager.BaseConductorManager):
|
|||||||
exception.UnsupportedDriverExtension) as e:
|
exception.UnsupportedDriverExtension) as e:
|
||||||
result = False
|
result = False
|
||||||
reason = str(e)
|
reason = str(e)
|
||||||
|
except Exception as e:
|
||||||
|
result = False
|
||||||
|
reason = (_('Unexpected exception, traceback saved '
|
||||||
|
'into log by ironic conductor service '
|
||||||
|
'that is running on %(host)s: %(error)s')
|
||||||
|
% {'host': self.host, 'error': e})
|
||||||
|
LOG.exception(_LE(
|
||||||
|
'Unexpected exception occurred while validating '
|
||||||
|
'%(iface)s driver interface for driver '
|
||||||
|
'%(driver)s: %(err)s on node %(node)s.'),
|
||||||
|
{'iface': iface_name, 'driver': task.node.driver,
|
||||||
|
'err': e, 'node': task.node.uuid})
|
||||||
else:
|
else:
|
||||||
reason = _('not supported')
|
reason = _('not supported')
|
||||||
|
|
||||||
|
@ -2614,6 +2614,24 @@ class MiscTestCase(mgr_utils.ServiceSetUpMixin, mgr_utils.CommonMixIn,
|
|||||||
self.assertEqual(reason, ret['deploy']['reason'])
|
self.assertEqual(reason, ret['deploy']['reason'])
|
||||||
mock_iwdi.assert_called_once_with(self.context, node.instance_info)
|
mock_iwdi.assert_called_once_with(self.context, node.instance_info)
|
||||||
|
|
||||||
|
@mock.patch.object(images, 'is_whole_disk_image')
|
||||||
|
def test_validate_driver_interfaces_validation_fail_unexpected(
|
||||||
|
self, mock_iwdi):
|
||||||
|
node = obj_utils.create_test_node(self.context, driver='fake')
|
||||||
|
with mock.patch(
|
||||||
|
'ironic.drivers.modules.fake.FakeDeploy.validate'
|
||||||
|
) as deploy:
|
||||||
|
deploy.side_effect = Exception('boom')
|
||||||
|
ret = self.service.validate_driver_interfaces(self.context,
|
||||||
|
node.uuid)
|
||||||
|
reason = ('Unexpected exception, traceback saved '
|
||||||
|
'into log by ironic conductor service '
|
||||||
|
'that is running on test-host: boom')
|
||||||
|
self.assertFalse(ret['deploy']['result'])
|
||||||
|
self.assertEqual(reason, ret['deploy']['reason'])
|
||||||
|
|
||||||
|
mock_iwdi.assert_called_once_with(self.context, node.instance_info)
|
||||||
|
|
||||||
@mock.patch.object(manager.ConductorManager, '_fail_if_in_state',
|
@mock.patch.object(manager.ConductorManager, '_fail_if_in_state',
|
||||||
autospec=True)
|
autospec=True)
|
||||||
@mock.patch.object(manager.ConductorManager, '_mapped_to_this_conductor')
|
@mock.patch.object(manager.ConductorManager, '_mapped_to_this_conductor')
|
||||||
|
@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- Catch unknown exceptions with traceback
|
||||||
|
when validating driver interfaces.
|
Loading…
x
Reference in New Issue
Block a user