From: Edward Hope-Morley Date: Wed, 29 May 2013 22:35:32 +0000 (+0100) Subject: Fix incorrect status for volume clone from image X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=427146437570e96d0e64b691150c8d1a3b1ebd87;p=openstack-build%2Fcinder-build.git Fix incorrect status for volume clone from image 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 --- diff --git a/cinder/volume/manager.py b/cinder/volume/manager.py index 5e1397ec2..f465e53ba 100644 --- a/cinder/volume/manager.py +++ b/cinder/volume/manager.py @@ -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,