Pass in correct volume_ref to create_from_snapshot.

The new rpc versioning change introduced a bug in the
create_from_snapshot code.  The originating volume_ref
was being passed in instead of the newly created volume_ref
as expected.

Fixes bug 1080898

Change-Id: I6ba4f4989c77e29685abb2649af8e003c447ab0f
This commit is contained in:
John Griffith
2012-11-20 00:50:27 +00:00
parent a8f8381777
commit 55c09da1b0

View File

@@ -199,7 +199,6 @@ class API(base.Base):
# If snapshot_id is set, make the call create volume directly to
# the volume host where the snapshot resides instead of passing it
# through the scheduler. So snapshot can be copy to new volume.
volume_id = request_spec['volume_id']
snapshot_id = request_spec['snapshot_id']
image_id = request_spec['image_id']
@@ -208,9 +207,11 @@ class API(base.Base):
snapshot_ref = self.db.snapshot_get(context, snapshot_id)
src_volume_ref = self.db.volume_get(context,
snapshot_ref['volume_id'])
volume_ref = self.db.volume_get(context,
volume_id)
# bypass scheduler and send request directly to volume
self.volume_rpcapi.create_volume(context,
src_volume_ref,
volume_ref,
src_volume_ref['host'],
snapshot_id,
image_id)