From 308f00b211f8b766ad85b1cacb0917d748866eac Mon Sep 17 00:00:00 2001 From: Ruby Loo Date: Tue, 31 Jan 2017 22:45:29 +0000 Subject: [PATCH] Remove support for driver object periodic tasks Attaching periodic tasks on a driver object (rather than an interface) was deprecated during the Newton cycle (6.1.0). This removes support for it. Change-Id: I35afd4e0d3d1a32a516f6c755a0bd9aee0f1b1ba Fixes-Bug: #1660805 --- doc/source/dev/architecture.rst | 9 ++------- ironic/conductor/base_manager.py | 3 --- ironic/tests/unit/conductor/test_base_manager.py | 9 ++++++--- ...ve-driver-object-periodic-tasks-1357a1cd3589becf.yaml | 6 ++++++ 4 files changed, 14 insertions(+), 13 deletions(-) create mode 100644 releasenotes/notes/remove-driver-object-periodic-tasks-1357a1cd3589becf.yaml diff --git a/doc/source/dev/architecture.rst b/doc/source/dev/architecture.rst index 75bf7d4e79..db08c47369 100644 --- a/doc/source/dev/architecture.rst +++ b/doc/source/dev/architecture.rst @@ -78,8 +78,8 @@ Driver-Specific Periodic Tasks ------------------------------ Drivers may run their own periodic tasks, i.e. actions run repeatedly after -a certain amount of time. Such task is created by decorating a method on -an interface with periodic_ decorator, e.g. +a certain amount of time. Such a task is created by using the periodic_ +decorator on an interface method. For example :: @@ -94,11 +94,6 @@ an interface with periodic_ decorator, e.g. Here the ``spacing`` argument is a period in seconds for a given periodic task. For example 'spacing=5' means every 5 seconds. -.. note:: - In releases prior to and including the Newton release, it's possible to - bind periodic tasks to a driver object instead of an interface. This is - deprecated and support for it will be removed in the Ocata release. - Message Routing =============== diff --git a/ironic/conductor/base_manager.py b/ironic/conductor/base_manager.py index 0957923b2e..c310b60bf4 100644 --- a/ironic/conductor/base_manager.py +++ b/ironic/conductor/base_manager.py @@ -109,9 +109,6 @@ class BaseConductorManager(object): periodic_task_classes = set() self._collect_periodic_tasks(self, (admin_context,)) for driver_obj in drivers.values(): - # TODO(dtantsur): collecting tasks from driver objects is - # deprecated and should be removed in Ocata. - self._collect_periodic_tasks(driver_obj, (self, admin_context)) for iface_name in driver_obj.all_interfaces: iface = getattr(driver_obj, iface_name, None) if iface and iface.__class__ not in periodic_task_classes: diff --git a/ironic/tests/unit/conductor/test_base_manager.py b/ironic/tests/unit/conductor/test_base_manager.py index 568ef5f539..bde56ea996 100644 --- a/ironic/tests/unit/conductor/test_base_manager.py +++ b/ironic/tests/unit/conductor/test_base_manager.py @@ -142,9 +142,12 @@ class StartStopTestCase(mgr_utils.ServiceSetUpMixin, tests_db_base.DbTestCase): self._start_service(start_periodic_tasks=True) tasks = {c[0] for c in self.service._periodic_task_callables} - for t in (obj.task, obj.iface.iface): - self.assertTrue(periodics.is_periodic(t)) - self.assertIn(t, tasks) + self.assertTrue(periodics.is_periodic(obj.iface.iface)) + self.assertIn(obj.iface.iface, tasks) + + # no periodic tasks from the Driver object + self.assertTrue(periodics.is_periodic(obj.task)) + self.assertNotIn(obj.task, tasks) @mock.patch.object(driver_factory.DriverFactory, '__init__') def test_start_fails_on_missing_driver(self, mock_df): diff --git a/releasenotes/notes/remove-driver-object-periodic-tasks-1357a1cd3589becf.yaml b/releasenotes/notes/remove-driver-object-periodic-tasks-1357a1cd3589becf.yaml new file mode 100644 index 0000000000..49f1a3a483 --- /dev/null +++ b/releasenotes/notes/remove-driver-object-periodic-tasks-1357a1cd3589becf.yaml @@ -0,0 +1,6 @@ +--- +upgrade: + - | + Attaching periodic tasks on a driver object (rather than an interface) + was deprecated during the Newton cycle (6.1.0). Support has been + removed so it is no longer possible to do this.