Added alembic, and created an initial database revision.
For the sake of testing with real databases, tools/test-setup.sh is added
so that CI can start up a mysql and/or postgresql database on which to
test migrations. The OpportunisticDBMixin from oslo_db was originally
used for this, but because of the way placement configures the database
this proved hard to debug and get correct, so we've used something
that leverages the available oslo_db tools, but with more visibility.
Because these tests mix sqlite, mysql and postgresql settings in the
potentially the same process we need a way to insure that global
settings for databases do not leak into other tests. This is done with
a reset() on the placement db fixture, called by the msyql and
postgresql tests before and after they run. We also need careful
management of that cleanup when these tests are skipped (because db
server or database is not there).
Those tests will confirm that the models match the migrations so we also
need to remove model files that no longer matter.
Since we no longer need to distinguish among multiple database files, we
can simplify the naming of these files.
Co-Authored-By: Chris Dent <cdent@anticdent.org>
Change-Id: I51ed1e4e7dbb76a3eab23af7d0d106f716059112
This is based on the mysql-migrate-db.sh script but
with the necessary changes for interacting with postgresql.
Long-term it might be possible to refactor both the mysql
and postgresql scripts into a generic script but the
potential complexity in doing that makes it a lower priority
than simply getting pg support for the nova_api/placement
table migration done in Stein.
Change-Id: I1cab3183067ab2e41663ca369509d753442e775c
This adds a script that operators, grenade and deployment projects can
use to extract placement data from the nova_api database into its own
location.
Running this with --mkconfig will write out migrate-db.rc with variables
to be filled out and used to push an actual migration. Unless the
caller passes --migrate we will assume dry-run behavior.
This will run with or without existing placement schema (from
placement-manage db sync) and does not migrate/synthesize the migrate_version
table. This will also refuse to run if it looks like migration has
already been performed with a reliable return code. A reliable code is
also provided for the "this looks like a new deployment" case.
Change-Id: I88172d9527681d5456bf080e19e36d343f43c518
The 'tox -epep8' command takes a long time as it checks
every single file in the Nova git repository (~1,400 at
time of writing).
This makes tox use a simple wrapper around flake8 which
can be told to restrict the check to only files changed
in the current command. This can be invoked in a simple
manner with 'tox -epep8 -- -HEAD'. Since most commits
only touch a handful of files, this will usually be
far faster than checking all 1,400 source files.
To check an entire branch for bisectability it can be
automated via
git rebase -i master -x 'tox -epep8 -- -HEAD'
Change-Id: I157d1ccb883ca02402eee51fd7d6a50f86079389