Tests added for glance/cmd/cache_cleaner.py

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

Change-Id: Ic05f35dd3f0a93d4331ccb5e470cdb71d9eab605
RBD add() now returns correct size if given zero

If the RBD store add() is provided with image_size of zero, it
will calculate based on data provided and return the new size.

Change-Id: I06375bcfef7808905b466432e5ca100c942297eb
Closes-bug: 1256044
Glance image-list failed when image number exceed DEFAULT_PAGE_SIZE

The root cause of the problem is that DB2 does not allow
an empty string ('') for datetime field. So we set the
default value of datetime as None.

Fixes bug 1245947

Change-Id: Ie372efe70a068024298fbde4574e33e565cc6c9a
Remove TestRegistryDB dependency on TestRegistryAPI

TestRegistryDB does not set up the sqlalchemy db it uses with the db models.
These tests only pass when run in conjunction with TestRegistryAPI because that
test case does set up the db. TestRegistryDB should set up the DB as it needs
to.

Fixes bug 1247629

Change-Id: Ib0629634e567e1fb9b98dac50025f5309cd4efec
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
Added error logging for http store

http store logs an error message when the remote location
fails to return the image, returns invalid status or
if it exceeds maximum redirects

Change-Id: I43c74395bc4632a97761ae4c11474bfeb823c85a
Closes-Bug: #1257234
remove hardcode of usage

Refine the definition of USAGE in control.py

Change-Id: I0f515565455e867384ae179a8eca8e35cb0ff3ad
Refactor StorageQuotaFull test cases in test_quota

There were two test cases in test_quota that shared the same name, but
did almost the same thing. After a bit of digging, it looked like most
of the test cases did the almost same thing, so I refactored the common
bits and fixed the test case name duplication.

Partial-Bug: #1259036
Change-Id: I828eea570d358d98520c7201454c03ba174a35ad
Enforce copy_from policy during image-update

The enforcement of the copy_from policy is missing during update allowing
every user to do this action no matter what is defined in the policy.json

Change-Id: Iecf11bdf220b37d9ecbb6fc686214d14acf1d3dd
Closes-bug: #1259241
Merge "RBD add() now returns correct size if given zero"
Merge "Remove TestRegistryDB dependency on TestRegistryAPI"
Merge "Refactor StorageQuotaFull test cases in test_quota"
Merge "Added error logging for http store"
Merge "Glance image-list failed when image number exceed DEFAULT_PAGE_SIZE"
Merge "Tests added for glance/cmd/cache_cleaner.py"
Remove duplicate method __getitem__ in quota/__init__.py

Fixes bug 1259477

Change-Id: I19446881a5e23f0f72e0e383b3330ce851277f89
Merge "Enforce copy_from policy during image-update"
Merge "Remove duplicate method __getitem__ in quota/__init__.py"
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