Bug 979142

Summary: [RFE] Allow multiple locations to be associated with an image
Product: Red Hat OpenStack Reporter: John Bresnahan <jbresnah>
Component: openstack-glanceAssignee: Flavio Percoco <fpercoco>
Status: CLOSED ERRATA QA Contact: Yogev Rabl <yrabl>
Severity: unspecified Docs Contact:
Priority: high    
Version: 4.0CC: abaron, ddomingo, dron, eglynn, fpercoco, hateya, jbresnah, mkollaro, mlopes, scohen
Target Milestone: Upstream M2Keywords: FutureFeature
Target Release: 4.0   
Hardware: Unspecified   
OS: Unspecified   
URL: https://blueprints.launchpad.net/glance/+spec/multiple-image-locations
Whiteboard:
Fixed In Version: openstack-glance-2013.2-0.6.b2.el6ost Doc Type: Enhancement
Doc Text:
Glance works as a registry for images. Each record is considered an immutable resource that holds information about the image it represents. In previous versions only one location could be associated with one record. An image persisted in its location in Glance. With this enhancement, it is now possible to associate one record to multiple locations. These locations can point to any enabled store. This enhancement can eventually be used to configure failover stores, which in turn would add High Availability capabilities to Image services. For now, using multiple locations for one records can be used to replicate images in different stores.
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-12-20 00:12:30 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 988546    
Bug Blocks: 975499    

Description John Bresnahan 2013-06-27 18:17:42 UTC
All replicas to be associated with a given glance ID.  For example, a file:// swift:// and http:// physical location could be associated with a single glance ID.  The consumer of this information (nova-compute) could then pick the one that best suites it.

https://blueprints.launchpad.net/glance/+spec/multiple-image-locations

Comment 2 Haim 2013-07-15 11:41:41 UTC
I missing information on the blueprint, this makes it difficult for us to come up with meaningful test plan, can you add information for the blueprint?

Comment 3 John Bresnahan 2013-07-19 17:22:00 UTC
(In reply to Haim from comment #2)
> I missing information on the blueprint, this makes it difficult for us to
> come up with meaningful test plan, can you add information for the blueprint?

I added this information on how to test this to the blueprint:

User level test plan
------------------------------
1) Install glance
2) add the following line to glance-api.conf

    show_multiple_locations = True

3) use glance client to 'show' an image with the v2 protocol:

 glance --os-image-api-version 2 image-show <image id>

4) see at least 1 location listed in the output


please let me know if more is needed

Comment 5 John Bresnahan 2013-08-08 17:27:49 UTC
Here is a sample session using curl that shows the following:

1) Add an image without a location
2) Add a http location
3) Add a file location
4) Look up the locations

More v2 API commands are described here: https://etherpad.openstack.org/glance_v1_vs_v2


[jbresnah@localhost devstack]$ curl -i -X POST -H 'Content-Type: application/json' -H "X-Auth-Token: $AUTH" http://localhost:9292/v2/images -d '{"name": "my_image", "disk_format": "vhd", "container_format": "bare"}'
HTTP/1.1 201 Created
Content-Length: 452
Content-Type: application/json; charset=UTF-8
Location: http://localhost:9292/v2/images/41717c78-c926-47aa-922e-295596959e5b
X-Openstack-Request-Id: req-cb438ca5-f083-44cf-b112-980b72fe017e
Date: Thu, 08 Aug 2013 17:25:06 GMT

{"status": "queued", "name": "my_image", "tags": [], "container_format": "bare", "created_at": "2013-08-08T17:25:06Z", "disk_format": "vhd", "updated_at": "2013-08-08T17:25:06Z", "visibility": "private", "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"}[jbresnah@localhost devstack]$ 
[jbresnah@localhost devstack]$ 
[jbresnah@localhost devstack]$ curl -i -X PATCH -H 'Content-Type: application/openstack-images-v2.1-json-patch' -H "X-Auth-Token: $AUTH" http://localhost:9292/v2/images/41717c78-c926-47aa-922e-295596959e5b -d '[{"op": "add", "path": "/locations/-", "value": {"url": "http://cloud.fedoraproject.org/fedora-19.x86_64.qcow2", "metadata": {}}}]'
HTTP/1.1 200 OK
Content-Length: 549
Content-Type: application/json; charset=UTF-8
X-Openstack-Request-Id: req-754191db-2441-4929-bfb0-08935469a1fa
Date: Thu, 08 Aug 2013 17:25:39 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:39Z", "visibility": "private", "locations": [{"url": "http://cloud.fedoraproject.org/fedora-19.x86_64.qcow2", "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"}[jbresnah@localhost devstack]$ 
[jbresnah@localhost devstack]$ 
[jbresnah@localhost devstack]$ 
[jbresnah@localhost devstack]$ curl -i -X PATCH -H 'Content-Type: application/openstack-images-v2.1-json-patch' -H "X-Auth-Token: $AUTH" http://localhost:9292/v2/images/41717c78-c926-47aa-922e-295596959e5b -d '[{"op": "add", "path": "/locations/-", "value": {"url": "file:///etc/group", "metadata": {}}}]'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"}[jbresnah@localhost devstack]$ 
[jbresnah@localhost devstack]$ 
[jbresnah@localhost devstack]$ 
[jbresnah@localhost devstack]$ curl -i -X GET -H 'Content-Type: application/openstack-images-v2.1-json-patch' -H "X-Auth-Token: $AUTH" http://localhost:9292/v2/images/41717c78-c926-47aa-922e-295596959e5b
HTTP/1.1 200 OK
Content-Length: 595
Content-Type: application/json; charset=UTF-8
X-Openstack-Request-Id: req-aeb70882-80fa-4947-8606-d253b180e0a3
Date: Thu, 08 Aug 2013 17:26:16 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"}[jbresnah@localhost devstack]$ 
[jbresnah@localhost devstack]$

Comment 18 Yogev Rabl 2013-11-07 10:25:23 UTC
The RFE has been verified but with the following bugs opened: 

1. Bug 1022549 - openstack-glance: can't configure a location of image manually with a CLI command

2. Bug 1027286 - openstack-glance: api v2 fail to add a second location in the localfs

3. Bug 1027316 - openstack-glance: api v2 allow to add the same location twice

Comment 21 errata-xmlrpc 2013-12-20 00:12:30 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHEA-2013-1859.html