← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1733551] Re: Stage call returns 500 internal server error when image does not exists

 

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 <akekane@xxxxxxxxxx>
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

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to Glance.
https://bugs.launchpad.net/bugs/1733551

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

Status in Glance:
  Fix Released

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 devstack@g-api.service[19195]: pdict['tenant'] = self.tenant
  Nov 21 10:12:29 devstack devstack@g-api.service[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 devstack@g-api.service[19195]: ERROR glance.api.v2.image_data Traceback (most recent call last):
  Nov 21 10:12:29 devstack devstack@g-api.service[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 devstack@g-api.service[19195]: ERROR glance.api.v2.image_data     image = image_repo.get(image_id)
  Nov 21 10:12:29 devstack devstack@g-api.service[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 devstack@g-api.service[19195]: ERROR glance.api.v2.image_data     image = self.image_repo.get(image_id)
  Nov 21 10:12:29 devstack devstack@g-api.service[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 devstack@g-api.service[19195]: ERROR glance.api.v2.image_data     return self.helper.proxy(self.base.get(item_id))
  Nov 21 10:12:29 devstack devstack@g-api.service[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 devstack@g-api.service[19195]: ERROR glance.api.v2.image_data     image = super(ImageRepoProxy, self).get(image_id)
  Nov 21 10:12:29 devstack devstack@g-api.service[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 devstack@g-api.service[19195]: ERROR glance.api.v2.image_data     return self.helper.proxy(self.base.get(item_id))
  Nov 21 10:12:29 devstack devstack@g-api.service[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 devstack@g-api.service[19195]: ERROR glance.api.v2.image_data     return self.helper.proxy(self.base.get(item_id))
  Nov 21 10:12:29 devstack devstack@g-api.service[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 devstack@g-api.service[19195]: ERROR glance.api.v2.image_data     return self.helper.proxy(self.base.get(item_id))
  Nov 21 10:12:29 devstack devstack@g-api.service[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 devstack@g-api.service[19195]: ERROR glance.api.v2.image_data     raise exception.ImageNotFound(msg)
  Nov 21 10:12:29 devstack devstack@g-api.service[19195]: ERROR glance.api.v2.image_data ImageNotFound: No image found with ID abcd
  Nov 21 10:12:29 devstack devstack@g-api.service[19195]: ERROR glance.api.v2.image_data

To manage notifications about this bug go to:
https://bugs.launchpad.net/glance/+bug/1733551/+subscriptions


References