Deprecate introspection_delay_drivers option and make it no-op

With switch to virtualbmc we can no longer distinguish between virtual
and bare metal nodes. To stay on a safer side, introspection_delay now
affects all drivers.

I'm also aware of similar DHCP problems on bare metal.

Also renamed unit tests for clarity.

Change-Id: I7d69cd899ec4d893b21cc49d59834dd3c83e0fe2
This commit is contained in:
Dmitry Tantsur 2017-01-26 12:27:30 +01:00
parent 71099c9248
commit 0a321235bf
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

@ -203,10 +203,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.