Handle session timeout in the VMware store

The current implementation can lead to session timeouts. This
will occur when accessing the datastore directly through HTTP.
This patch provides a retry mechanism by recreating the session
when getting a 401 status code.

Change-Id: I54cc9e30c9bc374a2cf82dec4beb9b06594835f8
Closes-Bug: #1311960
Some exceptions raise UnicodeError

Use utils.exception_to_str to consistently cast the
exception to avoid the unicodeError stack trace.

Closes-Bug: #1340002
Related-Id: I54fce91c73adca846ec99ed50a57b95d16428ec1

Change-Id: I77478a8eeeefd85bf98138156429df53d0a4c079
Signed-off-by: Zhi Yan Liu <zhiyanl@cn.ibm.com>
Pass Message object to webob exception

Provide the Message object within Glance exception to webob exception
instead of try to convert it to a string. Because Message objects could
not be converted by str() since they may contain non-ascii characters.

Related-Bug: #1292782
Related-Id: I22b9123d8b3fe58d7dbd8fcde5a8dd58000e2da4
Related-Id: I352cda57fe119022c59c6c813b5c8053765b2d3c

Change-Id: I43fc0e13496cbaf8a7afe85d649709ec7fe8ebe9
Signed-off-by: Zhi Yan Liu <zhiyanl@cn.ibm.com>
Fix unsaved exception in v1 API controller

When an exception occurs during exception handling, it lose the
information of the first exception.

We should use the excutils.save_and_reraise_exception() in this case.

Change-Id: I467c9627fa661421926d50c3e894f80d9b75baa2
Signed-off-by: Zhi Yan Liu <zhiyanl@cn.ibm.com>
Changing replicator to use openstack.common.log

This change moves glance/cmd/replicator to use common logging.
Changes logging.<level>() to be unified with rest as LOG.<level>().
Also fixes some translations.

Related to bp refactoring-glance-logging

Change-Id: Iff4ecf9ab95174b9be9861fe0d8fd40162eadb8a
Add task functions to v2 registry

If local changes are made to run the v2 functional
tests with the v2 registry enabled, and the tests
are then run with:

$ ./run_tests.sh glance.tests.functional.v2

all tests pass except for 'test_task_lifecycle'.

This test fails because the v2 registry does not define the
'task_get_all' or 'task_create' functions.

With these defined the tests pass when run with the v2 registry enabled.

This is a prerequisite to running the v2 functional tests with the
registry enabled.

Change-Id: I588af10105b19087d06f7f13a6f75523595d4a23
Closes-Bug: 1308419
Merge "Add task functions to v2 registry"
Merge "Handle session timeout in the VMware store"
Merge "Some exceptions raise UnicodeError"
Merge "Fix unsaved exception in v1 API controller"
Adding status field to image location -- domain and APIs changes

Adding a status field to image's each location property, each location
status can be 'active', 'pending_delete' and 'deleted'.

Under location's status information Scrubber service can make cleanup
based on DB records also but not a dedicated queue-file for each image.

This is second part of this change which covered DB API, domain and REST
API.

Partially-Implements BP: image-location-status

Change-Id: I744679e2dadbaec099aef33d8c5a3fe4ecf96865
Signed-off-by: Zhi Yan Liu <zhiyanl@cn.ibm.com>
Merge "Changing replicator to use openstack.common.log"
Merge "Pass Message object to webob exception"
Merge "Adding status field to image location -- domain and APIs changes"