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 service_catalog's object-store will be required when storing
images in tenant specific swift accounts for Glance.

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_read_acl/set_write_acl to swift store.

Updates the base store with example functions for set_read_acl
and set_write_acl. These functions may be implemented by stores
which support multi-tenant backend storage to allow Glance to
set read and write ACL's on the stored images.

Updates the swift store with working implementations of set_read_acl
and set_write_acl. Added tests for swift functions.

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

Change-Id: I7fbd66b5abf8d27c26bdc5e7d6adc98b5722b647
Update v1 images ap to grant public read access.

Updates the v1 images controller so it calls set_read_acl on
the backend store when adding/updating images.

This is used to make image public or private so that multi-tenant
environments can access images from the backend store.

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

Change-Id: Ib249acfe440f4b75bc9edd7b73fe10127b8333b1