From: Mike Perez <thingee@gmail.com>
Date: Wed, 25 Sep 2013 03:55:04 +0000 (-0700)
Subject: Pass correct args to vol_rpc create_volume calls
X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=c77868f44b1e72be2b65f697a1f0f3b32126e581;p=openstack-build%2Fcinder-build.git

Pass correct args to vol_rpc create_volume calls

In the chance and simple scheduler, create volume was originally using
snapshot_id and image_id for request_spec and filter_properties. This
corrects that by passing the correct arguments and keyword arguments to
create_volume.

Change-Id: Icbcfbfb28f36e1f75519bf5ad6fcbcc12a9b4ec1
Closes-Bug: #1212710
---

diff --git a/cinder/scheduler/chance.py b/cinder/scheduler/chance.py
index 0b9a4dac6..0cc4e760a 100644
--- a/cinder/scheduler/chance.py
+++ b/cinder/scheduler/chance.py
@@ -76,7 +76,9 @@ class ChanceScheduler(driver.Scheduler):
 
         updated_volume = driver.volume_update_db(context, volume_id, host)
         self.volume_rpcapi.create_volume(context, updated_volume, host,
-                                         snapshot_id, image_id)
+                                         request_spec, filter_properties,
+                                         snapshot_id=snapshot_id,
+                                         image_id=image_id)
 
     def host_passes_filters(self, context, host, request_spec,
                             filter_properties):
diff --git a/cinder/scheduler/simple.py b/cinder/scheduler/simple.py
index 5329d6fd7..1ab48053e 100644
--- a/cinder/scheduler/simple.py
+++ b/cinder/scheduler/simple.py
@@ -62,11 +62,10 @@ class SimpleScheduler(chance.ChanceScheduler):
             if not utils.service_is_up(service):
                 raise exception.WillNotSchedule(host=host)
             updated_volume = driver.volume_update_db(context, volume_id, host)
-            self.volume_rpcapi.create_volume(context,
-                                             updated_volume,
-                                             host,
-                                             snapshot_id,
-                                             image_id)
+            self.volume_rpcapi.create_volume(context, updated_volume, host,
+                                             request_spec, filter_properties,
+                                             snapshot_id=snapshot_id,
+                                             image_id=image_id)
             return None
 
         results = db.service_get_all_volume_sorted(elevated)
@@ -81,11 +80,11 @@ class SimpleScheduler(chance.ChanceScheduler):
             if utils.service_is_up(service) and not service['disabled']:
                 updated_volume = driver.volume_update_db(context, volume_id,
                                                          service['host'])
-                self.volume_rpcapi.create_volume(context,
-                                                 updated_volume,
-                                                 service['host'],
-                                                 snapshot_id,
-                                                 image_id)
+                self.volume_rpcapi.create_volume(context, updated_volume,
+                                                 service['host'], request_spec,
+                                                 filter_properties,
+                                                 snapshot_id=snapshot_id,
+                                                 image_id=image_id)
                 return None
         msg = _("Is the appropriate service running?")
         raise exception.NoValidHost(reason=msg)