Add support for directly stringifying VersionInfo.

glanceclient, and others, want to have a __version__ member in their
top-level __init__.py. This leads to attempting to process the
version information to realize the string at import time, rather
than at request time. If we make VersionInfo a thing which can
behave like a string, then, we should get the things we want without
the operational weirdness.

Change-Id: I3eb15006f50ed1155c85977aaae842677c5ec4bc
Add missing DBDuplicateEntry

The session.py part of nova's 8835866 was imported, but not the newly
added exception.

Change-Id: I0d79a8536f0c8f14cb062dc61c5fce100b63fd64
Fix eventlet/mysql db pooling code

Eventlet versions >= 0.10 return a tuple from
db_pool.ConnectionPool().create(), not a scalar.

Also, set the FOUND_ROWS client flag, which sqlalchemy
appears to require to sanity check the number of rows
touch.

bug 1097992

Change-Id: I64e798660c506fcd13947a232cb7832db0318360
Fix missing wrap_db_error for Session.execute() method

We should add wrap_db_error for Session.execute() method, because
Query.update() method will call Session.execute() and it is not inside
Session.flush(), so exceptions from Query.update() wouldn't be wrapped.

Add test for Session.flush() wrapper
Add test for Session.execute() wrapper

Fixes bug 1107890

Change-Id: I96894e502f9f279999b61a1e66469e34a07a022d
Provide creating real unique constraints for columns

Main issue is that we can't create unique constraint for columns, because
we are using soft deletion of entries (set `deleted` column to True).

The main idea is to use `deleted` columns to create unique constraint for
columns. For example (`col1`, `deleted`).

To make (`col1`, `deleted`) unique after entry deletion, we should assign the
value of `id` to `deleted` column.

Change type of `deleted` column from Boolean to table.id.type for all tables.

Change models.soft_delete() method to assign table.id instead of True to
`deleted` column.

Change query.soft_delete() method to assign literal_column("id") instead of True

blueprint db-unique-keys

Change-Id: Ie1f67f49a5d085e6371efb63fc23a1c8b25d9464
Remove openstack.common.db.common

Since this only contains exceptions that are either used in session.py
or utils.py (not both), it seems sensible to move them into the modules
where they are used.

Also, remove the use of the Invalid base exception class since we don't
seem to be making use of the base class anywhere by catching it rather
than the more specialized exceptions.

Change-Id: Ib05bb2e0a9494e1dc60c60b8eee0e76b5d2ee555
Remove unused context from test_sqlalchemy

Change-Id: I0b3c7341e91cfc57aed625754bc9bf009ef70b14
Remove pointless use of OpenStackException

The use of the base exception does nothing for the test but means
the "dead module walking" exception module.

Change-Id: Ibd7bb8aa526be366f005ab5e12fd4da89a976c57
Minor tweak to make update.py happy

Fairly lame to do this instead of just fixing update.py, but we
seem to do it this way everywhere else, so ...

Change-Id: Ie1cebcfec57c6138b9b726d7d3bc6e0ea456f146
Fix sorting in test-requires

Change-Id: Ic45ac7c85dbe2834d7b325ba8babf71429b277b0
Use importutils.try_import() for MySQLdb

This is a common pattern we've adopted elsewhere, so use it here too.

Change-Id: I2e0947b4857005b478e796e9c9a7c05ea1f0d926
Allow to_primitive to ignore datetimes

In preparation for having nova.db.api not return any sqlalchemy objects.
nova.db.api will return only primitives, except for datetime.datetime
objects.

Uses functools.partial to make code DRYING

Partially implements bp db-api-cleanup

Change-Id: I9980d8c4e20b05bbe734cf90ac209e4e7e89befb
Merge "Allow to_primitive to ignore datetimes"