From 3eaf43a9f5a26a51a89347cffe39bfae2b12c2d6 Mon Sep 17 00:00:00 2001 From: Rongze Zhu Date: Sun, 9 Sep 2012 15:35:26 +0800 Subject: [PATCH] Prevent from bug #1008866 is reverted 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 | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/cinder/volume/api.py b/cinder/volume/api.py index 2c1829d71..0d340bc4a 100644 --- a/cinder/volume/api.py +++ b/cinder/volume/api.py @@ -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): -- 2.45.2