Glance locations don't check for duplicates

Bug #1251244 reported by Flavio Percoco
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Fix Released
Medium
Flavio Percoco

Bug Description

When setting image locations, Glange allows users to set the same location once. Instead it should verify that the combination of location+metadata does not exist already.

Steps to Reproduce:
1. configure the multiple location in glance
2. create an image.
3. add the same location twice (run the same command): curl -i -X PATCH -H 'Content-Type: application/openstack-images-v2.1-json-patch' -H "X-Auth-Token: $AUTH" http://localhost:9292/v2/images/<image_id> -d '[{"op": "add", "path": "/locations/1", "value": {"url": "<image url>", "metadata": {}}}]'

Actual results:
| locations | [{u'url': u'http://mirrors.usc.edu/pub/linux/distributions/fedora/linux/releases/19/Live/x86_64/Fedora-Live-Desktop-x86_64-19-1.iso', u'metadata': {}}, {u'url': u'http://mirrors.usc.edu/pub/linux/distributions/fedora/linux/releases/19/Live/x86_64/Fedora-Live-Desktop-x86_64-19-1.iso', u'metadata': {}}] |

Changed in glance:
assignee: nobody → Flavio Percoco (flaper87)
importance: Undecided → Low
importance: Low → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (master)

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

Changed in glance:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (master)

Reviewed: https://review.openstack.org/56663
Committed: http://github.com/openstack/glance/commit/b3849a9cc94212215898adc3d0127565220287a5
Submitter: Jenkins
Branch: master

commit b3849a9cc94212215898adc3d0127565220287a5
Author: Flavio Percoco <email address hidden>
Date: Fri Nov 15 18:04:08 2013 +0100

    Verify for duplicate location+metadata instances

    Glance allow users to have duplicated locations for the same image. This
    could led to some confusion and bad UX. This patch introduces such check
    in the insert method and makes both extend and append use it to add new
    images.

    The patch also adds a new exception - DuplicateLocation - and handles it
    in the v2 of the API. When `DuplicateLocation` is raised, a BadRequest
    will be returned back to the client.

    A new test for this functionality was added as well.

    Change-Id: I32400d467408e3d56bbbdbb3379357f2ee812e56
    Closes-bug: 1251244

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