Adding image location selection strategy
An image can be saved to more than one backend storage by multi-location mechanism, therefore Glance should be able to select the best backend storage for improve image consuming performance. As an end user, he can get VM or consuming image faster base on this enhancement. This is not only for 'download' transport handling on the API server side but also for client since they can obtain locations by standard 'direct URL' interface. So the strategy option and the configurations of specific strategy should can be added to API server side and client side [1] consistently, and also the strategy based selection functions should be shared between API server side and client side also.
1. Adding "location_
2. Implement two selection functions to support those two strategies, and put #1 and #2 stuff to a common code place.
i. "location_order": using image owner or admin given locations arbitrary order.
ii. "store_type": using configured backend storage preference, ordered by another option like ['file', 'swift', 's3'], that means using file based location first if image have, then swift and s3 at last.
3. Change Glance v2 'download' action to involve strategy based selection mechanism.
[1] We have a plan to do a reusable glance client library for all clients like Nova and Cinder in near period, it can contains common code to provide uniform image service interface for them. This just like Brick in Cinder.
Blueprint information
- Status:
- Complete
- Approver:
- Mark Washenberger
- Priority:
- Medium
- Drafter:
- Zhi Yan Liu
- Direction:
- Needs approval
- Assignee:
- Zhi Yan Liu
- Definition:
- Approved
- Series goal:
- Accepted for icehouse
- Implementation:
- Implemented
- Milestone target:
- 2014.1
- Started by
- Zhi Yan Liu
- Completed by
- Thierry Carrez
Related branches
Related bugs
Sprints
Whiteboard
Under the design for this BP, those strategies are all be static and configured by Cloud owner/admin or operator.
In future, we can do a local metrics tracking library for client side, to get the dynamic performance metrics and save those indicators to local. Locality is critical because different glance nodes likely have different relationships to the underlying locations in terms of network distance, so each node should be gearing towards what is best for it.
--zhiyan
Addressed by: https:/
Adding image location selection strategies
Addressed by: https:/
Apply image location selection strategy
A near miss on icehouse-2, but with the gate going slow and only one patch ready to land, Iets just try to land this ASAP in icehouse 3. Still on top of my review queue! :-)
=======
Sample test sequence to play this feature. --zhiyan
1. Enable 'show_image_
$ cat /etc/glance/
show_image_
show_multiple_
2. Set 'location_strategy' option to 'location_order' or 'store_type' for glance api service as you needed, like this:
$ cat /etc/glance/
location_strategy = location_order
Currently glance has only two built-in strategies, and if you choose to use 'store_type' as your image location selection strategy then you should configure 'store_
3. Start/restart glance api service to apply those options.
4. Create an image for testing and get image id from response, for example:
$ curl -i -X POST -H 'X-Auth-Token: 7792c8f4500d4b2
5. Assign multiple locations to the image via PATCH, like this:
$ curl -X PATCH -H 'X-Auth-Token: 7792c8f4500d4b2
{"status": "active", "name": "image_test", "tags": [], "container_format": "bare", "created_at": "2014-01-
6. Verify image status under 'active' and end user can reach image direct locations as he configured selection strategy, for instance:
$ curl -i -X GET -H 'X-Auth-Token: b2817fe4c9d948c
{"status": "active", "name": "image_test", "tags": [], "container_format": "bare", "created_at": "2014-01-
Note, in this case I'm using 'location_order' location selection strategy and enabled 'show_multiple_
And now, from above result you can see the image loctions have been listed as its original order which I provided in above step (first one is 'loc_1' and second is 'loc_2') within 'locations' field, and as we expected the 'direct_url' give a correct value (the first one).
7. As alternative location strategy, if end user use ''store_type' strategy, and give 'http, file' as the value for 'store_
{"status": "active", "name": "image_test", "tags": [], "container_format": "bare", "created_at": "2014-01-
In above result, the image locations have been exposed as 'store_
End.