]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Pass in correct volume_ref to create_from_snapshot.
authorJohn Griffith <john.griffith@solidfire.com>
Tue, 20 Nov 2012 00:50:27 +0000 (00:50 +0000)
committerJohn Griffith <john.griffith@solidfire.com>
Tue, 20 Nov 2012 00:52:38 +0000 (00:52 +0000)
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

cinder/volume/api.py

index faed8a35b841065b86a7157cb4aad87fa8d89d33..627f17b3567a67aa7634db80510447493e77aa00 100644 (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)