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
Remove internal store references from migration 015

Migration 015 was accessing a object internal to the swift store driver
and changing its behavior in order to do the migration.  This worked but
it made the assumption that the driver logic would not change without
also changing the migration code.  These two should not be dependent
upon each other.  This patch removes all dependencies on swift from the
migration code.

Fixes bug: 1025746
Change-Id: Ic9559ae809b8784d0992cb5275d3911a725110c8
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
glance-manage should not require glance-registry.conf

In v2 the glance-registry service is no longer needed.  Thus
it is possible that a setup would not include a configuration
file for it at all.  Further it is possible that glance-api and
glance-registry be run on different machines such that neither
configuration file is available to the other.  Therefore glance-manage
should be able to pull the information out of either configuration
file provided that the overriding command line options:
--sql_connection or --config-file are not used.  This patch makes
it so glance-manage will first look in the glance-registry.conf file
for db information (as this is the legacy behavior) and then in
the glance-api.conf file if that file does not exist.

Fixes bug: 1046576
Change-Id: Ida68a5c03eb3d188b2b997296cd45730b968ef12
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
Add placeholder migrations to allow backports

Inspired by the nova blueprint backportable-db-migrations,
we reserve a range of migration slots to allow for idempotent
and standalone migrations to be backported to stable/grizzly
during the Havana release cycle.

Nova have reserved 10 slots and the historical ratio of
nova:glance migrations is circa 8:1. Hence the thought that
a total of 3 placeholder slots should more than suffice for
the Havana release cycle.

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

Add tests for glance.api.middleware.cache module

Fixes: bug #1152053
Change-Id: I6e99c70b0d8ae20011b4ad9bea76d5e4e1dff921
Adding help text to the options that did not have it.

Many of the config options did not have help text set.  This patch
adds text for those.

patchset2 adds 5 skipped options

patchset3 adds a missing underscore before the helptext bracket

patchset4 fixes pep8 errors

patchset5 notes the units (seconds) in sql_retry_interval, as noted
by Flavio Percoco Premoli

patchset6 fixes comments from Alex Meade

Fixes bug: 1162449
Change-Id: Ic75e499456e389df2ec527594bbcd54c0b464ee3
Merge "Adding help text to the options that did not have it."
Merge "glance-manage should not require glance-registry.conf"
Call monkey_patch before other modules are loaded

This patch moves the monkey_patch call into the glance scripts that
needs libs to be monkey_patched. This seems to be a good practice and
has given good results for other projects as well.

This change is needed  to avoid loading / initializing modules
before other libs are patched. For example: logging module.

Fixes bug 1163722

Change-Id: Idee486851606d765fb11598967a4f7d56cf46c97
Merge "Add placeholder migrations to allow backports"
Make "private" functions that shouldn't be exported

Currently, the db_api defines some functions that are used for accessing
images data but some of them are for internal use only. In an effort to
improve consistency, I've made some of those functions - the ones that
are not accessed outside the db_api - private by prepending their names
with an "_".

Most of this functions were defined within sqlalchemy and as such didn't
required any change in the simple driver, others though, required a
change in both drivers, i.e. get_session.

This patch implements part of the blueprint registry-api-v2.

NOTE: During the review, try to find functions that should be private
and haven't been changed.

Change-Id: I6342dc94ebf2a35d6bc9bd7698b81a94ffa13373
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
Merge "Make "private" functions that shouldn't be exported"
Imported Translations from Transifex

Change-Id: I18d6557d11052b9e5078641ae5179acae58132e4
Imported Translations from Transifex

Change-Id: I0e6d8b23936fe89b1c56db29fbc347778b0eb3e9
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
Imported Translations from Transifex

Change-Id: I90de38c969665f7b91afc323720754df1c3f320f