Merge "Deprecate introspection_delay_drivers option and make it no-op"

This commit is contained in:
Jenkins 2017-01-30 16:07:21 +00:00 committed by Gerrit Code Review
commit 595ad3a513
4 changed files with 25 additions and 37 deletions

View File

@ -58,9 +58,11 @@
# Delay (in seconds) between two introspections. (integer value)
#introspection_delay = 5
# Only node with drivers matching this regular expression will be
# affected by introspection_delay setting. (string value)
#introspection_delay_drivers = ^.*_ssh$
# DEPRECATED: Only node with drivers matching this regular expression
# will be affected by introspection_delay setting. (string value)
# This option is deprecated for removal.
# Its value may be silently ignored in the future.
#introspection_delay_drivers = .*
# Ironic driver_info fields that are equivalent to ipmi_address. (list
# value)

View File

@ -204,10 +204,11 @@ SERVICE_OPTS = [
default=5,
help=_('Delay (in seconds) between two introspections.')),
cfg.StrOpt('introspection_delay_drivers',
default='^.*_ssh$',
default='.*',
help=_('Only node with drivers matching this regular '
'expression will be affected by introspection_delay '
'setting.')),
'setting.'),
deprecated_for_removal=True),
cfg.ListOpt('ipmi_address_fields',
default=['ilo_address', 'drac_host', 'drac_address',
'cimc_address'],

View File

@ -268,32 +268,8 @@ class TestIntrospect(BaseTest):
@mock.patch.object(time, 'sleep')
@mock.patch.object(time, 'time')
def test_sleep_no_pxe_ssh(self, time_mock, sleep_mock, client_mock,
start_mock, filters_mock):
self.node.driver = 'pxe_ipmitool'
time_mock.return_value = 42
introspect._LAST_INTROSPECTION_TIME = 40
CONF.set_override('introspection_delay', 10)
cli = self._prepare(client_mock)
start_mock.return_value = self.node_info
introspect.introspect(self.uuid)
self.assertFalse(sleep_mock.called)
cli.node.set_boot_device.assert_called_once_with(self.uuid,
'pxe',
persistent=False)
cli.node.set_power_state.assert_called_once_with(self.uuid,
'reboot')
# not changed
self.assertEqual(40, introspect._LAST_INTROSPECTION_TIME)
@mock.patch.object(time, 'sleep')
@mock.patch.object(time, 'time')
def test_sleep_with_pxe_ssh(self, time_mock, sleep_mock, client_mock,
start_mock, filters_mock):
self.node.driver = 'pxe_ssh'
def test_introspection_delay(self, time_mock, sleep_mock, client_mock,
start_mock, filters_mock):
time_mock.return_value = 42
introspect._LAST_INTROSPECTION_TIME = 40
CONF.set_override('introspection_delay', 10)
@ -314,10 +290,9 @@ class TestIntrospect(BaseTest):
@mock.patch.object(time, 'sleep')
@mock.patch.object(time, 'time')
def test_sleep_not_needed_with_pxe_ssh(self, time_mock, sleep_mock,
client_mock, start_mock,
filters_mock):
self.node.driver = 'agent_ssh'
def test_introspection_delay_not_needed(self, time_mock, sleep_mock,
client_mock, start_mock,
filters_mock):
time_mock.return_value = 100
introspect._LAST_INTROSPECTION_TIME = 40
CONF.set_override('introspection_delay', 10)
@ -338,8 +313,9 @@ class TestIntrospect(BaseTest):
@mock.patch.object(time, 'sleep')
@mock.patch.object(time, 'time')
def test_sleep_with_custom_driver(self, time_mock, sleep_mock, client_mock,
start_mock, filters_mock):
def test_introspection_delay_custom_drivers(self, time_mock, sleep_mock,
client_mock, start_mock,
filters_mock):
self.node.driver = 'foobar'
time_mock.return_value = 42
introspect._LAST_INTROSPECTION_TIME = 40

View File

@ -0,0 +1,9 @@
---
upgrade:
- |
The configuration option "introspection_delay_drivers" was changed to
``.*``, which means that "introspection_delay" is now applied to all
drivers. Set "introspection_delay" to 0 to disable the delay.
deprecations:
- |
The configuration option "introspection_delay_drivers" is deprecated.