Reviewed:  https://review.openstack.org/491249
Committed: 
https://git.openstack.org/cgit/openstack/glance/commit/?id=d4917cf606e99429e019538cd95f06ab0673acca
Submitter: Jenkins
Branch:    master

commit d4917cf606e99429e019538cd95f06ab0673acca
Author: Brian Rosmaita <[email protected]>
Date:   Sun Aug 6 11:16:25 2017 -0400

    Fix 500 error from image-import call
    
    This patch modifies the images controller to accept a body (which
    is required) for the image import call and cleans up a bit around
    the request deserialization/response serialization.
    
    Co-authored-by: Abhishek Kekane <[email protected]>
    Co-authored-by: Brian Rosmaita <[email protected]>
    
    Change-Id: I08783e28719e63b5a4b2115b8fce135e55be460a
    Closes-bug: #1708702


** 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/1708702

Title:
  glance image-import command fails with 500 error

Status in Glance:
  Fix Released

Bug description:
  This was reported by Abhishek Kekane.

  Steps to reproduce:
  1. Run glance image-import <image-id> or curl -g -i -X POST 
http://10.232.48.204/image/v2/images/6d5851f8-bdd2-43d0-a3ee-3b4017e31b45/import
 -H "User-Agent: python-glanceclient" -H "Content-Type: application/json" -H 
"X-Auth-Token: {SHA1}462b312cf75dd125706dd13acb7cbbc3eb244ca2" -d 
'{"import_method": "glance-direct"}'

  Reason:
  1. We are passing body to post url but the controller method does not accepts 
body parameter. So wsgi throws error import_image() has got invalid keyword 
argument 'body'.

  Need to make below changes in /glance/api/v2/images.py
  --- a/glance/api/v2/images.py
  +++ b/glance/api/v2/images.py
  @@ -89,11 +89,12 @@ class ImagesController(object):
           return image

       @utils.mutating
  -    def import_image(self, req, image):
  +    def import_image(self, req, image_id, body):
           task_factory = self.gateway.get_task_factory(req.context)
           executor_factory = 
self.gateway.get_task_executor_factory(req.context)
           task_repo = self.gateway.get_task_repo(req.context)

           task_input = {}

           try:
  @@ -108,7 +109,7 @@ class ImagesController(object):
               LOG.debug("User not permitted to create image import task.")
               raise webob.exc.HTTPForbidden(explanation=e.msg)

  -        return image
  +        return image_id

  
  Other problems:
  1. image_id is not used anywhere
  2. "import_method" passed in body is not used anywhere.

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

-- 
Mailing list: https://launchpad.net/~yahoo-eng-team
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~yahoo-eng-team
More help   : https://help.launchpad.net/ListHelp

Reply via email to