diff options
author | Hugo Nicodemos <nicodemos@lsd.ufcg.edu.br> | 2017-11-09 18:07:52 +0000 |
---|---|---|
committer | Hugo Nicodemos <nicodemos@lsd.ufcg.edu.br> | 2017-11-09 16:13:45 -0300 |
commit | 6762458e95cc8176c8e6d83279fb7f025eed8f4e (patch) | |
tree | 329546bb51f2406d07d54fbf8e5cf6896b3dcce1 | |
parent | 6023e68c8940bd3ce76a2a36d7acca6976b49c71 (diff) | |
download | ironic-6762458e95cc8176c8e6d83279fb7f025eed8f4e.tar.gz |
Revert "Add a timeout for powering on/off a node on HPE OneView Driver"
Reverting these changes because python-hpOneView does not provide HTTPS
secure connection with custom CAcert and could cause a possible security issue.
This reverts commit bab1054a0a04dfb6b3e8f489b7df18f5966d9029.
Change-Id: I540c20ba697f35aced79e158d190b7a85d60311f
-rw-r--r-- | ironic/drivers/modules/oneview/power.py | 25 | ||||
-rw-r--r-- | ironic/tests/unit/drivers/modules/oneview/test_power.py | 19 | ||||
-rw-r--r-- | releasenotes/notes/oneview-timeout-power-88b02a9cd45876d7.yaml | 5 |
3 files changed, 16 insertions, 33 deletions
diff --git a/ironic/drivers/modules/oneview/power.py b/ironic/drivers/modules/oneview/power.py index fadc0956d..575d1a98f 100644 --- a/ironic/drivers/modules/oneview/power.py +++ b/ironic/drivers/modules/oneview/power.py @@ -128,14 +128,12 @@ class OneViewPower(base.PowerInterface): @METRICS.timer('OneViewPower.set_power_state') @task_manager.require_exclusive_lock - def set_power_state(self, task, power_state, timeout=None): + def set_power_state(self, task, power_state): """Set the power state of the task's node. :param task: a TaskManager instance. :param power_state: The desired power state POWER_ON, POWER_OFF or REBOOT from :mod:`ironic.common.states`. - :param timeout: timeout (in seconds) positive integer (> 0) for any - power state. ``None`` indicates to use default timeout. :raises: InvalidParameterValue if an invalid power state was specified. :raises: PowerStateFailure if the power couldn't be set to power_state. :raises: OneViewError if OneView fails setting the power state. @@ -157,43 +155,36 @@ class OneViewPower(base.PowerInterface): {'node_uuid': task.node.uuid, 'power_state': power_state}) server_hardware = task.node.driver_info.get('server_hardware_uri') - timeout = (-1 if timeout is None else timeout) try: if power_state == states.POWER_ON: management.set_boot_device(task) self.client.server_hardware.update_power_state( - SET_POWER_STATE_MAP.get(power_state), - server_hardware, timeout=timeout) + SET_POWER_STATE_MAP.get(power_state), server_hardware) elif power_state == states.REBOOT: self.client.server_hardware.update_power_state( - SET_POWER_STATE_MAP.get(states.POWER_OFF), server_hardware, - timeout=timeout) + SET_POWER_STATE_MAP.get(states.POWER_OFF), server_hardware) management.set_boot_device(task) self.client.server_hardware.update_power_state( - SET_POWER_STATE_MAP.get(states.POWER_ON), server_hardware, - timeout=timeout) + SET_POWER_STATE_MAP.get(states.POWER_ON), server_hardware) else: self.client.server_hardware.update_power_state( - SET_POWER_STATE_MAP.get(power_state), server_hardware, - timeout=timeout) + SET_POWER_STATE_MAP.get(power_state), server_hardware) except client_exception.HPOneViewException as exc: raise exception.OneViewError( _("Error setting power state: %s") % exc) @METRICS.timer('OneViewPower.reboot') @task_manager.require_exclusive_lock - def reboot(self, task, timeout=None): + def reboot(self, task): """Reboot the node. :param task: a TaskManager instance. - :param timeout: timeout (in seconds) positive integer (> 0) for any - power state. ``None`` indicates to use default timeout. :raises: PowerStateFailure if the final state of the node is not POWER_ON. """ current_power_state = self.get_power_state(task) if current_power_state == states.POWER_ON: - self.set_power_state(task, states.REBOOT, timeout=timeout) + self.set_power_state(task, states.REBOOT) else: - self.set_power_state(task, states.POWER_ON, timeout=timeout) + self.set_power_state(task, states.POWER_ON) diff --git a/ironic/tests/unit/drivers/modules/oneview/test_power.py b/ironic/tests/unit/drivers/modules/oneview/test_power.py index 0cba73b67..e2c1358c6 100644 --- a/ironic/tests/unit/drivers/modules/oneview/test_power.py +++ b/ironic/tests/unit/drivers/modules/oneview/test_power.py @@ -121,8 +121,7 @@ class OneViewPowerDriverTestCase(db_base.DbTestCase): self.driver.power.set_power_state(task, states.POWER_ON) self.assertTrue(mock_set_boot_device.called) update = client.server_hardware.update_power_state - update.assert_called_once_with(power.POWER_ON, server_hardware, - timeout=-1) + update.assert_called_once_with(power.POWER_ON, server_hardware) @mock.patch.object(management, 'set_boot_device') def test_set_power_off(self, mock_set_boot_device, mock_get_ov_client): @@ -133,8 +132,7 @@ class OneViewPowerDriverTestCase(db_base.DbTestCase): self.driver.power.set_power_state(task, states.POWER_OFF) self.assertFalse(mock_set_boot_device.called) update = client.server_hardware.update_power_state - update.assert_called_once_with(power.POWER_OFF, server_hardware, - timeout=-1) + update.assert_called_once_with(power.POWER_OFF, server_hardware) @mock.patch.object(management, 'set_boot_device') def test_set_power_reboot(self, mock_set_boot_device, mock_get_ov_client): @@ -143,8 +141,8 @@ class OneViewPowerDriverTestCase(db_base.DbTestCase): server_hardware = self.node.driver_info.get('server_hardware_uri') with task_manager.acquire(self.context, self.node.uuid) as task: self.driver.power.set_power_state(task, states.REBOOT) - calls = [mock.call(power.POWER_OFF, server_hardware, timeout=-1), - mock.call(power.POWER_ON, server_hardware, timeout=-1)] + calls = [mock.call(power.POWER_OFF, server_hardware), + mock.call(power.POWER_ON, server_hardware)] update = client.server_hardware.update_power_state update.assert_has_calls(calls) @@ -232,8 +230,8 @@ class OneViewPowerDriverTestCase(db_base.DbTestCase): server_hardware = self.node.driver_info.get('server_hardware_uri') with task_manager.acquire(self.context, self.node.uuid) as task: self.driver.power.reboot(task) - calls = [mock.call(power.POWER_OFF, server_hardware, timeout=-1), - mock.call(power.POWER_ON, server_hardware, timeout=-1)] + calls = [mock.call(power.POWER_OFF, server_hardware), + mock.call(power.POWER_ON, server_hardware)] update = client.server_hardware.update_power_state update.assert_has_calls(calls) mock_set_boot_device.assert_called_once_with(task) @@ -247,8 +245,7 @@ class OneViewPowerDriverTestCase(db_base.DbTestCase): self.driver.power.client = client server_hardware = self.node.driver_info.get('server_hardware_uri') with task_manager.acquire(self.context, self.node.uuid) as task: - self.driver.power.reboot(task, timeout=-1) + self.driver.power.reboot(task) update = client.server_hardware.update_power_state - update.assert_called_once_with(power.POWER_ON, server_hardware, - timeout=-1) + update.assert_called_once_with(power.POWER_ON, server_hardware) mock_set_boot_device.assert_called_once_with(task) diff --git a/releasenotes/notes/oneview-timeout-power-88b02a9cd45876d7.yaml b/releasenotes/notes/oneview-timeout-power-88b02a9cd45876d7.yaml deleted file mode 100644 index 63d1ee8ee..000000000 --- a/releasenotes/notes/oneview-timeout-power-88b02a9cd45876d7.yaml +++ /dev/null @@ -1,5 +0,0 @@ ---- -features: - - | - Adds support for ``timeout`` parameter when powering on/off a bare metal - node managed by the ``oneview`` hardware type. |