diff --git a/doc/source/cli/nova-manage.rst b/doc/source/cli/nova-manage.rst index 218da9cc90fd..a7694f17c944 100644 --- a/doc/source/cli/nova-manage.rst +++ b/doc/source/cli/nova-manage.rst @@ -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 ] [--verbose] [--until-complete] [--before ] [--purge]`` Move deleted rows from production tables to shadow tables. Note that the @@ -180,6 +183,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 diff --git a/doc/source/user/upgrade.rst b/doc/source/user/upgrade.rst index 26373edd280d..b83f84664b9b 100644 --- a/doc/source/user/upgrade.rst +++ b/doc/source/user/upgrade.rst @@ -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 diff --git a/nova/cmd/manage.py b/nova/cmd/manage.py index 441ca2646db5..0d06efa7927f 100644 --- a/nova/cmd/manage.py +++ b/nova/cmd/manage.py @@ -476,6 +476,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): diff --git a/nova/tests/unit/test_nova_manage.py b/nova/tests/unit/test_nova_manage.py index 3651d91c7f69..0cbb846d2cda 100644 --- a/nova/tests/unit/test_nova_manage.py +++ b/nova/tests/unit/test_nova_manage.py @@ -728,7 +728,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)