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
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,