Add version to scheduler rpc API.

Part of blueprint versioned-rpc-apis.

One side effect of this change was that cinder.scheduler.api was removed
in favor of cinder.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
committed by Mark McLoughlin
parent ec6e9e4fde
commit 863b6afe12
6 changed files with 192 additions and 76 deletions

View File

@@ -47,6 +47,8 @@ FLAGS.register_opt(scheduler_driver_opt)
class SchedulerManager(manager.Manager):
"""Chooses a host to run instances on."""
RPC_API_VERSION = '1.0'
def __init__(self, scheduler_driver=None, *args, **kwargs):
if not scheduler_driver:
scheduler_driver = FLAGS.scheduler_driver
@@ -55,6 +57,9 @@ class SchedulerManager(manager.Manager):
def __getattr__(self, key):
"""Converts all method calls to use the schedule method"""
# NOTE(russellb) Because of what this is doing, we must be careful
# when changing the API of the scheduler drivers, as that changes
# the rpc API as well, and the version should be updated accordingly.
return functools.partial(self._schedule, key)
def get_host_list(self, context):