Merge "Remove support for driver object periodic tasks"

This commit is contained in:
Jenkins 2017-02-01 15:52:59 +00:00 committed by Gerrit Code Review
commit 965619314d
4 changed files with 14 additions and 13 deletions

View File

@ -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
===============

View File

@ -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:

View File

@ -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):

View File

@ -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.