← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1248535] Re: api v2 can't add a second location in the localfs

 

@Yogev, I just verified this bug again with latest code, it works fine.
Would you mind trying this again with latest code? And feel free to
reopen this. Thanks and sorry for the late response on this.

** Changed in: glance
       Status: Triaged => 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/1248535

Title:
  api v2 can't add a second location in the localfs

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

Bug description:
  Tried to add a location of the existing image with API v2:

  The glance API log show:

  2013-11-06 15:21:45.973 6953 DEBUG glance.api.middleware.version_negotiation [-] Determining version of request: PATCH /v2/images/149563cb-0ad5-4bcc-a933-a24744219e53 Accept: */* process_request /usr/lib/python2.6/site-packages/glance/api/middleware/version_negotiation.py:46
  2013-11-06 15:21:45.979 6953 DEBUG glance.api.middleware.version_negotiation [-] Using url versioning process_request /usr/lib/python2.6/site-packages/glance/api/middleware/version_negotiation.py:59
  2013-11-06 15:21:45.979 6953 DEBUG glance.api.middleware.version_negotiation [-] Matched version: v2 process_request /usr/lib/python2.6/site-packages/glance/api/middleware/version_negotiation.py:71
  2013-11-06 15:21:45.979 6953 DEBUG glance.api.middleware.version_negotiation [-] new path /v2/images/149563cb-0ad5-4bcc-a933-a24744219e53 process_request /usr/lib/python2.6/site-packages/glance/api/middleware/version_negotiation.py:72
  2013-11-06 15:21:45.980 6953 DEBUG keystoneclient.middleware.auth_token [-] Authenticating user token __call__ /usr/lib/python2.6/site-packages/keystoneclient/middleware/auth_token.py:558
  2013-11-06 15:21:45.980 6953 DEBUG keystoneclient.middleware.auth_token [-] Removing headers from request environment: X-Identity-Status,X-Domain-Id,X-Domain-Name,X-Project-Id,X-Project-Name,X-Project-Domain-Id,X-Project-Domain-Name,X-User-Id,X-User-Name,X-User-Domain-Id,X-User-Domain-Name,X-Roles,X-Service-Catalog,X-User,X-Tenant-Id,X-Tenant-Name,X-Tenant,X-Role _remove_auth_headers /usr/lib/python2.6/site-packages/keystoneclient/middleware/auth_token.py:617
  2013-11-06 15:21:45.993 6953 INFO urllib3.connectionpool [-] Starting new HTTP connection (1): 10.35.160.113
  2013-11-06 15:21:46.168 6953 DEBUG urllib3.connectionpool [-] "POST /v2.0/tokens HTTP/1.1" 200 6203 _make_request /usr/lib/python2.6/site-packages/urllib3/connectionpool.py:295
  2013-11-06 15:21:46.182 6953 INFO urllib3.connectionpool [-] Starting new HTTP connection (1): 10.35.160.113
  2013-11-06 15:21:46.220 6953 DEBUG urllib3.connectionpool [-] "GET /v2.0/tokens/revoked HTTP/1.1" 200 794 _make_request /usr/lib/python2.6/site-packages/urllib3/connectionpool.py:295
  2013-11-06 15:21:46.247 6953 DEBUG keystoneclient.middleware.auth_token [-] Storing d57816aeebd4ade336c6505a20e6ec78 token in memcache _cache_put /usr/lib/python2.6/site-packages/keystoneclient/middleware/auth_token.py:1061
  2013-11-06 15:21:46.249 6953 DEBUG keystoneclient.middleware.auth_token [-] Received request from user: c7fdf6f628554d56aad363ad501ce412 with project_id : add3de2deaa445c1a1e71c1721bc8976 and roles: admin  _build_user_headers /usr/lib/python2.6/site-packages/keystoneclient/middleware/auth_token.py:922
  2013-11-06 15:21:46.252 6953 DEBUG routes.middleware [-] Matched PATCH /images/149563cb-0ad5-4bcc-a933-a24744219e53 __call__ /usr/lib/python2.6/site-packages/Routes-1.12.3-py2.6.egg/routes/middleware.py:100
  2013-11-06 15:21:46.252 6953 DEBUG routes.middleware [-] Route path: '/images/{image_id}', defaults: {'action': u'update', 'controller': <glance.common.wsgi.Resource object at 0x31c99d0>} __call__ /usr/lib/python2.6/site-packages/Routes-1.12.3-py2.6.egg/routes/middleware.py:102
  2013-11-06 15:21:46.252 6953 DEBUG routes.middleware [-] Match dict: {'action': u'update', 'image_id': u'149563cb-0ad5-4bcc-a933-a24744219e53', 'controller': <glance.common.wsgi.Resource object at 0x31c99d0>} __call__ /usr/lib/python2.6/site-packages/Routes-1.12.3-py2.6.egg/routes/middleware.py:103
  2013-11-06 15:21:46.273 6953 DEBUG glance.api.policy [d88960b1-2e7a-4223-9b99-92abd4b20e50 c7fdf6f628554d56aad363ad501ce412 add3de2deaa445c1a1e71c1721bc8976] Loaded policy rules: {u'context_is_admin': 'role:admin', u'default': '@', u'manage_image_cache': 'role:admin'} load_rules /usr/lib/python2.6/site-packages/glance/api/policy.py:75
  2013-11-06 15:21:46.288 6953 DEBUG glance.api.policy [d88960b1-2e7a-4223-9b99-92abd4b20e50 c7fdf6f628554d56aad363ad501ce412 add3de2deaa445c1a1e71c1721bc8976] Loaded policy rules: {u'context_is_admin': 'role:admin', u'default': '@', u'manage_image_cache': 'role:admin'} load_rules /usr/lib/python2.6/site-packages/glance/api/policy.py:75
  2013-11-06 15:21:46.289 6953 DEBUG glance.api.policy [d88960b1-2e7a-4223-9b99-92abd4b20e50 c7fdf6f628554d56aad363ad501ce412 add3de2deaa445c1a1e71c1721bc8976] Loaded policy rules: {u'context_is_admin': 'role:admin', u'default': '@', u'manage_image_cache': 'role:admin'} load_rules /usr/lib/python2.6/site-packages/glance/api/policy.py:75

  
  Version-Release number of selected component (if applicable):
  openstack-glance-2013.2-1.el6ost.noarch

  How reproducible:
  everytime

  Steps to Reproduce:
  1. Follow the setup case in the test case https://tcms.engineering.redhat.com/run/87718/#caserun_3433837
  2. run the command: curl -i -X PATCH -H 'Content-Type: application/openstack-images-v2.1-json-patch' -H "X-Auth-Token: <RHOS user ID>" http://localhost:9292/v2/images/<image_id> -d '[{"op": "add", "path": "/locations/-", "value": {"url": "file://<path to the copy>", "metadata": {}}}]'
  3.

  Actual results:
  the output is: 

  <html>
   <head>
    <title>400 Bad Request</title>
   </head>
   <body>
    <h1>400 Bad Request</h1>
    Invalid location: file:///home/user/mycopy.img<br /><br />
   </body>

  
  Expected results:
  HTTP/1.1 200 OK
  Content-Length: 595
  Content-Type: application/json; charset=UTF-8
  X-Openstack-Request-Id: req-4958f566-66bf-4a65-8fe0-43006d2040d2
  Date: Thu, 08 Aug 2013 17:25:54 GMT

  {"status": "active", "name": "my_image", "tags": [],
  "container_format": "bare", "created_at": "2013-08-08T17:25:06Z",
  "disk_format": "vhd", "updated_at": "2013-08-08T17:25:54Z",
  "visibility": "private", "locations": [{"url":
  "http://cloud.fedoraproject.org/fedora-19.x86_64.qcow2";, "metadata":
  {}}, {"url": "file:///etc/group", "metadata": {}}], "self":
  "/v2/images/41717c78-c926-47aa-922e-295596959e5b", "protected": false,
  "id": "41717c78-c926-47aa-922e-295596959e5b", "file":
  "/v2/images/41717c78-c926-47aa-922e-295596959e5b/file", "min_disk": 0,
  "min_ram": 0, "schema": "/v2/schemas/image"}

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