Update image caching middleware for v2 URIs

Refactor the image caching middleware to support v2 URI image data GET
and image DELETE requests.

Implements bp api-v2-image-caching

Change-Id: Id89f1df473ddc46ef4992715a9ecd3246b87d442
Include dates in detailed image output.

This adds date display to the output of commands such as "glance
show". This is helpful for admins trying to decide if an image can
be removed from disk safely or not. Resolves bug 1030742.

Change-Id: Ic52120558f89359f1bbfac47f75ff0aa4e916434
Merge "Update image caching middleware for v2 URIs"
Merge "Include dates in detailed image output."
Drop static API v2 responses

It's not helpful to tell users to discover our services but not build
anything into the API that actually *is* discoverable (other than
JSON schemas). This drops GET /v2 and GET /v2/schemas.

Related to bp api-2

Change-Id: Iea49adaa418a3e2495c0713700633785bc21d103
Add in missing image collection schema link.

Related to bp api-v2-links. The schema link for GET /v2/images was
missing, although its target /v2/schemas/images was present. This change
adds in the link and updates tests.

Change-Id: Ida6931147d6e4fba1bb02c0be9e755fb1751b986
Fix dead link to image access collection schema

Related to bp api-v2-links. The image access records list object
contains a link to /v2/schemas/image/accesses, but that link returns
nothing yet. This change adds the schema that the link should return and
wires up the router to return it.

Change-Id: I4303070f016a72fa1cd778d83423fa9a9f77897b
Move optional dependencies from pip-requires to test-requires

python-sendfile and python-xattr are both optional library
dependencies in Glance now. Some systems, like Windows, do not
have these libraries and so we should move them from pip-requires
to test-requires. AFAIK, the pip-requires is what is used to
build the Windows installer.

Fixes LP 1031396

Change-Id: Ib47244e51ae03991e6171ab8d47238d955743567
Merge "Add in missing image collection schema link."
Simplify image and access_record responses

This removes the container around individual image and access_record
entities in GET /images/<ID> and GET /images/<ID>/access/<TENANT>.
Response bodies used to look like '{"image": {...}}', while now they
look like '{...}'.

Fix bug 1031185

Change-Id: I1eacee2d877f5dde3612b3d4006d4caf489f49e1
Expose 'status' on v2 image entities

Added 'status' read-only attribute to v2 schema/serialization.
Updated the schema and added unit tests as appropriate.

Related to bp api-2.

Change-Id: I457527413d4ccca813a45ac03e66a90071f0af76
Raise HTTPBadRequest when schema validation fails

Raise HTTPBadRequest when request schema validation fails rather than
InvalidObject. This prevents a 500 Internal Server Error.

Related to bp api-2.

Change-Id: I70bc8f8b8fbb0f95d9563e9eb08d7e0a47111198
Process umask shouldn't allow world-readable files

This ensures that image cache files and file-backed
images are not world-readable.

Fix LP bug 1031796

Change-Id: I85a26b4e645e7cb32e17164e47fad62f4c44976a
Use event.listen() instead of deprecated listeners kwarg.

The listeners kwarg is deprecated in SQLAlchemy 0.7.0. Since 0.7.3 is
the minimum required version of SQLAlchemy, use the new event.listen()
API instead.

Fixes bug 1031405.

Change-Id: Ibbfe46d065575b1954a47b3a28c61151dfb1e06e
Merge "Move optional dependencies from pip-requires to test-requires"
Use with for file IO.

Use with for file IO, instead of keeping track of state myself.

Change-Id: Ifc1a49fa51d3e7da08da32fb0966f2637089b58a
URLs to glance need to be absolute.

Otherwise the apache SSL frontend that many users deploy will get
confused and return a HTTP error.

Change-Id: Ie8ae560810a5e5419e4d4aacae17e1e301ed4126
Support master and slave having different tokens.

This came up recently for a user -- their regions have separate
keystone instances, and therefore don't share auth tokens. So, in
some cases we need to pass in two tokens instead of one.

Resolves bug 1029758.

Change-Id: Iad241ff3583a62297d89ee15cbd3d58417e5fedf
uuid is a silly name for a var

Given its also the name of an import.

Change-Id: Ib19e69eb9a1047f735ff649a05b400642e8ec29e
Merge "Support master and slave having different tokens."