Merge "ironic: fix logging of validation errors"
This commit is contained in:
@@ -1582,15 +1582,18 @@ class IronicDriverTestCase(test.NoDBTestCase):
|
|||||||
|
|
||||||
self.mock_conn.validate_node.return_value = \
|
self.mock_conn.validate_node.return_value = \
|
||||||
ironic_utils.get_test_validation(
|
ironic_utils.get_test_validation(
|
||||||
power=_node.ValidationResult(result=False, reason=None),
|
power=_node.ValidationResult(result=False, reason='OVERVOLT'),
|
||||||
deploy=_node.ValidationResult(result=False, reason=None),
|
deploy=_node.ValidationResult(result=False, reason=None),
|
||||||
storage=_node.ValidationResult(result=False, reason=None),
|
storage=_node.ValidationResult(result=True, reason=None),
|
||||||
)
|
)
|
||||||
self.mock_conn.get_node.return_value = node
|
self.mock_conn.get_node.return_value = node
|
||||||
image_meta = ironic_utils.get_test_image_meta()
|
image_meta = ironic_utils.get_test_image_meta()
|
||||||
|
|
||||||
self.assertRaises(exception.ValidationError, self.driver.spawn,
|
msgre = '.*deploy: None, power: OVERVOLT, storage: No Error.*'
|
||||||
self.ctx, instance, image_meta, [], None, {})
|
|
||||||
|
self.assertRaisesRegex(exception.ValidationError, msgre,
|
||||||
|
self.driver.spawn, self.ctx, instance, image_meta,
|
||||||
|
[], None, {})
|
||||||
self.mock_conn.get_node.assert_called_once_with(
|
self.mock_conn.get_node.assert_called_once_with(
|
||||||
node_id, fields=ironic_driver._NODE_FIELDS)
|
node_id, fields=ironic_driver._NODE_FIELDS)
|
||||||
mock_avti.assert_called_once_with(self.ctx, instance, None)
|
mock_avti.assert_called_once_with(self.ctx, instance, None)
|
||||||
|
|||||||
@@ -1213,14 +1213,20 @@ class IronicDriver(virt_driver.ComputeDriver):
|
|||||||
):
|
):
|
||||||
# something is wrong. undo what we have done
|
# something is wrong. undo what we have done
|
||||||
self._cleanup_deploy(node, instance, network_info)
|
self._cleanup_deploy(node, instance, network_info)
|
||||||
|
deploy_msg = ("No Error" if validate_chk['deploy'].result
|
||||||
|
else validate_chk['deploy'].reason)
|
||||||
|
power_msg = ("No Error" if validate_chk['power'].result
|
||||||
|
else validate_chk['power'].reason)
|
||||||
|
storage_msg = ("No Error" if validate_chk['storage'].result
|
||||||
|
else validate_chk['storage'].reason)
|
||||||
raise exception.ValidationError(_(
|
raise exception.ValidationError(_(
|
||||||
"Ironic node: %(id)s failed to validate. "
|
"Ironic node: %(id)s failed to validate. "
|
||||||
"(deploy: %(deploy)s, power: %(power)s, "
|
"(deploy: %(deploy)s, power: %(power)s, "
|
||||||
"storage: %(storage)s)")
|
"storage: %(storage)s)")
|
||||||
% {'id': node.id,
|
% {'id': node.id,
|
||||||
'deploy': validate_chk['deploy'],
|
'deploy': deploy_msg,
|
||||||
'power': validate_chk['power'],
|
'power': power_msg,
|
||||||
'storage': validate_chk['storage']})
|
'storage': storage_msg})
|
||||||
|
|
||||||
# Config drive
|
# Config drive
|
||||||
configdrive_value = None
|
configdrive_value = None
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
Fix displaying the reason messages from the Ironic validate node operation that
|
||||||
|
is called just before the instance is deployed on the bare metal node. The
|
||||||
|
message from Ironic is now correctly logged.
|
||||||
|
Fixes `bug 2100009 <https://bugs.launchpad.net/nova/+bug/2100009>_`.
|
||||||
Reference in New Issue
Block a user