Merge "Exit 1 when db sync runs before api_db sync"

This commit is contained in:
Zuul 2019-07-20 03:26:41 +00:00 committed by Gerrit Code Review
commit 063ef486e9
4 changed files with 15 additions and 6 deletions

View File

@ -56,7 +56,10 @@ Nova Database
the cell0 database). If ``--local_cell`` is specified, then only the main
database in the current cell is upgraded. The local database connection is
determined by ``[database]/connection`` in the configuration file passed to
nova-manage.
nova-manage. This command should be run after ``nova-manage api_db sync``.
Returns exit code 0 if the database schema was synced successfully, or 1 if
cell0 cannot be accessed.
``nova-manage db archive_deleted_rows [--max_rows <number>] [--verbose] [--until-complete] [--before <date>] [--purge]``
Move deleted rows from production tables to shadow tables. Note that the
@ -201,6 +204,9 @@ Nova API Database
optional placement database if ``[placement_database]/connection`` is
configured.
Returns exit code 0 if the database schema was synced successfully. This
command should be run before ``nova-manage db sync``.
.. _man-page-cells-v2:
Nova Cells v2

View File

@ -69,10 +69,11 @@ same time.
version of Nova, either in a venv or a separate control plane node,
including all the python dependencies.
* Using the newly installed nova code, run the DB sync.
(``nova-manage api_db sync``; ``nova-manage db sync``). These schema
change operations should have minimal or no effect on performance, and
should not cause any operations to fail.
* Using the newly installed nova code, run the DB sync. First run
``nova-manage api_db sync``, then ``nova-manage db sync``. In a multi-cell
environment, ``nova-manage db sync`` must currently be run in each cell.
These schema change operations should have minimal or no effect on
performance, and should not cause any operations to fail.
* At this point, new columns and tables may exist in the database. These
DB schema changes are done in a way that both the N and N+1 release can

View File

@ -467,6 +467,7 @@ Has "nova-manage cell_v2 map_cell0" been run?
Is [api_database]/connection set in nova.conf?
Is the cell0 database connection URL correct?
Error: %s""") % six.text_type(e))
return 1
return migration.db_sync(version)
def version(self):

View File

@ -729,7 +729,8 @@ Cell %s: 456
"""Asserts that a detailed error message is given when an unknown
error occurs trying to get the cell0 cell mapping.
"""
self.commands.sync()
result = self.commands.sync()
self.assertEqual(1, result)
mock_get_by_uuid.assert_called_once_with(
test.MatchType(context.RequestContext),
objects.CellMapping.CELL0_UUID)