Added unit tests for api/middleware/cache_manage.py

blueprint glance-cache+unittests
Change-Id: I4382bb37795d42f43e3ddf9f95f13bb76400e1bb
Increase test coverage for glance.common.wsgi

Add unit tests for wsgi.get_socket.

Change-Id: I3850dca6f6e4dbeca0465c8d751458e255e0fed8
Sync with oslo-incubator (git 6827012)

This syncs the common/ modules with oslo-incubator, which
brings a few hacking fixes and py3k compat fixes.

Change-Id: I948aafebd25ae0b3aad119c41d0a121c8b9c5ae8
Consider  @,! in properties protection rule as a configuration error

In roles based property protection, if '@' and '!' are in the same rule then the
glance api will not start considering this an Invalid Configuration.

DocImpact
Closes-bug: #1260333

Change-Id: I1d304f5c505ae9e2486ff653dda205fc2d851c2b
assertEquals is deprecated, use assertEqual (H234)

Fix last occurrences of Hacking check H234 (Python 3.x
porting issue)

Change-Id: I5444889e1837c89045996c74526e2d7a58c7a649
Switch to Hacking 0.8.x

Blacklist the few hacking warnings that still trigger, those
can be fixed in a followup commit. Start Gating on the new
tests of Hacking 0.8.x (which are all passing here).

Change-Id: I3be1a9a517ec399dd92252a7c705d1a7a6d5e4c2
Fix call to store.safe_delete_from_backend

When uploading data of a newly created image to a local filesystem
store, if the image data size exceeds the quota allocated to the user
then the operation fails with a "500 Internal Server Error".

This bug is triggered only when using chunked transfers to upload the
image data (curl and glanceclient both use chunked transfers).

When using chunked transfers the 'Content-Length' header is not set and
so the quota checking code in start of quota.ImageProxy.set_data() is
skipped. Furthermore, because of the missing size info, the store
downloads the entire image data without checking for the quota (the
quota is checked only after the image data has been downloaded and the
size determined).

If after the image data has been downloaded it is found that the quota
has been exceeded, then the StorageQuotaFull exception is raised and a
call to store.safe_delete_from_backend() made to clean up the image
data. But the 'location' and 'context' parameters to this call are given
in the wrong order and so this operation raises an (uncaught) exception,
giving rise to this bug.

This bug was not caught by existing tests because existing quota tests
don't use chunked transfer.

This commit fixes the order of the parameters and adds quota tests using
chunked transfers.

Change-Id: Ib8ab11f2115e3aead98af70788eaa45c2c33219c
Closes-bug: #1265446
fix comments and docstrings misspelled words

Change-Id: I355b6fedf372b1273ceaebe22e8e890aa9c913c9
Closes-bug: #1267103
Oslo sync to recover from db2 server disconnects

A checkout listener can be added to sqlalchemy to be able to
handle database disconnect pessimistically and avoid an error in
the event of a DB restart or simply a temp connection issue due
to network glitches. At the moment only mysql is enabled with
this feature. This patch enables db2 as well.

Oslo version in change I5563360b43c4b648f5b035099b0e1d2e71d32503

Partial-Bug: #1231657
Change-Id: I218ef9836f2e0f135897007d2e53354eb1248422
Merge "Consider  @,! in properties protection rule as a configuration error"
Fix typo in gridfs store

Closes-Bug: #1266986

Change-Id: Ic69ef987b785d0db25e2fea2a745f3d00780241a
Skip unconfigurable drivers for store initialization

All enabled/known store drivers are currently initialized and configured
by Glance when API daemon startup, and the driver(s) which could not be
configured correctly fail are not skipped. This patch explicitly skips
the stores with bad configuration and logs the same.

Change-Id: Ie14b1fb2f554e12cf82512f1d84390619d35a886
Signed-off-by: Zhi Yan Liu <zhiyanl@cn.ibm.com>
Adding logs to tasks

Logging is currently missing in the REST api layer in v2/tasks

Related to bug 1267213

Change-Id: I608390a7be1b2b02f281d974bd456a8e9e7897f7
replace type calls with isinstance

In store/__init__.py, there are two uses of the "type" method to
check type compatibility. It is better to use the "isinstance" method
since it will work for subtypes as well.

Change-Id: I20958aa449822cac2cb03e12557fded3f45a9e05
Closes-Bug: #1267074
Add config option to limit image locations

This patch adds the image_location_quota config option. This allows
a deployer to limit the number of image locations allowed on an image.
The default value is 10. Users will only be able to update an image
if the result of the transaction would be under this limit. This
behavior is intended to be similar to 'quota_metadata_items' in Nova.

We have implemented the same limit for image properties, members and tags,
see:
https://review.openstack.org/#/c/56981/
https://review.openstack.org/#/c/59563/
https://review.openstack.org/#/c/58056/

docImpact
Closes-Bug: #1259031

Change-Id: I0e0033a1d11be267144e8e10b730bb6331263d4c
Bump hacking to 0.8 and get python 3.x compatibility

Bump hacking dependency to 0.8 to get python 3.x compatibility
Fixes done in order to avoid errors after enabling hacking 0.8

Change-Id: Ic878fe2e1bd3f65f7f95a9b5c7a192dac81b749d
Closes-Bug: #1257282
Merge "replace type calls with isinstance"
Merge "fix comments and docstrings misspelled words"
Align glance-api.conf rbd option defaults with config

DocImpact: The example glance-api.conf set different defaults than
what was hardcoded in the code. Change code defaults to those
in the config.

Preparation for generating glance-api.conf with oslo.config generator.

Change-Id: I424e6c5984dbdf5082852c40d97ab1e1a04926ea
Merge "Add config option to limit image locations"