Bug 1027286 - openstack-glance: api v2 fail to add a second location in the localfs
Summary: openstack-glance: api v2 fail to add a second location in the localfs
Keywords:
Status: CLOSED INSUFFICIENT_DATA
Alias: None
Product: Red Hat OpenStack
Classification: Red Hat
Component: openstack-glance
Version: 4.0
Hardware: x86_64
OS: Linux
high
high
Target Milestone: rc
: 4.0
Assignee: Flavio Percoco
QA Contact: Haim
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-11-06 13:27 UTC by Yogev Rabl
Modified: 2023-09-14 01:53 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-11-20 09:00:26 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Yogev Rabl 2013-11-06 13:27:08 UTC
Description of problem:
While verifying the RFE, Bug 979142 , I've tried to add a location of the existing image, according the commands in the test case https://tcms.engineering.redhat.com/run/87718/#caserun_3433837 . 

The test: add 2nd location (localFS) failed. 

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"}

Additional info:

Comment 2 Flavio Percoco 2013-11-11 10:01:33 UTC
Is '/home/user/mycopy.img' accessible by the glance-api node you're adding the image to?

Image's locations are `pointers` to existing images that are accessible by glance-api. This means, they've to be uploaded to that location beforehand and not through glance-api.

Comment 3 Red Hat Bugzilla 2023-09-14 01:53:15 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 1000 days


Note You need to log in before you can comment on or make changes to this bug.