_extract_amp_image_id_by_tag should return the last created image

Bug #1618921 reported by Nir Magnezi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
octavia
Fix Released
Undecided
Nir Magnezi

Bug Description

_extract_amp_image_id_by_tag[1] should always return the last created image id,with the 'amphora' tag, (more about this subject: http://docs.openstack.org/developer/octavia/specs/version1/use_glance_tag_to_refer_to_image.html) but it won't.
The reason is that the glance client returns an unsorted list.

for the sort='created_at' to work we should also provide a sorting direction.
Since we take the last element from the image we should use asc.

[1] https://github.com/openstack/octavia/blob/08570831754d9671fbd1756d668f55f191e47ca4/octavia/compute/drivers/nova_driver.py#L35
[2] https://github.com/openstack/octavia/blob/08570831754d9671fbd1756d668f55f191e47ca4/octavia/compute/drivers/nova_driver.py#L36-L38
[3] https://github.com/openstack/octavia/blob/08570831754d9671fbd1756d668f55f191e47ca4/octavia/compute/drivers/nova_driver.py#L41

Nir Magnezi (nmagnezi)
Changed in octavia:
assignee: nobody → Nir Magnezi (nmagnezi)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to octavia (master)

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

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

Reviewed: https://review.openstack.org/363713
Committed: https://git.openstack.org/cgit/openstack/octavia/commit/?id=c4017ae41385caac294405a2d48b31153408433b
Submitter: Jenkins
Branch: master

commit c4017ae41385caac294405a2d48b31153408433b
Author: Nir Magnezi <email address hidden>
Date: Wed Aug 31 17:22:18 2016 +0300

    _extract_amp_image_id_by_tag should return last created image

    _extract_amp_image_id_by_tag should always return the last created
    image_id, with the amp_image_tag ("amphora" by default), but it won't.

    For the sort='created_at' to work, we should use 'desc' as sorting
    direction and take the first element from the images list.

    In addition, we now limit the length of the returned images list to 2.
    The reason is that we don't need the whole list in order to warn the
    system administrator that more than one image has the amp_image_tag.

    Closes-Bug #1618921

    Change-Id: Ic36213962cf38b032c2d1d8a2ee4abebab3dd82f

Changed in octavia:
status: In Progress → Fix Released
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.