Fix 031 migration failed on DB2

031 migration script failed on DB2, because DB2 doesn't support
GROUP BY with clob data type.
Add if condition to judge DB2 connection, if yes, make another sql query
supported by DB2.

Fixes bug #1256816

Change-Id: I7e3a8cd89edd91c167c619365ab863ec53787f8f
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>
Rename Openstack to OpenStack

Change-Id: I96b2283b0ae5bb632da357184dc4aea0ee7656ab
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
Replaced calls of get(foo, None) -> get(foo)

If no default value is specified, the get method of dictionaries
defaults to 'None' already.
So removing the 'None' argument to make the code more clean and
readable.

Change-Id: I2f29315488d515aa2837d06ea59ab41e8ca05fc8
Refactor UUID test

Oslo is removing uuidutils during the icehouse cycle. We had removed
uuidutils.generate_uuid() in https://review.openstack.org/#/c/60643/
It seems the UUID test was not executed, for example, there is no method
called generate_uuid() in common/utils, the Jekins still passed. This
patch move the testcase and remove the test method for generate_uuid.

Change-Id: If4f508129f0b44d63fe77ed1251c0e0737e7e897
Partial-Bug: #1253497
Merge "Rename Openstack to OpenStack"
Sync common db code from Oslo

This sync contains commit ``ce69e7f Don't store engine instances in oslo.db ``
which removed global engine from oslo.db code. So, added code
for work with sqla engines and sessions to Glance - get_engine()
and get_session() functions in glance.db.sqlalchemy.api module.

Also this remove database slave connection and tpool features, because
they was removed from oslo code and seeps to be unused in Glance.

Full list of changes:

7959826 db: move all options into database group
dda24eb Introduce mysql_sql_mode option, remove old warning
0b5af67 Introduce a method to set any MySQL session SQL mode
8dccc7b Handle ibm_db_sa DBDuplicateEntry integrity errors
0f24d82 Fix migration.db_version when no tables
ac84a40 Update log translation domains
c0d357b Add model_query() to db.sqlalchemy.utils module
84254fc Fix a small typo in api.py
b8a676c Remove CONF.database.connection default value
86707cd Remove None for dict.get()
0545121 Fix duplicating of SQL queries in logs
fcf517d Update oslo log messages with translation domains
fa05b7c Restore the ability to load the DB backend lazily
630d395 Don't use cfg.CONF in oslo.db
ce69e7f Don't store engine instances in oslo.db
35dc1d7 py3kcompat: remove
b4f72b2 Don't raise MySQL 2013 'Lost connection' errors
271adfb Format sql in db.sqlalchemy.session docstring
0334cb3 Handle exception messages with six.text_type
eff69ce Drop dependency on log from oslo db code
7a11a04 Automatic retry db.api query if db connection lost
11f2add Clean up docstring in db.sqlalchemy.session
1b5147f Only enable MySQL TRADITIONAL mode if we're running against MySQL
39e1c5c Move db tests base.py to common code
986dafd Fix parsing of UC errors in sqlite 3.7.16+/3.8.2+
9a203e6 Use dialect rather than a particular DB API driver
1779029 Move helper DB functions to db.sqlalchemy.utils
bcf6d5e Small edits on help strings
ae01e9a Transition from migrate to alembic
70ebb19 Fix mocking of utcnow() for model datetime cols
7aa94df Add a db check for CHARSET=utf8
aff0171 Remove "vim: tabstop=4 shiftwidth=4 softtabstop=4" from headers
fa0f36f Fix database connection string is secret
8575d87 Removed copyright from empty files
d08d27f Fix the obsolete exception message
8b2b0b7 Use hacking import_exceptions for gettextutils._
9bc593e Add docstring for exception handlers of session
855644a Removal of _REPOSITORY global variable.
ea6caf9 Remove string.lowercase usage
a33989e Remove eventlet tpool from common db.api
e40903b Database hook enabling traditional mode at MySQL
f2115a0 Replace xrange in for loop with range
c802fa6 SQLAlchemy error patterns improved
1c1f199 Remove unused import
97d8cf4 Remove lazy loading of database backend

Co-authored-by: Zhi Yan Liu <zhiyanl@cn.ibm.com>

Related to blueprint db-use-oslo-common-code

Change-Id: Ia73abba8309ccc2ad10a0f636b410984c6b6e5d8
VMware storage backend should use oslo.vmware

Currently, the VMware store is using its own copy of the
VMwareApiSession to connect to vCenter server and ESX(i).
This patch gets rid of this copy to use the oslo.vmware library.

Closes-Bug: #1282715

Change-Id: I0aa47eada388c09d9835b00fb2c93f50f22675a4
Merge "Fix 031 migration failed on DB2"
Merge "VMware storage backend should use oslo.vmware"
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
Merge "Refactor UUID test"
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
Documentation for Glance tasks

Added some docs for:-
    - configuration
    - notifications
    - statuses

partially implements blueprint async-glance-workers

Change-Id: I4e33bc3be2278d6906968d1dac3aff6587eef6df
Merge "Documentation for Glance tasks"
Merge "Sync common db code from Oslo"
Merge "Replaced calls of get(foo, None) -> get(foo)"
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