Merge "Overrides get_supported_power_states() for WOL Power"

This commit is contained in:
Jenkins 2017-01-24 11:44:34 +00:00 committed by Gerrit Code Review
commit cf29fd0515
2 changed files with 15 additions and 0 deletions

View File

@ -194,3 +194,9 @@ class WakeOnLanDriverTestCase(db_base.DbTestCase):
mock_log.assert_called_once_with(mock.ANY, self.node.uuid)
mock_power.assert_called_once_with(task.driver.power, task,
states.POWER_ON)
def test_get_supported_power_states(self):
with task_manager.acquire(
self.context, self.node.uuid, shared=True) as task:
pstate = task.driver.power.get_supported_power_states(task)
self.assertEqual([states.POWER_ON, states.REBOOT], pstate)

View File

@ -181,3 +181,12 @@ class WakeOnLanPower(base.PowerInterface):
'not fully support this operation. Trying to '
'power on the node.'), task.node.uuid)
self.set_power_state(task, states.POWER_ON)
def get_supported_power_states(self, task):
"""Get a list of the supported power states.
:param task: A TaskManager instance containing the node to act on.
:returns: A list with the supported power states defined
in :mod:`ironic.common.states`.
"""
return [states.POWER_ON, states.REBOOT]