Merge "Add node.uuid to InstanceDeploy error message"

This commit is contained in:
Jenkins 2016-02-16 18:23:40 +00:00 committed by Gerrit Code Review
commit b06ec5bd47
2 changed files with 10 additions and 3 deletions

View File

@ -547,9 +547,10 @@ class ConductorManager(base_manager.BaseConductorManager):
task.driver.deploy.validate(task)
except (exception.InvalidParameterValue,
exception.MissingParameterValue) as e:
raise exception.InstanceDeployFailure(_(
"RPC do_node_deploy failed to validate deploy or "
"power info. Error: %(msg)s") % {'msg': e})
raise exception.InstanceDeployFailure(
_("RPC do_node_deploy failed to validate deploy or "
"power info for node %(node_uuid)s. Error: %(msg)s") %
{'node_uuid': node.uuid, 'msg': e})
LOG.debug("do_node_deploy Calling event: %(event)s for node: "
"%(node)s", {'event': event, 'node': node.uuid})

View File

@ -661,6 +661,12 @@ class ServiceDoNodeDeployTestCase(mgr_utils.ServiceSetUpMixin,
self.context, node.uuid)
# Compare true exception hidden by @messaging.expected_exceptions
self.assertEqual(exception.InstanceDeployFailure, exc.exc_info[0])
# Check the message of InstanceDeployFailure. In a
# messaging.rpc.ExpectedException sys.exc_info() is stored in exc_info
# in the exception object. So InstanceDeployFailure will be in
# exc_info[1]
self.assertIn(r'node 1be26c0b-03f2-4d2e-ae87-c02d7f33c123',
str(exc.exc_info[1]))
# This is a sync operation last_error should be None.
self.assertIsNone(node.last_error)
# Verify reservation has been cleared.