← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1265719] Re: Create image with api v2 return 500 error

 

As for the 500 error, did you mean you was using a bad location? If so,
I think it's fixing by
https://review.openstack.org/#/c/64824/1/glance/quota/__init__.py

I'm going to mark this as invalid. Please feel free reopen it if there
is any question. Thanks for working on this.

** Changed in: glance
       Status: New => Invalid

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

Title:
  Create image with api v2 return 500 error

Status in OpenStack Image Registry and Delivery Service (Glance):
  Invalid

Bug description:
  I try to use the glance api v2 to create image as two steps:
  1. create image metadata and get image id
  curl -i -X POST  -H "X-Auth-Token: $token" -H "content-type: application/json" -d '{"name": "image-8", "type": "kernel", "foo": "bar", "disk_format": "aki", "container_format": "aki", "protected": false, "tags": ["test","image"], "visibility": "public", "min_ram":1, "min_disk":1}' \
  http://192.168.0.100:9292/v2/images

  glance image-show image-8

  +------------------+--------------------------------------+
  | Property         | Value                                |
  +------------------+--------------------------------------+
  | Property 'foo'   | bar                                  |
  | Property 'type'  | kernel                               |
  | container_format | aki                                  |
  | created_at       | 2014-01-03T06:21:37                  |
  | deleted          | False                                |
  | disk_format      | aki                                  |
  | id               | a97139a5-1942-45ac-91e9-37e1febf7627 |
  | is_public        | True                                 |
  | min_disk         | 1                                    |
  | min_ram          | 1                                    |
  | name             | image-8                              |
  | owner            | 25adaa8f93ee4199b6a362c45745231d     |
  | protected        | False                                |
  | status           | queued                               |
  | updated_at       | 2014-01-03T06:21:37                  |
  +------------------+--------------------------------------+

  image status is queued and waiting for image data

  2. with patch method update the locations of image-8.

  curl -i -X PATCH -H "X-Auth-Token: $1" -H "content-type:application/openstack-images-v2.1-json-patch" \
  -d '[{"op":"add", "path":"/locations/1", "value":{"url":"file:///var/lib/glance/images/cirros-0.3.1-x86_64-uec", "metadata":{}}}]' \
  http://192.168.0.100:9292/v2/images/a97139a5-1942-45ac-91e9-37e1febf7627

  respond:

  HTTP/1.1 500 Internal Server Error
  Content-Type: text/plain
  Content-Length: 0
  Date: Fri, 03 Jan 2014 06:22:01 GMT
  Connection: close

  expected respond

  HTTP/1.1 200 OK
  Content-Length: 496
  Content-Type: application/json; charset=UTF-8
  X-Openstack-Request-Id: req-755954a9-e375-4e43-a77e-1db2d430619e
  Date: Fri, 03 Jan 2014 06:35:43 GMT

  {"status": "active", "name": "image-8", "tags": ["test", "image"],
  "container_format": "aki", "created_at": "2014-01-03T06:21:37Z",
  "disk_format": "aki", "updated_at": "2014-01-03T06:35:43Z",
  "visibility": "public", "self": "/v2/images/a97139a5-1942-45ac-
  91e9-37e1febf7627", "protected": false, "id": "a97139a5-1942-45ac-
  91e9-37e1febf7627", "file": "/v2/images/a97139a5-1942-45ac-
  91e9-37e1febf7627/file", "min_disk": 1, "foo": "bar", "type":
  "kernel", "min_ram": 1, "schema": "/v2/schemas/image"}

  I debug the code of glance. I think the wrong is from glance/quota/__init__.py: _check_quota() function.
  After image create without size which is none type, however _check_quota() will count the image space with image meta size.
  I think it's a type error

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


References