_translate_from_glance() can cause an unnecessary HTTP request

Bug #1275173 reported by Chris Buccella on 2014-02-01
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Low
Chris Buccella
OpenStack Compute (nova)
Low
Chris Buccella
Icehouse
Low
Vish Ishaya

Bug Description

I noticed when performing a "nova image-show" on a current (not deleted) image, two HTTP requests were issued. Why isn't the Image retrieved on the first GET request?

In fact, it is. The problem lies in _extract_attributes(), called by _translate_from_glance(). This function loops through a list of expected attributes, and extracts them from the passed-in Image. The problem is that if the attribute 'deleted' is False, there won't be a 'deleted_at' attribute in the Image. Not finding the attribute results in getattr() making another GET request (to try to find the "missing" attribute?). This is unnecessary of course, since it makes sense for the Image to not have that attribute set.

Chris Buccella (chris-buccella) wrote :
Changed in nova:
assignee: nobody → ChrisBuccella (chris-buccella)
John Garbutt (johngarbutt) wrote :

This is going away, so not too important to fix right now.

Changed in nova:
status: New → In Progress
importance: Undecided → Low
tags: added: image
Chris Buccella (chris-buccella) wrote :

Any further details on "this is going away"? Link to a mailing list post perhaps?

Reviewed: https://review.openstack.org/70518
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=8fcefef5c6db3bb7f182df62de9c5bf986f97303
Submitter: Jenkins
Branch: master

commit 8fcefef5c6db3bb7f182df62de9c5bf986f97303
Author: Chris Buccella <email address hidden>
Date: Sat Feb 1 07:05:11 2014 +0000

    _translate_from_glance() can cause an unnecessary HTTP request

    After returning from a get() call to python-glanceclient, nova runs a
    translation function on the returned Image to get the data it wants. Part of
    this process is checking for an expected set of attributes, one of which is
    the deletion time ('deleted_at'). However, if the image has not been deleted,
    deleted_at key will not exist. This forces another call to glance to occur for
    the same image. A similar problem exists for the checksum attribute, which does
    not exist before an image is active. The fix here is to only consider
    deleted_at and checksum if they are expected to be present.

    Change-Id: I67b7dd16a94fe60d873c012f6bd246ab24500d5a
    Closes-Bug: #1275173

Changed in nova:
status: In Progress → Fix Committed

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

Changed in cinder:
assignee: nobody → Chris Buccella (chris-buccella)
status: New → In Progress

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

commit da13c6285bb0aee55cfbc93f55ce2e2b7d6a28f2
Author: Chris Buccella <email address hidden>
Date: Thu Apr 3 04:02:45 2014 +0000

    _translate_from_glance() can cause an unnecessary HTTP request

    After returning from a get() call to python-glanceclient, cinder runs a
    translation function on the returned Image to get the data it wants. Part of
    this process is checking for an expected set of attributes, one of which is
    the deletion time ('deleted_at'). However, if the image has not been deleted,
    deleted_at key will not exist. This forces another call to glance to occur for
    the same image. A similar problem exists for the checksum attribute, which does
    not exist before an image is active. The fix here is to only consider
    deleted_at and checksum if they are expected to be present.

    This change was made in nova as change I67b7dd16

    Change-Id: Iedc16cb9316f9610fdb8ac03f448bc375a4e6bfa
    Closes-Bug: #1275173

Changed in cinder:
status: In Progress → Fix Committed
Changed in cinder:
milestone: none → icehouse-rc2
Thierry Carrez (ttx) on 2014-04-04
tags: added: icehouse-rc-potential

Reviewed: https://review.openstack.org/85374
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=01e5eac3f251164096051d43d763df72a65d31d3
Submitter: Jenkins
Branch: milestone-proposed

commit 01e5eac3f251164096051d43d763df72a65d31d3
Author: Chris Buccella <email address hidden>
Date: Thu Apr 3 04:02:45 2014 +0000

    _translate_from_glance() can cause an unnecessary HTTP request

    After returning from a get() call to python-glanceclient, cinder runs a
    translation function on the returned Image to get the data it wants. Part of
    this process is checking for an expected set of attributes, one of which is
    the deletion time ('deleted_at'). However, if the image has not been deleted,
    deleted_at key will not exist. This forces another call to glance to occur for
    the same image. A similar problem exists for the checksum attribute, which does
    not exist before an image is active. The fix here is to only consider
    deleted_at and checksum if they are expected to be present.

    This change was made in nova as change I67b7dd16

    Change-Id: Iedc16cb9316f9610fdb8ac03f448bc375a4e6bfa
    Closes-Bug: #1275173
    (cherry picked from commit da13c6285bb0aee55cfbc93f55ce2e2b7d6a28f2)

Changed in cinder:
status: Fix Committed → Fix Released
Changed in cinder:
importance: Undecided → Low
Thierry Carrez (ttx) on 2014-04-17
Changed in cinder:
milestone: icehouse-rc2 → 2014.1
Thierry Carrez (ttx) on 2014-04-17
tags: added: icehouse-backport-potential
removed: icehouse-rc-potential
Thierry Carrez (ttx) on 2014-06-11
Changed in nova:
milestone: none → juno-1
status: Fix Committed → Fix Released

Reviewed: https://review.openstack.org/95958
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=aff80d58bb85f52d33d1562b76dfd6f2c8b025d3
Submitter: Jenkins
Branch: stable/icehouse

commit aff80d58bb85f52d33d1562b76dfd6f2c8b025d3
Author: Chris Buccella <email address hidden>
Date: Sat Feb 1 07:05:11 2014 +0000

    _translate_from_glance() can cause an unnecessary HTTP request

    After returning from a get() call to python-glanceclient, nova runs a
    translation function on the returned Image to get the data it wants. Part of
    this process is checking for an expected set of attributes, one of which is
    the deletion time ('deleted_at'). However, if the image has not been deleted,
    deleted_at key will not exist. This forces another call to glance to occur for
    the same image. A similar problem exists for the checksum attribute, which does
    not exist before an image is active. The fix here is to only consider
    deleted_at and checksum if they are expected to be present.

    Change-Id: I67b7dd16a94fe60d873c012f6bd246ab24500d5a
    Closes-Bug: #1275173
    (cherry picked from commit 8fcefef5c6db3bb7f182df62de9c5bf986f97303)

tags: added: in-stable-icehouse
Thierry Carrez (ttx) on 2014-10-16
Changed in nova:
milestone: juno-1 → 2014.2
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers