glance v1 and v2 image-show api are not compatible

Bug #1582052 reported by YaoZheng_ZTE
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Cinder
Invalid
Low
YaoZheng_ZTE

Bug Description

The V1 image-show interface returns the following format:
<Image {u'status': u'active', u'name': u'test_ks_instance_snapshot', u'deleted': False, u'created_at': u'2016-03-23T02:45:48', u'updated_at': u'2016-03-23T02:45:48', u'id': u'79d3f61c-42dd-46e1-93b8-a15abbabac14', u'min_disk': 0, u'protected': False, u'min_ram': 0, u'owner': u'2c0303c32fc048b694f61266107a2ecb', u'is_public': False, 'properties': {u'block_device_mapping': u'[{"guest_format": null, "boot_index": 0, "no_device": null, "snapshot_id": "fa069837-0e2a-4e02-99ec-33d7cc56c2b8", "delete_on_termination": null, "disk_bus": "virtio", "image_id": null, "source_type": "snapshot", "device_type": "disk", "volume_id": null, "destination_type": "volume", "volume_size": null}]', u'checksum': u'd651988efba567833ef9ae57082b4495', u'min_ram': u'0', u'disk_format': u'qcow2', u'image_name': u'cirros', u'bdm_v2': u'True', u'image_id': u'c825e5ba-4a64-4e30-87ab-b8742c8b2121', u'root_device_name': u'/dev/vda', u'container_format': u'bare', u'min_disk': u'0', u'size': u'15400960'}, u'size': 0}>

The V2 image-show interface returns the following format:
{u'status': u'active', u'tags': [], u'container_format': None, u'min_ram': 0, u'updated_at': u'2016-05-10T11:17:10Z', u'visibility': u'private', u'image_name': u'test_cirros', u'image_id': u'498cc673-7c95-4883-9df7-6850deb8168f', u'file': u'/v2/images/c6b906d0-a22e-4d8f-83e6-b54e887d3335/file', u'owner': u'55bbe36a87af48c0af04c9204a49a854', u'virtual_size': None, u'id': u'c6b906d0-a22e-4d8f-83e6-b54e887d3335', u'size': 0, u'min_disk': 0, u'name': u'test_snapshot_zy', u'checksum': None, u'created_at': u'2016-05-10T11:17:10Z', u'block_device_mapping': u'[{"guest_format": null, "boot_index": 0, "no_device": null, "snapshot_id": "55581528-cb88-4e5a-bee4-d3bb267a93cc", "delete_on_termination": null, "disk_bus": "virtio", "image_id": null, "source_type": "snapshot", "device_type": "disk", "volume_id": null, "destination_type": "volume", "volume_size": null}, {"guest_format": null, "boot_index": null, "no_device": null, "snapshot_id": "9fcbc64c-1ebc-43d7-b899-6c7a42093697", "delete_on_termination": null, "disk_bus": null, "image_id": null, "source_type": "snapshot", "device_type": null, "volume_id": null, "destination_type": "volume", "volume_size": null}]', u'disk_format': None, u'bdm_v2': u'True', u'protected': False, u'root_device_name': u'/dev/vda', u'schema': u'/v2/schemas/image'}

In V1, 'block_device_mapping' as a key of 'properties'. But There is no 'properties' in V2.
So, the cinder and the nova don't Parse 'block_device_mapping'the attribute.

Changed in glance:
assignee: nobody → YaoZheng_ZTE (zheng-yao1)
Revision history for this message
wangxiyuan (wangxiyuan) wrote :

Could you describe the problem you meet in Nova or Cinder? ASAIK, Nova or Cinder deal with Glance in different ways between v1 and v2.

Revision history for this message
YaoZheng_ZTE (zheng-yao1) wrote :

Hi xiyuan:
   In cinder, the user can config use glance-api V1 or V2. cinder.conf has a config item "glance_api_version". cinder parse the metadata as the V1 format. When use glance_api_version = 2, cinder cannot get 'properties' key. So, cinder can not parse the metadata.

Revision history for this message
wangxiyuan (wangxiyuan) wrote :

hmm, I got your problem. It's the different between v1 and v2 in glance. But we could not fix it in glance IMO, for that it will break the Glance's API response body which will break the backward compatibility(This kind of response format has last for many cycles).

I suggest you to fix it in Cinder. In cinder when you get the image's information, you should make sure it's the old one(v1) or the new one(v2).

affects: glance → cinder
tags: added: glance-api
Wenjun Wang (wangwenjun)
Changed in cinder:
status: New → Confirmed
importance: Undecided → Low
Matt Smith (mss-4)
tags: added: bugsmash
Revision history for this message
wangxiyuan (wangxiyuan) wrote :

Is there any influence for Cinder or Nova now? What's the bug behavior for Cinder or Nova?

Revision history for this message
Sean McGinnis (sean-mcginnis) wrote :

I know we have conditional handling in Cinder, at least in some places. Is there a specific place you are seeing this not handled correctly?

Changed in cinder:
status: Confirmed → Incomplete
Revision history for this message
Sean McGinnis (sean-mcginnis) wrote :

Glance v1 has now been removed, so this is no longer needed.

Changed in cinder:
status: Incomplete → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.