Inconsistent naming for image reference in create volume API

Bug #1375867 reported by Shaunak Kashyap
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
Wishlist
Pascal Wehrle

Bug Description

The request for the Create Volume API can take a property named "imageRef" that specifies the ID of the image to be used when creating the volume. The name of this property ("imageRef") is inconsistent in two ways:

1. All the other multi-word request properties to this API use snake case (e.g. "volume_type", "snapshot_id", "source_volid", "availability_name", "display_name", and "display_description").

2. The corresponding property in the same API's response is named "image_id".

This affects v1 and v2 of the Cinder API.

description: updated
description: updated
Revision history for this message
Mike Perez (thingee) wrote :

At this point it's too late to change it. Not sure how others feel with adding image_id as an alternative key for this now to v2.

Mike Perez (thingee)
tags: added: api
Changed in cinder:
importance: Undecided → Wishlist
Revision history for this message
Duncan Thomas (duncan-thomas) wrote :

Accepting either (changing the documentation to suggest using the snake-case version?) but accepting the old version seems reasonable. Need to make sure any json schema we produce lists both as supported.

Mike Perez (thingee)
tags: added: low-hanging-fruit
Changed in cinder:
assignee: nobody → Mike Mason (mikemason010)
Changed in cinder:
assignee: Mike Mason (mikemason010) → nobody
Revision history for this message
John Griffith (john-griffith) wrote :

FWIW, if someone looks at changing this, I've always thought it would be great if we changed this from "image_id" to just "image" which would also align with Nova.

This would of course require maintaining backward compatibility which should be trivial.

Changed in cinder:
assignee: nobody → Carol Bouchard (caboucha)
Changed in cinder:
assignee: Carol Bouchard (caboucha) → nobody
Revision history for this message
Pascal Wehrle (p-wehrle) wrote :

Will have a shot at the OpenStack Upstream Training (https://wiki.openstack.org/wiki/OpenStack_Upstream_Training/Info).

Changed in cinder:
assignee: nobody → Pascal Wehrle (p-wehrle)
Pascal Wehrle (p-wehrle)
Changed in cinder:
status: New → In Progress
Pascal Wehrle (p-wehrle)
Changed in cinder:
status: In Progress → Confirmed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on cinder (master)

Change abandoned by Pascal Wehrle (<email address hidden>) on branch: master
Review: https://review.openstack.org/133340
Reason: link to bug report not working

Changed in cinder:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (master)

Fix proposed to branch: master
Review: https://review.openstack.org/133383

Revision history for this message
Pascal Wehrle (p-wehrle) wrote :

@john-griffith The above fix does not include accepting "image" instead of "imageRef". It could be added using the same method but that would still leave the response property at "image_id" and add another set of unit tests. I'd be open to contribute a separate patch for that.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (master)

Reviewed: https://review.openstack.org/133383
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=b65d678f4d475a62f9a83f96bddbeb6f694d1e5b
Submitter: Jenkins
Branch: master

commit b65d678f4d475a62f9a83f96bddbeb6f694d1e5b
Author: Pascal Wehrle <email address hidden>
Date: Mon Nov 17 23:20:17 2014 +0100

    allow image_id for imageRef in create volume API v2

    The create volume request for the V2 API has a property named
    "imageRef" with the ID of the image to be used when creating the
    volume.
    The name of this property is inconsistent as all multi word
    properties use snake case and the property in the reponse is named
    "image_id".

    This adds support for aliasing the imageRef key with image_id when
    creating a volume in v2 of the Cinder API in a backward-compatible
    way.

    Change-Id: I85a5c6734ba05a8a7ea9eff3f849d12fb3d167fb
    Closes-Bug: 1375867

Changed in cinder:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in cinder:
milestone: none → kilo-1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in cinder:
milestone: kilo-1 → 2015.1.0
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.