Remove support for deprecated driver import
Support for specifying the scheduler driver via a full classpath was deprecated in Mitaka, and with this patch is removed in Ocata. Change-Id: I72e392aafa886ba19c874f1e0a0c95f6d1757ab9
This commit is contained in:
parent
7a204383d5
commit
fe3d6dba3d
@ -23,12 +23,10 @@ from oslo_log import log as logging
|
||||
import oslo_messaging as messaging
|
||||
from oslo_serialization import jsonutils
|
||||
from oslo_service import periodic_task
|
||||
from oslo_utils import importutils
|
||||
from stevedore import driver
|
||||
|
||||
import nova.conf
|
||||
from nova import exception
|
||||
from nova.i18n import _, _LW
|
||||
from nova import manager
|
||||
from nova import objects
|
||||
from nova import quota
|
||||
@ -51,28 +49,10 @@ class SchedulerManager(manager.Manager):
|
||||
def __init__(self, scheduler_driver=None, *args, **kwargs):
|
||||
if not scheduler_driver:
|
||||
scheduler_driver = CONF.scheduler_driver
|
||||
try:
|
||||
self.driver = driver.DriverManager(
|
||||
"nova.scheduler.driver",
|
||||
scheduler_driver,
|
||||
invoke_on_load=True).driver
|
||||
# TODO(Yingxin): Change to catch stevedore.exceptions.NoMatches after
|
||||
# stevedore v1.9.0
|
||||
except RuntimeError:
|
||||
# NOTE(Yingxin): Loading full class path is deprecated and should
|
||||
# be removed in the N release.
|
||||
try:
|
||||
self.driver = importutils.import_object(scheduler_driver)
|
||||
LOG.warning(_LW("DEPRECATED: scheduler_driver uses "
|
||||
"classloader to load %(path)s. This legacy "
|
||||
"loading style will be removed in the "
|
||||
"N release."),
|
||||
{'path': scheduler_driver})
|
||||
except (ImportError, ValueError):
|
||||
raise RuntimeError(
|
||||
_("Cannot load scheduler driver from configuration "
|
||||
"%(conf)s."),
|
||||
{'conf': scheduler_driver})
|
||||
super(SchedulerManager, self).__init__(service_name='scheduler',
|
||||
*args, **kwargs)
|
||||
|
||||
|
@ -69,7 +69,7 @@ class NotificationSampleTestBase(test.TestCase,
|
||||
|
||||
self.useFixture(utils_fixture.TimeFixture(test_services.fake_utcnow()))
|
||||
|
||||
self.flags(scheduler_driver='nova.scheduler.chance.ChanceScheduler')
|
||||
self.flags(scheduler_driver='chance_scheduler')
|
||||
# the image fake backend needed for image discovery
|
||||
nova.tests.unit.image.fake.stub_out_image_service(self)
|
||||
self.addCleanup(nova.tests.unit.image.fake.FakeImageService_reset)
|
||||
|
@ -71,23 +71,6 @@ class SchedulerManagerInitTestCase(test.NoDBTestCase):
|
||||
self.flags(scheduler_driver='nonexist_scheduler')
|
||||
self.assertRaises(RuntimeError, self.manager_cls)
|
||||
|
||||
# NOTE(Yingxin): Loading full class path is deprecated and should be
|
||||
# removed in the N release.
|
||||
@mock.patch.object(manager.LOG, 'warning')
|
||||
@mock.patch.object(host_manager.HostManager, '_init_instance_info')
|
||||
@mock.patch.object(host_manager.HostManager, '_init_aggregates')
|
||||
def test_init_using_classpath_to_schedulerdriver(self,
|
||||
mock_init_agg,
|
||||
mock_init_inst,
|
||||
mock_warning):
|
||||
self.flags(
|
||||
scheduler_driver=
|
||||
'nova.scheduler.chance.ChanceScheduler')
|
||||
driver = self.manager_cls().driver
|
||||
self.assertIsInstance(driver, chance.ChanceScheduler)
|
||||
warn_args, kwargs = mock_warning.call_args
|
||||
self.assertIn("DEPRECATED", warn_args[0])
|
||||
|
||||
|
||||
class SchedulerManagerTestCase(test.NoDBTestCase):
|
||||
"""Test case for scheduler manager."""
|
||||
|
@ -0,0 +1,6 @@
|
||||
---
|
||||
upgrades:
|
||||
- The ability to specify the scheduler driver via a full class path was
|
||||
deprecated in Mitaka, and has now been removed. Drivers must now be listed
|
||||
as one of the entrypoints under the namespace 'nova.scheduler.driver' of
|
||||
the 'setup.cfg' file.
|
Loading…
Reference in New Issue
Block a user