Prevent from bug #1008866 is reverted

Fixes bug #1047841.

Commit 2f53607533 (Adds new volume API
extensions) reverted a part of commit
99456bd690 (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
This commit is contained in:
Rongze Zhu
2012-09-09 15:35:26 +08:00
parent 43bc69336b
commit 3eaf43a9f5

View 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):