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
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
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
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
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
Sync Log levels from OSLO

Copy changes from just 1 commit:
I0736fd62190fd0b3b26133916f8b3d4d9f0499c2 Default iso8601 logging to warn

Change-Id: I1c90705d4d9b37e5472eeebce0192d4d7aa1febe
Cleans up imports in models.py

Some of the imports were placed in incorrect order.

Change-Id: I14555b5c3bd6871d4b1e0cea7e03c191ffd6cf33
Update README to the valid Oslo-incubator doc

Currently, the README in `openstack/common/` contains a link
to a blank page.
This patch changes the link to a valid documentation page.

Change-Id: I6c7a7a5fcef76f49b5d38c79b10a2a849046a32f
Closes-Bug: #1268051
Merge "Sync with oslo-incubator (git 6827012)"
Set image size to None after removing all locations

Based on current design, the image size should be updated to
None if there is no location assocaited with the image. This
patch fixes this issue and introduces some related changes.

Closes-Bug: #1263729

Change-Id: I893468f1dc320ea9434f07c3a32f978cd5941b33
Merge "Added unit tests for api/middleware/cache_manage.py"
Merge "Oslo sync to recover from db2 server disconnects"
Prevent min_disk and min_ram from being negative

At the moment, in both api versions, min_disk and min_ram can be set to
negative value - which doesn't make sense. This commit fixes this behavior
in the two versions of the glance api.

Change-Id: Ib7855c1d928ab8262dd2a109619a4e3d2299ff9e
Closes-bug: #1265711
Merge "Align glance-api.conf rbd option defaults with config"
Merge "Sync Log levels from OSLO"