Skip to content

Commit

Permalink
Update scheduler rpc API version.
Browse files Browse the repository at this point in the history
Commit de09c18 updated the scheduler
rpc API but did not account for rpc API versioning.  This patch fixes it
up.  It updates the manager to reflect that it implements '2.1' and is
now backwards compatible with the old method signature.  The client side
rpcapi now indicates that it requires '2.1' when sending the new
image_id argument.

Fix bug 1052670.

Change-Id: Ide541f38d3d0129809da56baffe95bc3faab0569
  • Loading branch information
russellb committed Sep 18, 2012
1 parent 1b1fae7 commit fe916c9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions nova/scheduler/manager.py
Expand Up @@ -53,7 +53,7 @@
class SchedulerManager(manager.Manager):
"""Chooses a host to run instances on."""

RPC_API_VERSION = '2.0'
RPC_API_VERSION = '2.1'

def __init__(self, scheduler_driver=None, *args, **kwargs):
if not scheduler_driver:
Expand All @@ -69,8 +69,8 @@ def update_service_capabilities(self, context, service_name,
self.driver.update_service_capabilities(service_name, host,
capabilities)

def create_volume(self, context, volume_id, snapshot_id, image_id,
reservations):
def create_volume(self, context, volume_id, snapshot_id,
reservations, image_id=None):
try:
self.driver.schedule_create_volume(
context, volume_id, snapshot_id, image_id, reservations)
Expand Down
4 changes: 3 additions & 1 deletion nova/scheduler/rpcapi.py
Expand Up @@ -44,6 +44,7 @@ class SchedulerAPI(nova.openstack.common.rpc.proxy.RpcProxy):
1.7 - Add create_volume() method, remove topic from live_migration()
2.0 - Remove 1.x backwards compat
2.1 - Add image_id to create_volume()
'''

#
Expand Down Expand Up @@ -98,7 +99,8 @@ def create_volume(self, ctxt, volume_id, snapshot_id, image_id,
self.cast(ctxt,
self.make_msg('create_volume',
volume_id=volume_id, snapshot_id=snapshot_id,
image_id=image_id, reservations=reservations))
image_id=image_id, reservations=reservations),
version='2.1')

def update_service_capabilities(self, ctxt, service_name, host,
capabilities):
Expand Down
2 changes: 1 addition & 1 deletion nova/tests/scheduler/test_rpcapi.py
Expand Up @@ -95,4 +95,4 @@ def test_create_volume(self):
self._test_scheduler_api('create_volume',
rpc_method='cast', volume_id="fake_volume",
snapshot_id="fake_snapshots", image_id="fake_image",
reservations=list('fake_res'))
reservations=list('fake_res'), version='2.1')

0 comments on commit fe916c9

Please sign in to comment.