Adds service_catalog to the context.

Updates the ContextMiddleware so that it stores the service_catalog
which from set via Keystone's auth_token middleware.

The motivation for this change is that we'll need access to the
'object-store' endpoint in order to implement swift tenant specific
storage.

Partially implements blueprint: swift-tenant-specific-storage

Change-Id: I0389e135f6683a353ae915b543d70f6ac1246b2c
Make get_endpoint a generic reusable function.

This patch refactors the get_endpoint function to make it more generic
and top level so that it can be more easily accessed and tested.

Adds service_type, endpoint_region, and endpoint_type options to
the get_endpoint function as well.

Added a new test suite specifically for get_endpoint.

The motivation for this change is that we'll need to be able to
parse the 'object-store' endpoint for each tenant in order to
enable multi-tenant storage in the swift storage backend.

Partially implements blueprint: swift-tenant-specific-storage

Change-Id: Icf773a1eb057fc9d65cf54890afa4638f2aee0b4
Provide stores access to the request context.

Adds a set_context function for the Store class which can be used
to provide an instantiated store access to the RequestContext.

Updates common store helper methods to call set_context on each
store as it is retrieved from the list of know stores.

Implement custom set_context call on the swift store.

The motivation for this change is that we will need access to the
service catalog and token for the Swift multi-tenant backend.

Partially implements blueprint: swift-tenant-specific-storage

Change-Id: I3def2b7c4085a36dd6c0961e762783ebaf7ffa74
Adds multi tenant support for swift backend.

Updates the swift store to support multiple tenants:

 * Added configuration option for swift_store_multi_tenant.

 * Updated the swift connection creation logic so that in multi-tenant
   mode the token and storage URL from the service catalog are used
   to create swift connection.

 * When in multi-tenant mode locations URL's (stored in the DB) do
   not contain hard coded swift credentials.

Includes unit tests to verify multi-tenant swift storage URLs.

Partially implements blueprint: swift-tenant-specific-storage.

Change-Id: I45fc97027e6f211ac353513c2d9d6da51ccf4489
Store swift images in separate containers.

Updates the swift storage backend so that when using multi tenant
each images gets stored in a separate container.

The motivation for this change is so that we can set swift read/write
permissions on each individual image.

Partially implements blueprint: swift-tenant-specific-storage.

Change-Id: I43f33594fb40dee33ef52e8ae873722e20b09a10
Adds set_acls function for swift store.

Updates the swift store with working implementation of set_acls.

Updates the base store with an example set_acls function.

This function may be implemented by stores which support backend ACLs
to allow Glance to set read and write ACL's on the store images.

Added tests for swift store function.

Partially implements blueprint: swift-tenant-specific-storage.

Change-Id: I7fbd66b5abf8d27c26bdc5e7d6adc98b5722b647
Update v1/v2 images APIs to set store ACLs.

Updates the images controllers so they call set_acls on
the backend store when adding/updating images and members.

Made some changes to the v2 API unit/functional tests to
use real locations instead of just UUIDs so the tests work
with the new set_acls call.

Partially implements blueprint: swift-tenant-specific-storage.

Change-Id: Ib249acfe440f4b75bc9edd7b73fe10127b8333b1
Add swift_store_admin_tenants option.

Add a swift storage option to configure a default list of admin
tenant IDs which will be granted write access on any swift
images.

This setting might be useful when a user choose not to use a global
swift admin role when managing glance images. This might also
be useful when implementing delayed delete for glance swift
multi-tenant.

Partially implements blueprint: swift-tenant-specific-storage.

Change-Id: Id65e1c8d114c9551b99f6a18c527ba26aefd341f