Skip to content

Commit

Permalink
Save some more image attributes to volume_glance_metadata.
Browse files Browse the repository at this point in the history
Current issue: When copying an image to a volume, attributes like size, disk_format, container_format,
checksum, min_disk and min_ram have not been copied so far. When booting a VM from a volume, we are
not able to check these atrributes without giving the image id. Furthermore, if the original
image is deleted, we will lose all the information.

This patch saves these attributes into volume_glance_metadata. We can still check these attributes
without giving the image id when booting a VM from a volume.

Fixed Bug 1159824.

Change-Id: I42ce676026d32be6e3f4bec6fd269908e2df0a8c
  • Loading branch information
Vincent Hou committed Jun 27, 2013
1 parent 35c8643 commit 4ef5eab
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cinder/volume/manager.py
Expand Up @@ -323,6 +323,16 @@ def create_volume(self, context, volume_id, request_spec=None,
self.db.volume_glance_metadata_create(context,
volume_ref['id'],
'image_name', name)
# Save some more attributes into the volume metadata
IMAGE_ATTRIBUTES = ['size', 'disk_format',
'container_format', 'checksum',
'min_disk', 'min_ram']
for key in IMAGE_ATTRIBUTES:
value = image_meta.get(key, None)
if value is not None:
self.db.volume_glance_metadata_create(context,
volume_ref['id'],
key, value)
image_properties = image_meta.get('properties', {})
for key, value in image_properties.items():
self.db.volume_glance_metadata_create(context,
Expand Down

0 comments on commit 4ef5eab

Please sign in to comment.