Add unit tests for glance.api.cached_images module

Add positive unit tests for methods:
* get_chached_images
* delete_cached_images
* get_queued_images
* queue_image
* delete_queued_image

Fixes: bug #1155188
Change-Id: I3fa6dc28a72e8c6e8402911931fb37e18cba7ea0
Add a policy handler to control copy-from functionality

This patch adds the ability to set a policy handler to control what
users can use the 'copy_from' feature in the v1 API.

Fixes bug: 1153614

Change-Id: Ie194979a2aa66c9327bf14d7a85ead6f773a6079
Verify SSL certificates at boot time

When Glance is configured to run with SSL this patch will check
that the certificate and key exist, are readable, and match each
other at boot time.  If any of the above conditions fail an friendly
error message is logged directing the operator at a solution.
Previously the keys were not checked until a client connected.

fixes bug: 1160529

Change-Id: I16975608f9ae40ac5b84b3caa52ed5f8e22f296e
Add GridFS store

This patch adds support for GridFS to glance. GridFS is 10gen's, mongodb
based, distributed filesystem.

The store requires 2 options in order to work correctly:
    * mongodb_store_uri
    * mongodb_store_db

Note: mongodb was used in the parameters name's even though this store
supports `gridfs://` schemas (not official) in order to keep consistency
with mongodb's documentation and connection parameters.

GridFS StoreLocations:

This store implements gridfs locations with the form `gridfs://<IMAGE>`.
Note that there's no connection information in those uris, which was
consciously omitted for security reasons. Perhaps, it could be possible
to make that information available by setting a configuration parameter
that specifies so.

Implements blueprint gridfs-store

Change-Id: I38f361ac8421f0445dd37800c840441a46cf9fdf
Improve unit tests for glance.api.middleware.cache module

Add tests for glance.api.middleware.cache module

Fixes: bug #1152053
Change-Id: I6e99c70b0d8ae20011b4ad9bea76d5e4e1dff921
Fix functional test 'test_scrubber_with_metadata_enc'

This test fails if a real swift system is specified in a config file
and passed to the tests via the GLANCE_TEST_SWIFT_CONF environment
variable. The fix is to allow location schemes of the form
'swift+http' as well as 'swift+https'.

Fixes bug 1158805

Change-Id: I9fd3a9c02b31acc2a8313acd3b88124a17d0adfb
Fix the deletion of a pending_delete image.

Return '403 - Forbidden' when trying to delete
a 'pending_delete' image, and does not change
its status.

Change-Id: Id5b8b31c19d0f9da8aba66b06d1b966e9c33a363
Fixes: bug #1163020
Fix Qpid test cases

The Qpid notification test cases do not currently pass.
By default they are skipped because qpid is not part of
test-requires, so it isn't automatically installed.  This fix
updates the test cases to work correctly, but does not add
qpid to test-requires because I'm unsure what impacts that
might have on other platforms.

This is part of the fix for bug 1164681

Change-Id: I40757b5de99559b4ff090e0d249f8624c2e2be10
Merge "Add GridFS store"
Merge "Improve unit tests for glance.api.middleware.cache module"
Merge "Fix the deletion of a pending_delete image."
Merge "Fix Qpid test cases"
Merge "Add unit tests for glance.api.cached_images module"
Merge "Verify SSL certificates at boot time"
Merge "Fix functional test 'test_scrubber_with_metadata_enc'"
Eliminate the race when selecting a port for tests.

Functional tests currently select ports on which the various services
will listen by opening a socket in the ephemeral port range, checking
its port, closing the socket, and then sometime later starting the
service and instructing it to use that port.  There are a few bugs that
reference fragile tests.  In many of these case it is possible that
another processes claimed the selected port in between the time it was
first opened and closed and the time that the service actually used it.
Because this is a known possibility, and because the tests fail
infrequently resolving these bug becomes difficult.

This patch eliminates the window in which another processes could claim
the port.  The socket is opened in the test code but not closed. Then
the service process (api or registry) is forked off where it inherits
the open file descriptor.  A environment variable is used to tell the
new wsgi process that it is a test process and should thus get its
socket from the FD instead of creating a new socket.

In the case where glance-control is used with the --respawn option this
solution is not possible.  The problem is that the FD is only good once.
I can pass from the test code, to glance-control, and to glance-{api,
registry} but only 1 time.  If the service dies, and glance-control
restarts it the FD will no longer be valid.  For this case the forked FD
code is disabled.  However, the socket is still closed much later making
the race condition even less likely.

This fixes bug: 1047593
It may fix some other "fragile test" bugs as well.

Change-Id: I27313d144bc7bd2132a604dcc22916c80338abab
Merge "Add a policy handler to control copy-from functionality"
Merge "Eliminate the race when selecting a port for tests."