diff --git a/nova/compute/manager.py b/nova/compute/manager.py index c815d40cc041..f0d45051e351 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -76,6 +76,7 @@ from nova.openstack.common.rpc import common as rpc_common from nova.openstack.common import timeutils from nova import paths from nova import safe_utils +from nova.scheduler import rpcapi as scheduler_rpcapi from nova import utils from nova.virt import block_device as driver_block_device from nova.virt import driver @@ -416,7 +417,7 @@ class ComputeVirtAPI(virtapi.VirtAPI): context, bdm_id, values) -class ComputeManager(manager.SchedulerDependentManager): +class ComputeManager(manager.Manager): """Manages the running instances from creation to destruction.""" RPC_API_VERSION = '3.0' @@ -439,6 +440,7 @@ class ComputeManager(manager.SchedulerDependentManager): openstack_driver.is_neutron_security_groups()) self.consoleauth_rpcapi = consoleauth.rpcapi.ConsoleAuthAPI() self.cells_rpcapi = cells_rpcapi.CellsAPI() + self.scheduler_rpcapi = scheduler_rpcapi.SchedulerAPI() self._resource_tracker_dict = {} super(ComputeManager, self).__init__(service_name="compute", diff --git a/nova/manager.py b/nova/manager.py index 710fa2ff3153..aea651bf57c3 100644 --- a/nova/manager.py +++ b/nova/manager.py @@ -62,7 +62,6 @@ from nova.objects import base as objects_base from nova.openstack.common import log as logging from nova.openstack.common import periodic_task from nova.openstack.common.rpc import dispatcher as rpc_dispatcher -from nova.scheduler import rpcapi as scheduler_rpcapi CONF = cfg.CONF @@ -128,27 +127,3 @@ class Manager(base.Base, periodic_task.PeriodicTasks): Child classes should override this method. """ pass - - -class SchedulerDependentManager(Manager): - """Periodically send capability updates to the Scheduler services. - - Services that need to update the Scheduler of their capabilities - should derive from this class. Otherwise they can derive from - manager.Manager directly. Updates are only sent after - update_service_capabilities is called with non-None values. - - """ - - def __init__(self, host=None, db_driver=None, service_name='undefined'): - self.last_capabilities = None - self.service_name = service_name - self.scheduler_rpcapi = scheduler_rpcapi.SchedulerAPI() - super(SchedulerDependentManager, self).__init__(host, db_driver, - service_name) - - def update_service_capabilities(self, capabilities): - """Remember these capabilities to send on next periodic update.""" - if not isinstance(capabilities, list): - capabilities = [capabilities] - self.last_capabilities = capabilities