From 0a321235bf79adeaa8bd207a3f8b29fa9f67b451 Mon Sep 17 00:00:00 2001 From: Dmitry Tantsur Date: Thu, 26 Jan 2017 12:27:30 +0100 Subject: [PATCH] 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 --- example.conf | 8 ++-- ironic_inspector/conf.py | 5 ++- ironic_inspector/test/unit/test_introspect.py | 40 ++++--------------- ...-drivers-deprecation-1d0c25b112fbd4da.yaml | 9 +++++ 4 files changed, 25 insertions(+), 37 deletions(-) create mode 100644 releasenotes/notes/introspection-delay-drivers-deprecation-1d0c25b112fbd4da.yaml diff --git a/example.conf b/example.conf index 3de199078..2f0ce8766 100644 --- a/example.conf +++ b/example.conf @@ -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) diff --git a/ironic_inspector/conf.py b/ironic_inspector/conf.py index 30e15765e..cc1cd1627 100644 --- a/ironic_inspector/conf.py +++ b/ironic_inspector/conf.py @@ -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'], diff --git a/ironic_inspector/test/unit/test_introspect.py b/ironic_inspector/test/unit/test_introspect.py index 4e988cc25..a51417fc4 100644 --- a/ironic_inspector/test/unit/test_introspect.py +++ b/ironic_inspector/test/unit/test_introspect.py @@ -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 diff --git a/releasenotes/notes/introspection-delay-drivers-deprecation-1d0c25b112fbd4da.yaml b/releasenotes/notes/introspection-delay-drivers-deprecation-1d0c25b112fbd4da.yaml new file mode 100644 index 000000000..50f8e7066 --- /dev/null +++ b/releasenotes/notes/introspection-delay-drivers-deprecation-1d0c25b112fbd4da.yaml @@ -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.