]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Prevent from bug #1008866 is reverted
authorRongze Zhu <zrzhit@gmail.com>
Sun, 9 Sep 2012 07:35:26 +0000 (15:35 +0800)
committerRongze Zhu <zrzhit@gmail.com>
Sun, 9 Sep 2012 08:17:35 +0000 (16:17 +0800)
Fixes bug #1047841.

Commit 2f5360753308eb8b10581fc3c026c1b66f42ebdc (Adds new volume API
extensions) reverted a part of commit
99456bd690445443ae05c0d4fe1ec43ba6090f6f (Send 'create volume from
snapshot' to the proper host), so bug #1008866 is reproduced. I make
API.create_volume to call _cast_create_volume in cinder/volume/api.py,
it Prevent from bug #1008866 is reverted.

Change-Id: I1bf0b7c5fc47da756bce95128f8fd770d14399b0

cinder/volume/api.py

index 2c1829d71f4b00c932c18bee1f00431c3e8c49eb..0d340bc4aa31527fb0d6c44719a5f29dc32dcb3f 100644 (file)
@@ -164,17 +164,10 @@ class API(base.Base):
             }
 
         volume = self.db.volume_create(context, options)
-        rpc.cast(context,
-                 FLAGS.scheduler_topic,
-                 {"method": "create_volume",
-                  "args": {"topic": FLAGS.volume_topic,
-                           "volume_id": volume['id'],
-                           "snapshot_id": volume['snapshot_id'],
-                           "image_id": image_id}})
+        self._cast_create_volume(context, volume['id'], snapshot_id, image_id)
         return volume
 
-    def _cast_create_volume(self, context, volume_id,
-                            snapshot_id, reservations):
+    def _cast_create_volume(self, context, volume_id, snapshot_id, image_id):
 
         # NOTE(Rongze Zhu): It is a simple solution for bug 1008866
         # If snapshot_id is set, make the call create volume directly to
@@ -192,7 +185,8 @@ class API(base.Base):
                      topic,
                      {"method": "create_volume",
                       "args": {"volume_id": volume_id,
-                               "snapshot_id": snapshot_id}})
+                               "snapshot_id": snapshot_id,
+                               "image_id": image_id}})
         else:
             rpc.cast(context,
                      FLAGS.scheduler_topic,
@@ -200,7 +194,7 @@ class API(base.Base):
                       "args": {"topic": FLAGS.volume_topic,
                                "volume_id": volume_id,
                                "snapshot_id": snapshot_id,
-                               "reservations": reservations}})
+                               "image_id": image_id}})
 
     @wrap_check_policy
     def delete(self, context, volume, force=False):