Filter out deleted images from storage usage

All database API's currently include deleted images in the calc of
storage usage. This is not an issue when deleted images don't have
locations. However, there are cases where a deleted image has deleted
locations as well and that causes the current algorithm to count those
locations as if they were allocating space.

Besides this bug, it makes sense to not load deleted / killed /
pending_delete images from the database if we're actually not
considering them as valid images.

The patch also filters out deleted locations.

NOTE: In the case of locations, it was not possible to add a test for
the deleted locations because it requires some changes that are not
worth in this patch. In order to mark a location as deleted, it's
necessary to go through the API and use a PATCH operation. Since this is
a database test, it doesn't make much sense to add API calls to it.
Calling the image_destroy function with an empty location list will
remove all the locations which won't help testing that specific case.

I'll work on a better solution for that in a follow-up patch.

DocImpact:

    The patch now excludes deleted images from the count, this fixes a
    bug but changes the existing behaviour.

    The patch excludes images in pending_delete from the count, although
    the space hasn't be freed yet. This may cause the quota to be
    exceeded without raising an error until the image is finally deleted
    from the store.

Conflicts:
	glance/tests/functional/db/test_sqlalchemy.py

Closes-Bug: #1261738
(cherry picked from commit b35728019e0eb89c213eed7bc35a1f062c99dcca)
Change-Id: I82f08a8f522c81541e4f77597c2ba0aeb68556ce
Check first matching rule for protected properties

When using roles to define protected properties, the first matching rule
in the config file should be used to grant/deny access. This change
enforces that behaviour.

References bug 1271426

Change-Id: Id897085f93bcd143ec443f477f666d4cabd77567
(Cherry-picked from b6dd538569ebf0f1580c8e1fadc5e0f8054c9b08)
Conflicts:
    glance/common/property_utils.py
    glance/tests/etc/property-protections.conf
    glance/tests/unit/common/test_property_utils.py
Removes logging of location uri

This patch removes logging of sensitive store location uri, which
is logged when an exception occurs while trying to get the object
from the store or due to a failure in getting the store api due to
unauthorized context.

fixes bug 1275062

Change-Id: I679baa0897f242f4b8372c9c1c7ab28ae811f5e5
Merge "Filter out deleted images from storage usage" into stable/havana
Merge "Removes logging of location uri" into stable/havana
Bump stable/havana next version to 2013.2.3

Change-Id: Ia5b940faf01df6cae58df1f4b4f5e8fa2f3f078a
Raise max header size to accommodate large tokens

The former max header (8192) is exceeded in the following scenario
- Auth tokens built with a keystone v3 API catalog
- A catalog with approximately 8 or more endpoints defined

Equivalent fixes have been proposed in other projects

Change-Id: Ic714166440e2aa08b619ab1e5e5e0cf3cea3e309
Closes-Bug: 1190149