Synchronized with oslo db and db.sqlalchemy

In most cases Oslo-incubator contains the most relevant code.
Furthermore in certain cases exists bugs which can be fixed by
synchronization with Oslo. Thus regular sync is required.

                        Changes from oslo-incubator
==============================================================================
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
6d0a6c3 Correct invalid docstrings
fb0e86a Use six.moves.configparser instead of ConfigParser
6603e8f Remove sqlalchemy-migrate 0.7.3 patching
97d8cf4 Remove lazy loading of database backend
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Synced from Oslo-Incubator commit: 517c4cc65969f93b4b758a568725a1625abfd24d

Change-Id: Ida6b38b8e41c73c67170e4ec43943e661f014629
Don't need session.flush in context managed by session

Within the scope of a single method, keeping all the reads and writes within
the context managed by a single session. In this way, the session's __exit__
handler will take care of calling flush() and commit() for you.
If using this approach, you should not explicitly call flush() or commit().
See http://docs.sqlalchemy.org/en/rel_0_7/orm/session.html#committing

Closes-Bug: #1258044
Change-Id: I1125c72712203f1594ef245761dbfc25ed31eab2
Sync oslo-incubator rpc	module

Sync oslo-incubator rpc module with oslo-incubator commit
f8f6fd46b3b9264c21c0ee5547a4e8236cb257ac

Updates consist in using six.iteritem and fixing some typos.

Remove securemessage.py, which in not used anywhere, and dropped from
oslo-incubator since commit f88d59ab8a456e7d2d5a22fc5591491d2f85bdf4

$ python update.py --nodeps --base keystone --dest-dir ../keystone/ --modules rpc
$ git rm keystone/openstack/common/rpc/securemessage.py

Change-Id: I890cf1ce89ce5946522f7891be71a3e58ecc1af3
Cleanup test_associate_project_endpoint_extension

This moves the addCleanup closer to where it's required and
takes care of a TODO. Turns out that cleanup up self.conf_files
is required.

Change-Id: I4229b950fe3dc7e575f921f2b63c4462ed459108
Make common log import consistent

Across the project, make the common log import consistent.

Change-Id: I937cd5d337db5d2296dd9238685803bbba3391b3
Merge "Make common log import consistent"
Merge "Cleanup test_associate_project_endpoint_extension"
Merge "Synchronized with oslo db and db.sqlalchemy"
Merge "Sync oslo-incubator rpc	module"
Merge "Don't need session.flush in context managed by session"