handle ImageNotAuthorized in API layer

Bug #1646829 reported by jichenjc
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
jichenjc
Newton
Fix Committed
Medium
Lee Yarwood

Bug Description

a image is not authoried will lead to deploy have this error:

2016-12-02 13:20:33.422 8679 ERROR nova.api.openstack.extensions File "/usr/lib/python2.7/site-packages/nova/api/validation/__init__.py", line 73, in wrapper
2016-12-02 13:20:33.422 8679 ERROR nova.api.openstack.extensions return func(*args, **kwargs)
2016-12-02 13:20:33.422 8679 ERROR nova.api.openstack.extensions File "/usr/lib/python2.7/site-packages/nova/api/openstack/compute/servers.py", line 631, in create
2016-12-02 13:20:33.422 8679 ERROR nova.api.openstack.extensions **create_kwargs)
2016-12-02 13:20:33.422 8679 ERROR nova.api.openstack.extensions File "/usr/lib/python2.7/site-packages/nova/hooks.py", line 154, in inner
2016-12-02 13:20:33.422 8679 ERROR nova.api.openstack.extensions rv = f(*args, **kwargs)
2016-12-02 13:20:33.422 8679 ERROR nova.api.openstack.extensions File "/usr/lib/python2.7/site-packages/nova/compute/api.py", line 1527, in create
2016-12-02 13:20:33.422 8679 ERROR nova.api.openstack.extensions check_server_group_quota=check_server_group_quota)
2016-12-02 13:20:33.422 8679 ERROR nova.api.openstack.extensions File "/usr/lib/python2.7/site-packages/nova/compute/api.py", line 1111, in _create_instance
2016-12-02 13:20:33.422 8679 ERROR nova.api.openstack.extensions image_id, boot_meta = self._get_image(context, image_href)
2016-12-02 13:20:33.422 8679 ERROR nova.api.openstack.extensions File "/usr/lib/python2.7/site-packages/nova/compute/api.py", line 777, in _get_image
2016-12-02 13:20:33.422 8679 ERROR nova.api.openstack.extensions image = self.image_api.get(context, image_href)
2016-12-02 13:20:33.422 8679 ERROR nova.api.openstack.extensions File "/usr/lib/python2.7/site-packages/nova/image/api.py", line 93, in get
2016-12-02 13:20:33.422 8679 ERROR nova.api.openstack.extensions show_deleted=show_deleted)
2016-12-02 13:20:33.422 8679 ERROR nova.api.openstack.extensions File "/usr/lib/python2.7/site-packages/nova/image/glance.py", line 475, in show
2016-12-02 13:20:33.422 8679 ERROR nova.api.openstack.extensions raise exception.ImageNotAuthorized(image_id=1)
2016-12-02 13:20:33.422 8679 ERROR nova.api.openstack.extensions ImageNotAuthorized: Not authorized for image 1.
2016-12-02 13:20:33.422 8679 ERROR nova.api.openstack.extensions
2016-12-02 13:20:33.423 8679 INFO nova.api.openstack.wsgi [req-d48f57c1-2be4-4c3b-8216-2e87fcae2cb3 704e9da3c19e4cefa59e900f65f3cd60 ba73b7d1ad274dafaf4d0e49d347d446 - default default] HTTP exception thrown: Unexpected API Error. Please report this at http://bugs.launchpad.net/nova/ and attach the Nova API log if possible.

Tags: api
Revision history for this message
jichenjc (jichenjc) wrote :

I directly raise excpetion from image/glance.py: show function, but that should be same to use glance directly

Changed in nova:
assignee: nobody → jichenjc (jichenjc)
tags: added: api
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to nova (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/406118

Matt Riedemann (mriedem)
Changed in nova:
importance: Undecided → Medium
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/406118
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=806c48097d351f0dd3b18c850adf6dd31df3b669
Submitter: Jenkins
Branch: master

commit 806c48097d351f0dd3b18c850adf6dd31df3b669
Author: jichenjc <email address hidden>
Date: Sun Nov 27 23:13:44 2016 +0800

    Catch ImageNotAuthorized during boot instance

    ImageNotAuthorized is not caught during boot instance
    this could lead to 500 error to API layer

    Change-Id: Iaae14d27af7b4b8647e1024a5292bd21bcec5560
    Closes-Bug: 1646829

Changed in nova:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/newton)

Fix proposed to branch: stable/newton
Review: https://review.openstack.org/411250

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 15.0.0.0b2

This issue was fixed in the openstack/nova 15.0.0.0b2 development milestone.

Revision history for this message
Ken'ichi Ohmichi (oomichi) wrote :

Hi jichenjc,

Could you provide the way to reproduce this problem ?

I am trying to reproduce this problem on Tempest side with https://review.openstack.org/#/c/423506/ to backport this patch into stable branches, but I cannot do it now.

Revision history for this message
jichenjc (jichenjc) wrote :

Hi Ken'ichi, sorry I forgot how I did it in my devstack, I will follow up and reply to you after our long lunar calendar holiday.. thanks for raise this question up

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (stable/newton)

Reviewed: https://review.openstack.org/411250
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=c5fb4ebd7662f2f0289a86ece3e3f3b9f8d29574
Submitter: Jenkins
Branch: stable/newton

commit c5fb4ebd7662f2f0289a86ece3e3f3b9f8d29574
Author: jichenjc <email address hidden>
Date: Sun Nov 27 23:13:44 2016 +0800

    Catch ImageNotAuthorized during boot instance

    ImageNotAuthorized is not caught during boot instance
    this could lead to 500 error to API layer

    Change-Id: Iaae14d27af7b4b8647e1024a5292bd21bcec5560
    Closes-Bug: 1646829
    (cherry picked from commit 806c48097d351f0dd3b18c850adf6dd31df3b669)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 14.0.4

This issue was fixed in the openstack/nova 14.0.4 release.

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.