Update the glance-api manpage

Change-Id: I8219b29c468f094085a3182d19c3354aca091cd7
Partial-Bug: #1238366
Change assertTrue(isinstance()) by optimal assert

Some of tests use different method of assertTrue(isinstance(A, B)) or
assertEqual(type(A), B). The correct way is to use assertIsInstance(A, B)
provided by testtools.

Change-Id: Ia8d38f73c159c7ef943a8f6cfe72b945cc493947
Closes-bug: #1268480
Fix tmp DB path calculation for test_migrations.py

The method used by glance/tests/unit/test_migrations.py for
calculating tmp DB paths for sqlite connections works only when the
test tmp DB is in the current directory. When the test tmp DB is in
another directory (specified by an absolute path), the path calculated
is wrong. Consequently the test resetting function thinks the DB has
been reset (because the path calculated does not exist) but the actual
test fails because the db in the actual path has not been cleaned up.

This commit corrects the path calculation logic to handle absolute
paths as well.

Fixes bug 1263639

Change-Id: If747da25f40d92cf10ac5ac8addeb768f90e38cd
fixing typo in rst file

Change-Id: I5e8e08300abb783f2e7c1c9339e1295295526293
Fix inconsistent doc string and code of db_sync

db_sync may downgrade but current doc string only says
upgrade, and it says having return value which seems not
true.

Change-Id: Ib7bbb597f621985aba956302034eb1c5d0b3ff1f
Closes-Bug: #1264193
Adding image location selection strategies

An image can be saved to more than one backend storage by multi-location
mechanism, Glance should have a capability to select the best backend
storage for improving image consuming performance. This change
implements two strategy modules: "location_order" and "store_type", and
allow Admin configure some strategy-specified options for Glance as
their deployment required.

As an end user, he can get VM or consuming image faster base on this
enhancement. This is not only for 'download' transport handling on the
API server side but also for client since they can obtain locations by
standard 'direct URL' interface.

docImpact
Implements bp: image-location-selection-strategy

Change-Id: I86f192aeae8e5f21a72f946552f6507654c25a6c
Signed-off-by: Zhi Yan Liu <zhiyanl@cn.ibm.com>
Merge "Fix tmp DB path calculation for test_migrations.py"
Merge "Update the glance-api manpage"
Fix the incorrect log message when creating images

When using "nova image-create my_server_id name" to create an image, the
glance api log image id is incorrect in the method create().

Change-Id: I938279526ed5adf5b95ec5f67e78c6465f890898
Closes-bug: #1263647
Merge "fixing typo in rst file"
Merge "Change assertTrue(isinstance()) by optimal assert"
fix bug:range() is not same in py3.x and py2.x

in python3.x, there is no method named xrange(),it
has replaced by range(),which is equal to xrange() in
python2.x. so we must fix this issue.we use six module
to fix this issue.

Change-Id: If4fd7478865e8024025af3e57e42f2a24e1e2bbc
Closes-Bug: #1268439
Check image id format before executing operations

DB2 will raise 'CLI0109E String data right truncation' error if
the given query parameter is longer than the column definition.
As a result, user will run into 500 instead of 404 error though
the malformed id is not existed in DB.
This fix will add image id format checking before executing real
operations.

Closes-Bug: #1263684

Change-Id: I1ab3e38724014032d9290e7dde3f8b6d23b6df6c
Sync unhandled exception logging change from Oslo

copy changes from 1 Oslo commit: Ibf00173a07510b2ec0c81a29624004f17810a4e4
This is related to the bug fix for adding error type to unhandled
exception log message

Change-Id: I5645894aad5944f6a91032ae9ac1f2a0904661f7
Closes-Bug: #1265561
Prevent E500 when delayed delete is enabled

If delayed delete is enabled the user token was not being propagated
properly to the registry in all cases. This resulted in an authentication
error when the API attempted to connect to the registry, which in turn
caused a 500 error from the API.

Fix for bug 1238604.

Change-Id: Ifafc1613db034508abfce7ba5e4df582e6056c10
Tests added for glance/cmd/cache_pruner.py

Related to blueprint glance-cmd+unittests

Integration test test_cache_pruner_main added to cover
chain of calls between glance/cmd/cache_pruner.py and glance/image_cache
module.
Unit test test_cache_pruner_main_runtime_exception_handling added to
cover exception handling for main() method of cache_pruner.py

Change-Id: I7d7b182260a407aed1288a5d136e03cbe029523f
Merge "Fix the incorrect log message when creating images"
Merge "Fix inconsistent doc string and code of db_sync"
Restore image status on duplicate image upload

Glance should not allow already uploaded images to be modified by
another upload. Currently, when configured with the local filesystem
backend, Glance prevents duplicate upload of an already uploaded image
BUT it changes the image status to "saving".

This commit adds a status transition state machine to the domain.Image
class and modifies the domain.Image.status setter function to verify
status transitions based on this state machine - only target states that
can be reached from the image's current state are permitted.

Tests have also been agumented to verify that the original image (meta)
data does not change in case of a conflicting upload.

Closes-Bug: #1241379

Change-Id: I62c5acae4c29abf0691d8279b51c59008f9c0047
Retry failed image download from Swift

If a request to Swift for an image fails before the full image is
downloaded, this will reconnect to Swift and download the remainder of
the image without having to start from scratch.

DocImpact

blueprint retry-swift-download

Change-Id: Ifde68415707506b56ffac1939c6750b216b87a87