Move some context checking code from sqlalchemy

Move some context related code from sqlalchemy into nova/context.py
where it can be used outside of sqlalchemy.

Change-Id: I6522a072132e27b42561435cb4fd671a2ece4867
Retry bw_usage_update() on innodb Deadlock

Adds a new decorator _retry_on_deadlock() to sqlalchemy api.  This patch
makes bw_usage_update() use it.

Fixes bug 1129622

Change-Id: I0293c62d2dd5ac036445bc639cabbd05ba016e83
Use DBAPI from oslo I have up for review.
MySQLdb: Add framework for mysqldb impl

Adds MySQLdb api which just falls back to sqlalchemy.  Adds the
connection handling and the frameworks for models and queries.

Implements bp db-mysqldb
MySQLdb: Add bandwidth usage update

Adds bw_usage_update()

Implements bp/db-mysqldb-impl
MySQLdb: Add instance_get methods

Add instance_get_by_uuid() and instance_get_all()

Implements bp/db-mysqldb-impl
MySQLdb: Add instance destroy

Adds instance_destroy().

Implements bp/db-mysqldb-impl
MySQLdb: Adds info_cache get/update/delete.

Adds instance_info_cache_get, update(), and delete()

Implements bp/db-mysqldb-impl
MySQLdb: Adds instance_update calls.

Adds instance_update() and instance_update_and_get_original()

Implements bp/db-mysqldb-impl
MySQLdb: Start of security group rules stuff