Stage call returns 500 internal server error when image does not exists

Bug #1733551 reported by Abhishek Kekane
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Fix Released
High
Abhishek Kekane

Bug Description

If user tries to stage data to unexisting image then it fails with 500 internal server error.

Ideally it should return 404 HTTNotFound error to the user.

Steps to reproduce:

1. Run image-stage with any random id command
   $ glance image-stage abcd --file <file_name>

Output:
500 Internal Server Error: The server has either erred or is incapable of performing the requested operation. (HTTP 500)

Glance API logs:

Nov 21 10:12:29 devstack <email address hidden>[19195]: pdict['tenant'] = self.tenant
Nov 21 10:12:29 devstack <email address hidden>[19195]: ERROR glance.api.v2.image_data [None req-99abd47d-7c74-43ad-a92e-abf01d97f4c4 admin admin] Failed to stage image data due to internal error: ImageNotFound: No image found with ID abcd
Nov 21 10:12:29 devstack <email address hidden>[19195]: ERROR glance.api.v2.image_data Traceback (most recent call last):
Nov 21 10:12:29 devstack <email address hidden>[19195]: ERROR glance.api.v2.image_data File "/opt/stack/glance/glance/api/v2/image_data.py", line 298, in stage
Nov 21 10:12:29 devstack <email address hidden>[19195]: ERROR glance.api.v2.image_data image = image_repo.get(image_id)
Nov 21 10:12:29 devstack <email address hidden>[19195]: ERROR glance.api.v2.image_data File "/opt/stack/glance/glance/api/authorization.py", line 107, in get
Nov 21 10:12:29 devstack <email address hidden>[19195]: ERROR glance.api.v2.image_data image = self.image_repo.get(image_id)
Nov 21 10:12:29 devstack <email address hidden>[19195]: ERROR glance.api.v2.image_data File "/opt/stack/glance/glance/domain/proxy.py", line 86, in get
Nov 21 10:12:29 devstack <email address hidden>[19195]: ERROR glance.api.v2.image_data return self.helper.proxy(self.base.get(item_id))
Nov 21 10:12:29 devstack <email address hidden>[19195]: ERROR glance.api.v2.image_data File "/opt/stack/glance/glance/api/policy.py", line 105, in get
Nov 21 10:12:29 devstack <email address hidden>[19195]: ERROR glance.api.v2.image_data image = super(ImageRepoProxy, self).get(image_id)
Nov 21 10:12:29 devstack <email address hidden>[19195]: ERROR glance.api.v2.image_data File "/opt/stack/glance/glance/domain/proxy.py", line 86, in get
Nov 21 10:12:29 devstack <email address hidden>[19195]: ERROR glance.api.v2.image_data return self.helper.proxy(self.base.get(item_id))
Nov 21 10:12:29 devstack <email address hidden>[19195]: ERROR glance.api.v2.image_data File "/opt/stack/glance/glance/domain/proxy.py", line 86, in get
Nov 21 10:12:29 devstack <email address hidden>[19195]: ERROR glance.api.v2.image_data return self.helper.proxy(self.base.get(item_id))
Nov 21 10:12:29 devstack <email address hidden>[19195]: ERROR glance.api.v2.image_data File "/opt/stack/glance/glance/domain/proxy.py", line 86, in get
Nov 21 10:12:29 devstack <email address hidden>[19195]: ERROR glance.api.v2.image_data return self.helper.proxy(self.base.get(item_id))
Nov 21 10:12:29 devstack <email address hidden>[19195]: ERROR glance.api.v2.image_data File "/opt/stack/glance/glance/db/__init__.py", line 89, in get
Nov 21 10:12:29 devstack <email address hidden>[19195]: ERROR glance.api.v2.image_data raise exception.ImageNotFound(msg)
Nov 21 10:12:29 devstack <email address hidden>[19195]: ERROR glance.api.v2.image_data ImageNotFound: No image found with ID abcd
Nov 21 10:12:29 devstack <email address hidden>[19195]: ERROR glance.api.v2.image_data

Changed in glance:
assignee: nobody → Abhishek Kekane (abhishek-kekane)
description: updated
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/521806

Changed in glance:
status: New → In Progress
Changed in glance:
importance: Undecided → High
milestone: none → queens-2
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (master)

Reviewed: https://review.openstack.org/521806
Committed: https://git.openstack.org/cgit/openstack/glance/commit/?id=7a67c4355bf098c84f4b6cc13326f2c05fffab7e
Submitter: Zuul
Branch: master

commit 7a67c4355bf098c84f4b6cc13326f2c05fffab7e
Author: Abhishek Kekane <email address hidden>
Date: Tue Nov 21 10:48:59 2017 +0000

    Fix 500 from stage call on non-existing image

    If user tries to stage data to unexisting image then it fails with 500
    internal server error.

    Caught NotFound exception and raised HTTPNotFound to return 404
    response to the user.

    Change-Id: I78d252fceb9a5537135f0c238c4ad2ba52fdda7c
    Closes-Bug: #1733551

Changed in glance:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/glance 16.0.0.0b2

This issue was fixed in the openstack/glance 16.0.0.0b2 development milestone.

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.