]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Fix incorrect status for volume clone from image
authorEdward Hope-Morley <edward.hope-morley@canonical.com>
Wed, 29 May 2013 22:35:32 +0000 (23:35 +0100)
committerEdward Hope-Morley <edward.hope-morley@canonical.com>
Thu, 30 May 2013 12:47:05 +0000 (13:47 +0100)
If, when using a Ceph as a backend for Cinder and Glance, you
create a volume from a Glance image, the request is actioned
in one of two ways; (1) if Glance does not supply sufficient
information to Cinder, a full copy is made of the Glance
image or (2) Ceph uses it's copy-on-write capability to do a
clone. If a full copy is done, the volume is marked as
Bootable=True but if a clone is done it is not.

This does not appear to break nova boot from volume at present
but the status displayed by the cinder client is incorrect.

Change-Id: I2959fc3dfaf0e073781583019797bcd44f7789d6
Fixes: bug 1185533
cinder/volume/manager.py

index 5e1397ec29cb06f132ca7f80d75288826680f2b8..f465e53ba1780c942afab50f082fbbaa440f95d3 100644 (file)
@@ -296,23 +296,22 @@ class VolumeManager(manager.SchedulerDependentManager):
                                                           volume_ref['id'],
                                                           snapshot_id)
 
-        if image_id and not cloned:
-            if image_meta:
-                # Copy all of the Glance image properties to the
-                # volume_glance_metadata table for future reference.
+        if image_id and image_meta:
+            # Copy all of the Glance image properties to the
+            # volume_glance_metadata table for future reference.
+            self.db.volume_glance_metadata_create(context,
+                                                  volume_ref['id'],
+                                                  'image_id', image_id)
+            name = image_meta.get('name', None)
+            if name:
                 self.db.volume_glance_metadata_create(context,
                                                       volume_ref['id'],
-                                                      'image_id', image_id)
-                name = image_meta.get('name', None)
-                if name:
-                    self.db.volume_glance_metadata_create(context,
-                                                          volume_ref['id'],
-                                                          'image_name', name)
-                image_properties = image_meta.get('properties', {})
-                for key, value in image_properties.items():
-                    self.db.volume_glance_metadata_create(context,
-                                                          volume_ref['id'],
-                                                          key, value)
+                                                      'image_name', name)
+            image_properties = image_meta.get('properties', {})
+            for key, value in image_properties.items():
+                self.db.volume_glance_metadata_create(context,
+                                                      volume_ref['id'],
+                                                      key, value)
 
         now = timeutils.utcnow()
         self.db.volume_update(context,