Merge "Remove deprecated option [ilo]power_retry"
This commit is contained in:
commit
9c8f59a098
@ -62,14 +62,6 @@ opts = [
|
||||
'step requires "ilo_change_password" parameter to be '
|
||||
'updated in nodes\'s driver_info with the new '
|
||||
'password.')),
|
||||
cfg.IntOpt('power_retry',
|
||||
default=6,
|
||||
deprecated_for_removal=True,
|
||||
deprecated_reason=_('This configuration option is replaced '
|
||||
'by [conductor] soft_power_off_timeout, '
|
||||
'please use that instead.'),
|
||||
help=_('Number of times a power operation needs to be '
|
||||
'retried')),
|
||||
cfg.IntOpt('power_wait',
|
||||
default=2,
|
||||
help=_('Amount of time in seconds to wait in between power '
|
||||
|
@ -110,19 +110,9 @@ def _wait_for_state_change(node, target_state,
|
||||
"""
|
||||
state = [None]
|
||||
retries = [0]
|
||||
force_legacy_behavior = False
|
||||
interval = CONF.ilo.power_wait
|
||||
if timeout:
|
||||
max_retry = int(timeout / interval)
|
||||
elif CONF.ilo.power_retry:
|
||||
# Do not use post state to track power state as its too small
|
||||
# timeout value to track post state when server is powered on.
|
||||
# The total timeout value would be 12 secs with default values
|
||||
# of configs ilo.power_retry and ilo.power_wait.
|
||||
# Use older ways of get_power_state() to track the power state
|
||||
# changes, instead.
|
||||
force_legacy_behavior = True
|
||||
max_retry = CONF.ilo.power_retry
|
||||
else:
|
||||
# Since we are going to track server post state, we are not using
|
||||
# CONF.conductor.power_state_change_timeout as its default value
|
||||
@ -134,7 +124,7 @@ def _wait_for_state_change(node, target_state,
|
||||
|
||||
state_to_check = target_state
|
||||
use_post_state = False
|
||||
if not force_legacy_behavior and _can_get_server_post_state(node):
|
||||
if _can_get_server_post_state(node):
|
||||
use_post_state = True
|
||||
if (target_state in [states.POWER_OFF, states.SOFT_POWER_OFF] or
|
||||
target_state == states.SOFT_REBOOT and not is_final_state):
|
||||
|
@ -45,8 +45,8 @@ class IloPowerInternalMethodsTestCase(test_common.BaseIloTest):
|
||||
self.node = obj_utils.create_test_node(
|
||||
self.context, driver='ilo', driver_info=INFO_DICT,
|
||||
instance_uuid=uuidutils.generate_uuid())
|
||||
CONF.set_override('power_retry', 2, 'ilo')
|
||||
CONF.set_override('power_wait', 0, 'ilo')
|
||||
CONF.set_override('power_wait', 1, 'ilo')
|
||||
CONF.set_override('soft_power_off_timeout', 1, 'conductor')
|
||||
|
||||
def test__get_power_state(self, get_ilo_object_mock):
|
||||
ilo_mock_object = get_ilo_object_mock.return_value
|
||||
@ -93,19 +93,29 @@ class IloPowerInternalMethodsTestCase(test_common.BaseIloTest):
|
||||
states.REBOOT)
|
||||
ilo_mock_object.reset_server.assert_called_once_with()
|
||||
|
||||
def test__set_power_state_reboot_ok(self, get_ilo_object_mock):
|
||||
@mock.patch.object(ilo_common, 'get_server_post_state', spec_set=True,
|
||||
autospec=True)
|
||||
def test__set_power_state_reboot_ok(self, get_post_mock,
|
||||
get_ilo_object_mock):
|
||||
ilo_mock_object = get_ilo_object_mock.return_value
|
||||
ilo_mock_object.get_host_power_status.side_effect = ['ON', 'OFF', 'ON']
|
||||
get_post_mock.side_effect = (['FinishedPost', 'PowerOff',
|
||||
'FinishedPost'])
|
||||
|
||||
with task_manager.acquire(self.context, self.node.uuid,
|
||||
shared=True) as task:
|
||||
ilo_power._set_power_state(task, states.REBOOT)
|
||||
get_post_mock.assert_called_with(task.node)
|
||||
|
||||
ilo_mock_object.reset_server.assert_called_once_with()
|
||||
|
||||
def test__set_power_state_off_fail(self, get_ilo_object_mock):
|
||||
@mock.patch.object(ilo_common, 'get_server_post_state', spec_set=True,
|
||||
autospec=True)
|
||||
def test__set_power_state_off_fail(self, get_post_mock,
|
||||
get_ilo_object_mock):
|
||||
ilo_mock_object = get_ilo_object_mock.return_value
|
||||
ilo_mock_object.get_host_power_status.return_value = 'ON'
|
||||
get_post_mock.side_effect = (['FinishedPost', 'FinishedPost',
|
||||
'FinishedPost', 'FinishedPost',
|
||||
'FinishedPost'])
|
||||
|
||||
with task_manager.acquire(self.context, self.node.uuid,
|
||||
shared=True) as task:
|
||||
@ -114,18 +124,20 @@ class IloPowerInternalMethodsTestCase(test_common.BaseIloTest):
|
||||
task,
|
||||
states.POWER_OFF)
|
||||
|
||||
ilo_mock_object.get_host_power_status.assert_called_with()
|
||||
get_post_mock.assert_called_with(task.node)
|
||||
ilo_mock_object.hold_pwr_btn.assert_called_once_with()
|
||||
|
||||
def test__set_power_state_on_ok(self, get_ilo_object_mock):
|
||||
@mock.patch.object(ilo_common, 'get_server_post_state', spec_set=True,
|
||||
autospec=True)
|
||||
def test__set_power_state_on_ok(self, get_post_mock, get_ilo_object_mock):
|
||||
ilo_mock_object = get_ilo_object_mock.return_value
|
||||
ilo_mock_object.get_host_power_status.side_effect = ['OFF', 'ON']
|
||||
get_post_mock.side_effect = ['PowerOff', 'PowerOff', 'FinishedPost']
|
||||
|
||||
target_state = states.POWER_ON
|
||||
with task_manager.acquire(self.context, self.node.uuid,
|
||||
shared=True) as task:
|
||||
ilo_power._set_power_state(task, target_state)
|
||||
ilo_mock_object.get_host_power_status.assert_called_with()
|
||||
get_post_mock.assert_called_with(task.node)
|
||||
ilo_mock_object.set_host_power.assert_called_once_with('ON')
|
||||
|
||||
@mock.patch.object(ilo_power.LOG, 'info')
|
||||
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
upgrade:
|
||||
- |
|
||||
Removes deprecated option ``[ilo]/power_retry``. Please use
|
||||
``[conductor]/soft_power_off_timeout`` instead.
|
Loading…
Reference in New Issue
Block a user