Do not allow the same member to be added twice

This patch add an existence check before add new member for image.

Fixes bug 1231485

Change-Id: I10d37c6f169e070ea6699cca78b6360be9fb11dc
Allow tests to run with both provenances of mox

We currently have a requirement for mox >= 0.5.3.

Confusingly there are two flavours of "mox 0.5.3"
in the wild:

1) pypi's mox-0.5.3.tar.gz (https://pypi.python.org/pypi/mox)
2) Google's mox-0.5.3.tar.gz (https://code.google.com/p/pymox/)

These are not exactly the same; tests which can pass on (1) may
fail on (2).

Fedora packages are based on (1) while Debian/Ubuntu packages
are based on (2).

This is a known issue: https://code.google.com/p/pymox/issues/detail?id=40

When running the tests using a virtual env (1) is used, but
on Debian/Ubuntu when not running using a virtual env (2)
will be used: this leads to 3 of the 1740 tests failing.

This patch allows all 1743 tests to run whether you are running
in a virtual env or using Debian/Ubuntu/Fedora packages.

Fix for bug 1212625.

Change-Id: Ib0b11ec18aafbfb7f3d243bf149b94f93a1c13c9
Adding 'download_image' policy enforcement to image cache middleware

Currently image cache middleware not care 'download_image' policy, the
enforcement caused user receive empty content but with HTTP 200 code
rather than 403 when client attempt to download image using v2 API. And
the real Forbidden exception be logged in glance-api log which image
application action raised. The end user is confused by this behavior.

Fixes bug: 1235378

Related-Id: Ibaa7ccf8613ee3cce4cb6a72e3206a2c94122222
Change-Id: I2822ee553d605b7d49576c886f42fa403cdbccf2
Signed-off-by: Zhi Yan Liu <zhiyanl@cn.ibm.com>
(cherry picked from commit a50bfbf490fd354d08abd25b67aaab83b2a17a85)
Merge "Do not allow the same member to be added twice" into milestone-proposed
Merge "Allow tests to run with both provenances of mox" into milestone-proposed
Glance GET /v2/images fails with 500 due to erroneous policy check

This patch will fix below two issues of V2 ResponseSerializer for
images-list, image-show, image-update and image-download.

1. A user should be able to list/show/update/download image without
needing permission on get_image_location.
2. A policy failure should result in a 403 return code. We're
getting a 500.

Fixes bug 1231255

Change-Id: Ie0ec2d574eea4433c4f610ec66a22cb16cae6dc6
Fixes rbd _delete_image snapshot with missing image

Also ignore if _delete_image returns NotFound when cleaning up
following failed attempt to create a new image with add().

Also added unit tests.

Change-Id: Id66866b4260385a6324cc277c5ac665f81493c89
Fixes: bug 1233097
Update functional tests for swift changes

It seems that a couple of changes to the store calls have slipped
through unnoticed:

* store.add() now returns a 4-tuple
* x-container-read and x-container-write headers use tenant:user rather
  than just tenant.

fixes bug 1236339

Change-Id: Ic5c311bcc2999e13203e0d3ad37bce5ac5f27e2d
Avoid printing URIs which can contain credentials

Fix for bug 1233275.

Change-Id: I24d8b57418eb678767b33840973a632eb2132c6a
Merge "Glance GET /v2/images fails with 500 due to erroneous policy check" into milestone-proposed
Merge "Avoid printing URIs which can contain credentials" into milestone-proposed
Merge "Fixes rbd _delete_image snapshot with missing image" into milestone-proposed