Add version to scheduler rpc API.

Part of blueprint versioned-rpc-apis.

One side effect of this change was that nova.scheduler.api was removed
in favor of nova.scheduler.rpcapi.  In this case, the api was just a
direct wrapper around rpc usage.  For other APIs, I've been following
the pattern that the rpcapi module provides the rpc client wrapper, and
if any other client-side logic is needed, that's where an api module is
used.

Change-Id: Ibd0292936f9afc77aeb5d040660bfa857861eed1
This commit is contained in:
Russell Bryant
2012-05-16 16:40:05 -04:00
parent 2b85320d43
commit 6b0697d86c
7 changed files with 203 additions and 89 deletions

View File

@@ -57,7 +57,7 @@ from nova.db import base
from nova import flags
from nova import log as logging
from nova.rpc import dispatcher as rpc_dispatcher
from nova.scheduler import api
from nova.scheduler import rpcapi as scheduler_rpcapi
from nova import version
@@ -202,6 +202,7 @@ class SchedulerDependentManager(Manager):
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)
def update_service_capabilities(self, capabilities):
@@ -213,5 +214,5 @@ class SchedulerDependentManager(Manager):
"""Pass data back to the scheduler at a periodic interval."""
if self.last_capabilities:
LOG.debug(_('Notifying Schedulers of capabilities ...'))
api.update_service_capabilities(context, self.service_name,
self.host, self.last_capabilities)
self.scheduler_rpcapi.update_service_capabilities(context,
self.service_name, self.host, self.last_capabilities)