Provide explicit image create value in Registry v2 API test

Assign an explicit created_at datetime value to image db fixtures,
it be used to fixes race condition in Registry v2 API test cases.

Closes-Bug: #1279753
Change-Id: Ia1957e8c024f81eeaa3c0bc094dd62db1be52d07
Signed-off-by: Zhi Yan Liu <zhiyanl@cn.ibm.com>
Log 'image_id' with all BadStoreURI error messages

- handle all BadStoreUri exceptions raised by 'legacy_parse_uri'
  function in
one location so that it becomes easier to log the error message with
'image_id'
- add tests for 'legacy_parse_uri'

Closes-Bug: #1243704

Change-Id: Ifc5de11832860ed51c1eb359d6f5cf78de8c0ba4
Catch exception when image cache pruning

If a cached image file does not exist, os.stat will throw an exception
and the glance-cache-pruner can fail to run when it encounters
the non-existent file.

Adds a catch for the possible exception and sets file size to 0 so
the glance-cache-pruner can successfully run and prune the cache.

Change-Id: I55bee82c4a7aa0393d36c603c91adb8b44a7c7a3
Fixes: bug #1286240
Include Location header in POST /tasks response

In addition to returning a 201, a successful POST to /tasks
should include a Location header with the direct path to the
newly created resource.

Closes-bug: #1287760

Change-Id: I11001e1d6bb5168f0ee80c3d81574e59ddd47147
Remove import specific validation from tasks resource

Task-type specific validation should not be placed in the the
task resource as this will vary among providers. Validation of
the input values should occur in the task script and be reported
as part of the task status.

Change-Id: Ifbc1af868359e6bd51b18b10cd5402340438917a
Closes-bug: #1288337
Store URI must start with the expected  URI scheme

Add a check to make sure the store location URI starts
with the expected scheme.
Also add some more tests for the location.

Change-Id: I4ef360b3444d29de209a6e90a5ff29bd74f21155
Closes-Bug: #1287495
Add the OVA container format

An OVA package is a tar archive usually containing an OVF directory
inside it. Nova needs to be able to differentiate OVF and OVA based on
the container format in order to extract the relevant information from
it.
This patch adds the OVA container format to the Glance configuration.

Closes-Bug: #1286375

Change-Id: I5034d2943907823a9296e7a5fb41a28f2d92ec5a
Document for API message localization

This patch will add document about how to use the
API message localization.

Partially implements bp i18n-messages

Change-Id: I389103574fc52feed96c592cbafbb52faccda939
Fix glance db migration failed on 031

In fact, the first where expression has filtered the duplicated locations,
and the second filters the locations which have more than 1 rows, so the
second result set is included in the first.
In DB2, if the boolean of where expression is true, it will throw error.
So remove the second where expression to fix glance db migration failed on 031.

Fixes bug #1287087

Change-Id: Id485b6d20696e989d10f3759011387137543918a
Merge "Store URI must start with the expected  URI scheme"
Merge "Add the OVA container format"
Merge "Document for API message localization"
Don't enable all stores by default

Glance currently enables all stores by default. This patch changes that
by removing all stores that require manual configuration and leaving
those that work right out of the box.

Current behavior causes a lot of confusion to users since most of those
stores print errors when they're not configured correctly. All extra
stores should be enabled explicitly by users.

This fix makes tests use http locations. All other locations besides the
default ones should be tested in their own test suites.

DocImpact
Closes-bug: #1255556
Change-Id: I82073352641d3eb2ab3d6e9a6b64afc99a30dcc7
Merge "Log 'image_id' with all BadStoreURI error messages"
Merge "Don't enable all stores by default"
Add copyright text to glance/openstack/common/__init__.py

Synchronize the content of glance/openstack/common/__init__.py to the
one in oslo-incubator.

Change-Id: Idd059e3f4d00d91c9a14cf302fd780044929e3e5
Closes-bug: #1288877
API v2: Allow GET on unowned images with show_image_direct_url

This fixes an issue where copy.deepcopy was being a called
on an ImmutableLocations object, causing a Forbidden to be
raised.

Change-Id: Ia7ac121478cf63d68bd5a3d91faa51a42afeb2fe
Closes-Bug: 1287888
Merge "Provide explicit image create value in Registry v2 API test"
Merge "Remove import specific validation from tasks resource"
Provide an upgrade period for enabling stores

1f6381a73f5c99f1f731d6c4f9defb91bd2d042d disabled all stores by default,
this casues upgrade issues for CD environments and folks that are not
aware of the change. This patch adds a way to attempt enabling the store
if its configuration parameters were set. If the store fails to load and
it's not in `known_stores` then no error will be reported.

The patch also warns the user when a store succeeds to load but it was
not explicitly enabled in `known_stores`. Note that there may be false
positives since some stores may not require any configuration parameter.

Change-Id: Ie784fe90003a5064aaf16fadb7266bf7a46e2cf5
Closes-Bug: #1290969