Forbidden update message diffs images/tasks/member

On an forbidden update, the message returned to the user
is not tied to the type of object modified by the operation.
For example: a forbidden image member update will return
`You are not permitted to modify 'status' on this image.`
instead of image_member.

This patch fixes the issue for images, image members and tasks.

Change-Id: Ie9774807f0190a517a619aeb56c1398741ac4407
Closes-Bug: #1250228
Remove unused exceptions

Removed the exception classes in the following because not referenced
anywhere.

 -MissingArgumentError
 -NotAuthorized

Change-Id: I9f8d8e865447d772a9c09141b96075620c6d1b07
Closes-Bug: #1259818
Replace startswith by more precise store matching

Currently a source is considered valid if it only starts with a specific set
of word. For example swift is a valid location scheme, so is swiftpe or
swiftopenstack with the current implementation. This commit compare the scheme
of the location - all of it - to a given set of supported schemes

Change-Id: Ie827c3c3f36fbf958a1270039cab28d4c5fc4fe1
Closes-Bug: #1257496
Fix and enable gating on H702

Formatting operations should be outside of localization,
otherwise translation lookup will never find a translated
string as a match. This also fixes H701 alongway.

Change-Id: I6708e0f5b11841b18ba9042ac4958643f91396dd
assertEquals is deprecated, use assertEqual instead

Change-Id: Ie67c4c84eb74d7ed27b3c6c253239aaa1aff4862
Fix simple-db image filtering on extra properties

This fixes a bug in simple DB that causes filtering of images based on
extra-properties to fail. The current code works only when an image has no
extra-properties or exactly one. The current test suite doesn't include a test
that tries to filter images based on more than one extra-property.

Also, added both functional and unit tests to test image list with filters
using more than one extra-property.

Fixes bug: 1259227
Change-Id: I4c0d294585235dacbf154bf0df5d1e7c4a172cdd
Merge "Replace startswith by more precise store matching"
Merge "Fix simple-db image filtering on extra properties"
Cleanly fail when location URI is malformed

At the moment when a malformed URI is passed at either image creation
or update Glance fails with an Error 500. This commit allows Glance
to fails cleanly with a 400 BadStoreUri.

Change-Id: Iffe9be3b65758d18c7e7f96b3ceb3399b9748b63
Closes-bug: #1257498
Merge "assertEquals is deprecated, use assertEqual instead"
Enable tasks REST API for async worker

- add REST API layer for async worker(tasks) to
support tasks operations.
- update to include sparse task for tasks.index
- add domain proxies for handling  authorization,
policy enforce, notification while processing
task requests.
- add Task domain entity and TaskFactory to create
new Task domain entity objects.
- add integration test for testing tasks api

Co-authored-by: Fei Long Wang <flwang@cn.ibm.com>

Partially implement blueprint async-glance-workers

Change-Id: I072cbf351c06f59a7702733b652bfa63e5abbaa6
Merge "Fix and enable gating on H702"
Merge "Remove unused exceptions"
V2: disallow image format update for active status

The V2 API doesn't not allow empty `container_format` and `disk_format`
when creating a new image.
Currently, it is possible to update these properties after data have
been saved to the image which is contradictory with the previous
statement.
This change disallows modifications of these properties for images with
a status different than `queued`.

Change-Id: I98c22197ba6d96470976718d48ac53748a19ffc6
Closes-Bug: #1249412
Merge "Enable tasks REST API for async worker"
Merge "Forbidden update message diffs images/tasks/member"
Return 204 when image data does not exist

Currently a GET on image-data in glance v2 returns 404 when data does not
exist. But according to the API docs the HTTP status code returned in this
case should be 204.

This fix makes Glance return the right HTTP status code.

Change-Id: I34cf68e96f631f05cff349329245f74aee42397c
Closes-Bug: #1251055
Merge "Cleanly fail when location URI is malformed"
Merge "V2: disallow image format update for active status"
Fixes HTTP 500 when updating image with locations for V2

Based on current implement, user will run into 500 error during
updating locations for a queued image. The root cause is we're
trying to calculate the overall size with current image size and
the number of locations. This fix will get the correct image size
from backend store if current image size is not available.

Fixes bug 1257507

Change-Id: Ia4ac73e36211d475752ee9f4995fc3768fb2981a