Refactor work with session in db.block_device_mapping_* methods

Remove explicit use of session where it is not required.
Also this is small performance optimization, because if we put
session parameter to Models.save() method will create subtransaction.

blueprint db-session-cleanup

Change-Id: I6064f3df2daf0178009c4cf40da293f71ca6972a
Make run_instance() bail quietly if instance has been deleted

Right now, we make a big mess in the logs if someone deletes an
instance before we get a chance to run it. This cleans that up
to a single warning message.

Fixes bug 1154292

Change-Id: I2de0c2993d6a16d9482878eee4eef10bfd78c3e6
Don't load system_metadata when it isn't joined.

If we always load system_metadata, it will throw a sqlalchemy
error if it isn't joined in the column. Rather than putting it
in extra keys we need to explicitly join it if it is missing.

Adds a test to make sure that system_metadata is returned
properly from the migration call even though the extra keys
parameter was removed.

Fixes bug 1146000

Change-Id: I05365906ed528a06fe5704449dab72c857fefa65
Fix use of potentially-stale instance_type in tenant_usage

The simple_tenant_usage API extension may return incorrect billing
information if a flavor is changed or deleted while an instance using
it is still running. This makes it use the stashed instance_type instead.

Fixes bug 1154707

Change-Id: Ifce33488e5ef8aa942051d882407a3e2d088aaf5
Merge "Make run_instance() bail quietly if instance has been deleted"
Merge "Fix use of potentially-stale instance_type in tenant_usage"
Merge "Refactor work with session in db.block_device_mapping_* methods"
Merge "Don't load system_metadata when it isn't joined."