Volume_Attachment_ID uses Volume_ID

Bug #1480131 reported by Maurice Escher
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Won't Fix
Wishlist
Wenzhi Yu
OpenStack Dashboard (Horizon)
Won't Fix
Undecided
Unassigned

Bug Description

Version: Kilo Stable

Problem Description: querying nova for volume attachments returns the wrong volume_attachment_id.
I receive the volume_id instead of the volume_attachment_id.

Example:

curl -g -H "X-Auth-Token: $ADMIN_TOKEN" -X GET https://compute:8774/v2/(tenant_id)/servers/56293904-9384-48f8-9329-c961056583f1/os-volume_attachments

{"volumeAttachments": [{"device": "/dev/vdb", "serverId": "56293904-9384-48f8-9329-c961056583f1", "id": "a75bec42-77b5-42ff-90e5-e505af14b84a", "volumeId": "a75bec42-77b5-42ff-90e5-e505af14b84a"}]}

Having a look at the database directly, I see the real volume_attachment_id:

select (id, volume_id, instance_uuid) from volume_attachment where volume_id='a75bec42-77b5-42ff-90e5-e505af14b84a';

(9cb82021-e77e-495f-8ade-524bc5ccf68c,a75bec42-77b5-42ff-90e5-e505af14b84a,56293904-9384-48f8-9329-c961056583f1)

Cinder API gets it right, though.

Further Impact:
Horizon uses the returned volume_attachment_id to query for volume_details.
That is wrong and only works now because of the broken nova behaviour.

Tags: api volumes
Revision history for this message
Davanum Srinivas (DIMS) (dims-v) wrote :

Cinder API gets it right *because* "volume_attachment" is a cinder table :) right?

Changed in nova:
status: New → Incomplete
Revision history for this message
Markus Zoeller (markus_z) (mzoeller) wrote :

This would have impact on the documentation too. Currently the apiref [1] also shows two identical UUIDs for "id" and "volumeId".

[1] http://developer.openstack.org/api-ref-compute-v2-ext.html#listVolumeAttachments

tags: added: api volumes
Revision history for this message
Zhihai Song (szhsong) wrote :

The 'id' in the block_device_mapping table is sequential numbers, not some randomly generated uuid. Where will this 'id' be used?
However, os-volume_attachments shouldn't return the volume_id in the place of 'id'.

Changed in nova:
status: Incomplete → Confirmed
Park (jianlonghei)
Changed in nova:
assignee: nobody → Park (jianlonghei)
Wenzhi Yu (yuywz)
Changed in nova:
assignee: Park (jianlonghei) → Wen Zhi Yu (yuywz)
Revision history for this message
Matt Riedemann (mriedem) wrote :

It looks like this is intentional:

https://github.com/openstack/nova/blob/master/nova/api/openstack/compute/volumes.py#L203

That might just be from the create call though, since the attach is async the response in the POST is the volume_id since we don't know the attachment ID. We should be able to know that in the GET though.

Revision history for this message
Matt Riedemann (mriedem) wrote :

In the case of GET, nova-api only gets the block_device_mapping information for the given instance and volume, it doesn't actually call off to cinder to get the attachment information:

https://github.com/openstack/nova/blob/master/nova/api/openstack/compute/volumes.py#L264

So the only way to know the attachment ID is if it's stored in the BlockDeviceMapping object. And we don't have the attachment_id in the BDM object today:

https://github.com/openstack/nova/blob/master/nova/objects/block_device.py#L63

That's not to say it couldn't be added, but it'd be an objects version change and an API change to show it - so this would require a microversion for the nova API and requires a blueprint and spec.

Changed in nova:
importance: Undecided → Wishlist
Revision history for this message
Matt Riedemann (mriedem) wrote :

Given our policy on no more API proxies to other services, I'm inclined to mark this as 'won't fix':

http://docs.openstack.org/developer/nova/project_scope.html#no-more-api-proxies

You can get the attachment id from the volume API.

Changed in nova:
status: Confirmed → Won't Fix
Revision history for this message
Wenzhi Yu (yuywz) wrote :

Hi Matt,

I think using volume.id as volume_attachment.id will make confusion, especially for cloud admin. I agree on "no more API proxies to other services" but return a "wrong" value in API response can't be appropriate(even leave the 'id' field as None seems to be more reasonable to me).

I've drafted a spec for this bug, please review:
https://review.openstack.org/#/c/214021/

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on nova-specs (master)

Change abandoned by John Garbutt (<email address hidden>) on branch: master
Review: https://review.openstack.org/214021
Reason: This one seems suck, please use the usual channels to resolve that.

Changed in horizon:
status: New → Won't Fix
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.