Merge "Drop scheduler RPC 3.x support"
This commit is contained in:
commit
568be05e1d
@ -28,7 +28,6 @@ from oslo_utils import importutils
|
|||||||
|
|
||||||
from nova import exception
|
from nova import exception
|
||||||
from nova import manager
|
from nova import manager
|
||||||
from nova import objects
|
|
||||||
from nova import quota
|
from nova import quota
|
||||||
|
|
||||||
|
|
||||||
@ -63,7 +62,6 @@ class SchedulerManager(manager.Manager):
|
|||||||
self.driver = importutils.import_object(scheduler_driver)
|
self.driver = importutils.import_object(scheduler_driver)
|
||||||
super(SchedulerManager, self).__init__(service_name='scheduler',
|
super(SchedulerManager, self).__init__(service_name='scheduler',
|
||||||
*args, **kwargs)
|
*args, **kwargs)
|
||||||
self.additional_endpoints.append(_SchedulerManagerV3Proxy(self))
|
|
||||||
|
|
||||||
@periodic_task.periodic_task
|
@periodic_task.periodic_task
|
||||||
def _expire_reservations(self, context):
|
def _expire_reservations(self, context):
|
||||||
@ -125,34 +123,3 @@ class SchedulerManager(manager.Manager):
|
|||||||
"""
|
"""
|
||||||
self.driver.host_manager.sync_instance_info(context, host_name,
|
self.driver.host_manager.sync_instance_info(context, host_name,
|
||||||
instance_uuids)
|
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
|
|
||||||
|
@ -105,22 +105,6 @@ class SchedulerManagerTestCase(test.NoDBTestCase):
|
|||||||
mock.sentinel.instance_uuids)
|
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):
|
class SchedulerTestCase(test.NoDBTestCase):
|
||||||
"""Test case for base scheduler driver class."""
|
"""Test case for base scheduler driver class."""
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user