From 9ac10f55e4b40ac496c20f56501e5aeffa196692 Mon Sep 17 00:00:00 2001 From: Arata Notsu Date: Thu, 25 Oct 2012 20:24:23 +0900 Subject: Let scheduler know services' capabilities at startup Fixes bug 1071254. Changes: * Add new rpc-api(fanout) of compute "publish_service_capabilities" This rpc-api urges services to send its capabilites to the scheduler. * Scheduler calls publish_service_capabilities right after the start By them, the scheduler get to know the capabilities earlier. Now we can expect that the scheduler always holds the capabilities. So it is reasonable to change HostManager to ignore hosts whose capabilities are "None" since it becomes a rare case; this will make scheduling more reliable. This will achieved by Another patch. Change-Id: If6582765011fd5e1b794bfdc068e17630ba381cb --- nova/compute/manager.py | 4 ++-- nova/compute/rpcapi.py | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'nova/compute') diff --git a/nova/compute/manager.py b/nova/compute/manager.py index dcdf3f148..24a040d7e 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -217,7 +217,7 @@ def _get_image_meta(context, image_ref): class ComputeManager(manager.SchedulerDependentManager): """Manages the running instances from creation to destruction.""" - RPC_API_VERSION = '2.8' + RPC_API_VERSION = '2.9' def __init__(self, compute_driver=None, *args, **kwargs): """Load configuration options and connect to the hypervisor.""" @@ -345,7 +345,7 @@ class ComputeManager(manager.SchedulerDependentManager): self.driver.filter_defer_apply_off() self._report_driver_status(context) - self._publish_service_capabilities(context) + self.publish_service_capabilities(context) def _get_power_state(self, context, instance): """Retrieve the power state for the given instance.""" diff --git a/nova/compute/rpcapi.py b/nova/compute/rpcapi.py index cb1ddede8..38d9b3426 100644 --- a/nova/compute/rpcapi.py +++ b/nova/compute/rpcapi.py @@ -136,6 +136,7 @@ class ComputeAPI(nova.openstack.common.rpc.proxy.RpcProxy): 2.6 - Remove migration_id, add migration to resize_instance 2.7 - Remove migration_id, add migration to confirm_resize 2.8 - Remove migration_id, add migration to finish_resize + 2.9 - Add publish_service_capabilities() ''' # @@ -529,6 +530,9 @@ class ComputeAPI(nova.openstack.common.rpc.proxy.RpcProxy): instance=instance_p), topic=_compute_topic(self.topic, ctxt, None, instance)) + def publish_service_capabilities(self, ctxt): + self.fanout_cast(ctxt, self.make_msg('publish_service_capabilities')) + class SecurityGroupAPI(nova.openstack.common.rpc.proxy.RpcProxy): '''Client side of the security group rpc API. -- cgit