Add granularity option to purge_deleted

Allow users to choose how many days, hours, minutes, or seconds to preserve
deleted data.

Closes-bug: #1237195

Change-Id: I9227f5bf53c5b099a7a691a49c4ff2f5f0662098
Move db_sync into the sqlalchemy DB api.

heat-manage db_sync is currently broken because
heat is trying to use two backends with the Oslo DB
api which is configurable via heat.conf where only
a single DB api can be specified.

Currently this defaults to:

 #The backend to use for db (string value)
 #db_backend=heat.db.sqlalchemy.api

To fix things we:

1) merge heat/db/migration.py into heat/db/api.py.

2) Add db_sync and db_version calls to heat/db/sqlalchemy/api.py
  which call into the functions in heat/db/sqlalchemy/migration.py.

3) Remove the old heat/db/migration.py module (no longer needed).

In the process we also move the INIT_VERSION constant into
heat/db/sqlalchemy/api.py where it is actually used
anyway. (it probably shouldn't have been in the higher level
migration module to begin with)

This should fix SmokeStack which stopped working last Wednesday
with a05dc4b9cdf348ca1ec414fd505256a6760ad17c

Also,
Closes-bug #1241865

Change-Id: I50d489531056016c762bd3be047e3a129cbee4f8
Merge "Add granularity option to purge_deleted"
Implement stack-locking for multi-engine support

Implements an abstraction for distributed stack locks.  Uses a
database lock by default but has an optional Zookeeper driver that can
be used for production deployments.

Blueprint multiple-engines

Change-Id: I7fba8808d8a4efbe7fd8fdff94fd9a53f3841c8b