From 3d8191f6c71498bffdc4af411d5f94dc3042b3a3 Mon Sep 17 00:00:00 2001 From: Hans Lindgren Date: Wed, 17 Jun 2015 19:01:37 +0200 Subject: [PATCH] Drop scheduler RPC 3.x support The major version of the scheduler RPC API was bumped in Kilo [1]. Since we are now in Liberty the old 3.x version can be removed. [1] 8466013fbed8b0ec7bb64c6eb183c9bb1b846665 Change-Id: I744cc362fd7c76f684e70379f5f4736aa359d19b --- nova/scheduler/manager.py | 33 --------------------- nova/tests/unit/scheduler/test_scheduler.py | 16 ---------- 2 files changed, 49 deletions(-) diff --git a/nova/scheduler/manager.py b/nova/scheduler/manager.py index adee62a63fb6..c29ed5e92bb9 100644 --- a/nova/scheduler/manager.py +++ b/nova/scheduler/manager.py @@ -28,7 +28,6 @@ from oslo_utils import importutils from nova import exception from nova import manager -from nova import objects from nova import quota @@ -63,7 +62,6 @@ class SchedulerManager(manager.Manager): self.driver = importutils.import_object(scheduler_driver) super(SchedulerManager, self).__init__(service_name='scheduler', *args, **kwargs) - self.additional_endpoints.append(_SchedulerManagerV3Proxy(self)) @periodic_task.periodic_task def _expire_reservations(self, context): @@ -125,34 +123,3 @@ class SchedulerManager(manager.Manager): """ self.driver.host_manager.sync_instance_info(context, host_name, instance_uuids) - - -class _SchedulerManagerV3Proxy(object): - - target = messaging.Target(version='3.0') - - def __init__(self, manager): - self.manager = manager - - # NOTE(sbauza): Previous run_instance() and prep_resize() methods were - # removed from the Juno branch before Juno released, so we can safely - # remove them even from the V3.1 proxy as there is no Juno RPC client - # that can call them - @messaging.expected_exceptions(exception.NoValidHost) - def select_destinations(self, context, request_spec, filter_properties): - """Returns destinations(s) best suited for this request_spec and - filter_properties. - - The result should be a list of dicts with 'host', 'nodename' and - 'limits' as keys. - """ - # TODO(melwitt): Remove this in version 4.0 of the RPC API - flavor = filter_properties.get('instance_type') - if flavor and not isinstance(flavor, objects.Flavor): - # Code downstream may expect extra_specs to be populated since it - # is receiving an object, so lookup the flavor to ensure this. - flavor = objects.Flavor.get_by_id(context, flavor['id']) - filter_properties = dict(filter_properties, instance_type=flavor) - dests = self.manager.select_destinations(context, request_spec, - filter_properties) - return dests diff --git a/nova/tests/unit/scheduler/test_scheduler.py b/nova/tests/unit/scheduler/test_scheduler.py index 8b8d32282f01..e6d57166e95d 100644 --- a/nova/tests/unit/scheduler/test_scheduler.py +++ b/nova/tests/unit/scheduler/test_scheduler.py @@ -105,22 +105,6 @@ class SchedulerManagerTestCase(test.NoDBTestCase): mock.sentinel.instance_uuids) -class SchedulerV21PassthroughTestCase(test.NoDBTestCase): - - @mock.patch.object(host_manager.HostManager, '_init_instance_info') - @mock.patch.object(host_manager.HostManager, '_init_aggregates') - def setUp(self, mock_init_agg, mock_init_inst): - super(SchedulerV21PassthroughTestCase, self).setUp() - self.manager = manager.SchedulerManager() - self.proxy = manager._SchedulerManagerV3Proxy(self.manager) - - def test_select_destination(self): - with mock.patch.object(self.manager, 'select_destinations' - ) as select_destinations: - self.proxy.select_destinations(None, None, {}) - select_destinations.assert_called_once_with(None, None, {}) - - class SchedulerTestCase(test.NoDBTestCase): """Test case for base scheduler driver class."""