From d042340832fa121bdae8e276a73f89e56c0b5fa1 Mon Sep 17 00:00:00 2001 From: wangxiyuan Date: Wed, 1 Mar 2017 14:30:27 +0800 Subject: [PATCH] Check "kernel_id", "ramdisk_id" for Glance v2 only kernel_id and ramdisk_id are stored as the image's standalone fields with Glance V2. But they are contained in the images'properties already with Glance V1. After the change[1], the "_extract_attributes" is used for Glance V1 only. So if use Glance V1, Cinder don't need to get them again. The test cases is covered by the change[1] already. [1]: Ib54bb6759b27334294fb2c6d2c0bfe4eae3d0920 Closes-bug: #1669662 Change-Id: Ifa32fefa29c6629cd7f7aa40eaf8b0df4828c413 --- cinder/image/glance.py | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/cinder/image/glance.py b/cinder/image/glance.py index 122ed159d3b..88ccb8aacf9 100644 --- a/cinder/image/glance.py +++ b/cinder/image/glance.py @@ -562,17 +562,6 @@ def _extract_attributes(image): output['properties'] = getattr(image, 'properties', {}) - # NOTE(jbernard): Update image properties for API version 2. For UEC - # images stored in glance, the necessary boot information is stored in the - # properties dict in version 1 so there is nothing more to do. However, in - # version 2 these are standalone fields in the GET response. This bit of - # code moves them back into the properties dict as the caller expects, thus - # producing a volume with correct metadata for booting. - for attr in ('kernel_id', 'ramdisk_id'): - value = getattr(image, attr, None) - if value: - output['properties'][attr] = value - return output