Merge "Fix nits in cleaning"

This commit is contained in:
Jenkins 2015-03-05 08:24:37 +00:00 committed by Gerrit Code Review
commit b6153484ce
4 changed files with 10 additions and 9 deletions

View File

@ -123,9 +123,7 @@ CLEANING = 'cleaning'
""" Node is being automatically cleaned to prepare it for provisioning. """
CLEANFAIL = 'clean failed'
""" Node failed cleaning. This requires operator intervention to
resolve.
"""
""" Node failed cleaning. This requires operator intervention to resolve. """
ERROR = 'error'
""" An error occurred during node processing.

View File

@ -797,14 +797,14 @@ class ConductorManager(periodic_task.PeriodicTasks):
except (exception.InvalidParameterValue,
exception.MissingParameterValue) as e:
node.last_error = (_('Failed to validate power driver interface. '
'Can not clean instance. Error: %(msg)s') %
'Can not clean instance. Error: %(msg)s') %
{'msg': e})
task.process_event('fail')
return
# TODO(JoshNang) Implement
# Move to AVAILABLE
LOG.debug('Cleaning complete for node %s' % node.uuid)
LOG.debug('Cleaning complete for node %s', node.uuid)
task.process_event('done')
@messaging.expected_exceptions(exception.NoFreeConductorWorker,

View File

@ -150,7 +150,7 @@ class BaseInterface(object):
return self.clean_steps
def execute_clean_step(self, task, step):
"""Execute a the clean step on task.node.
"""Execute the clean step on task.node.
Clean steps should take a single argument: a TaskManager object.
Steps can be executed synchronously or asynchronously. Steps should
@ -162,8 +162,9 @@ class BaseInterface(object):
:param task: A TaskManager object
:param step: A CleanStep object to execute
:returns: states.CLEANING if the method is complete, or None if
the step will continue to execute asynchronously.
:returns: None if this method has completed synchronously, or
states.CLEANING if the step will continue to execute
asynchronously.
"""
return getattr(self, step.get('step'))(task)

View File

@ -1363,6 +1363,7 @@ class DoNodeDeployTearDownTestCase(_ServiceSetUpMixin,
self._start_service()
self.service._do_node_tear_down(task)
node.refresh()
# Node will be moved to AVAILABLE after cleaning, not tested here
self.assertEqual(states.CLEANING, node.provision_state)
self.assertEqual(states.AVAILABLE, node.target_provision_state)
self.assertIsNone(node.last_error)
@ -1382,6 +1383,7 @@ class DoNodeDeployTearDownTestCase(_ServiceSetUpMixin,
self.service.do_node_tear_down(self.context, node.uuid)
self.service._worker_pool.waitall()
node.refresh()
# Node will be moved to AVAILABLE after cleaning, not tested here
self.assertEqual(states.CLEANING, node.provision_state)
self.assertEqual(states.AVAILABLE, node.target_provision_state)
self.assertIsNone(node.last_error)
@ -1461,7 +1463,6 @@ class DoNodeDeployTearDownTestCase(_ServiceSetUpMixin,
@mock.patch('ironic.conductor.manager.ConductorManager._spawn_worker')
def test_do_provision_action_provide(self, mock_spawn):
# test when a node is cleaned going from manageable to available
node = obj_utils.create_test_node(
self.context, driver='fake',
@ -1471,6 +1472,7 @@ class DoNodeDeployTearDownTestCase(_ServiceSetUpMixin,
self._start_service()
self.service.do_provisioning_action(self.context, node.uuid, 'provide')
node.refresh()
# Node will be moved to AVAILABLE after cleaning, not tested here
self.assertEqual(states.CLEANING, node.provision_state)
self.assertEqual(states.AVAILABLE, node.target_provision_state)
self.assertIsNone(node.last_error)