diff --git a/nova/cmd/manage.py b/nova/cmd/manage.py index 356edc295489..57b68a2849e5 100644 --- a/nova/cmd/manage.py +++ b/nova/cmd/manage.py @@ -1257,7 +1257,7 @@ class CellV2Commands(object): metavar='', help='The database connection url for cell0. ' 'This is optional. If not provided, a standard database ' - 'connection will be used based on the API database connection ' + 'connection will be used based on the main database connection ' 'from the Nova configuration.' ) def map_cell0(self, database_connection=None): @@ -1272,11 +1272,11 @@ class CellV2Commands(object): """ def cell0_default_connection(): # If no database connection is provided one is generated - # based on the API database connection url. + # based on the database connection url. # The cell0 database will use the same database scheme and - # netloc as the API database, with a related path. + # netloc as the main database, with a related path. scheme, netloc, path, query, fragment = \ - urlparse.urlsplit(CONF.api_database.connection) + urlparse.urlsplit(CONF.database.connection) root, ext = os.path.splitext(path) path = root + "_cell0" + ext return urlparse.urlunsplit((scheme, netloc, path, query, diff --git a/nova/tests/unit/test_nova_manage.py b/nova/tests/unit/test_nova_manage.py index 62197a8eab17..126835456ec5 100644 --- a/nova/tests/unit/test_nova_manage.py +++ b/nova/tests/unit/test_nova_manage.py @@ -1114,22 +1114,22 @@ class CellV2CommandsTestCase(test.TestCase): def test_map_cell0_default_database(self): CONF.set_default('connection', - 'fake://netloc/nova_api', - group='api_database') + 'fake://netloc/nova', + group='database') ctxt = context.RequestContext() self.commands.map_cell0() cell_mapping = objects.CellMapping.get_by_uuid(ctxt, objects.CellMapping.CELL0_UUID) self.assertEqual('cell0', cell_mapping.name) self.assertEqual('none:///', cell_mapping.transport_url) - self.assertEqual('fake://netloc/nova_api_cell0', + self.assertEqual('fake://netloc/nova_cell0', cell_mapping.database_connection) def _test_migrate_simple_command(self, cell0_sync_fail=False): ctxt = context.RequestContext() CONF.set_default('connection', - 'fake://netloc/nova_api', - group='api_database') + 'fake://netloc/nova', + group='database') values = { 'vcpus': 4, 'memory_mb': 4096, @@ -1168,7 +1168,7 @@ class CellV2CommandsTestCase(test.TestCase): objects.CellMapping.CELL0_UUID) self.assertEqual('cell0', cell_mapping.name) self.assertEqual('none:///', cell_mapping.transport_url) - self.assertEqual('fake://netloc/nova_api_cell0', + self.assertEqual('fake://netloc/nova_cell0', cell_mapping.database_connection) # Verify the cell mapping diff --git a/releasenotes/notes/cells-single-migration-command-0e98d66e31e02a50.yaml b/releasenotes/notes/cells-single-migration-command-0e98d66e31e02a50.yaml index def0454664b1..c92d2ef6ef9c 100644 --- a/releasenotes/notes/cells-single-migration-command-0e98d66e31e02a50.yaml +++ b/releasenotes/notes/cells-single-migration-command-0e98d66e31e02a50.yaml @@ -10,4 +10,9 @@ upgrade: The new command is "nova-manage cell_v2 simple_cell_setup --transport_url " where transport_url is the connection information for the current message - queue used by Nova. + queue used by Nova. Operators must create a new database for cell0 before + running `cell_v2 simple_cell_setup`. The simple cell setup command expects + the name of the cell0 database to be `
_cell0` as it + will create a cell mapping for cell0 based on the main database connection, + sync the cell0 database, and associate existing hosts and instances with + the single cell. diff --git a/releasenotes/notes/fix-default-cell0-db-connection-f9717053cc34778e.yaml b/releasenotes/notes/fix-default-cell0-db-connection-f9717053cc34778e.yaml new file mode 100644 index 000000000000..d4f73498a415 --- /dev/null +++ b/releasenotes/notes/fix-default-cell0-db-connection-f9717053cc34778e.yaml @@ -0,0 +1,10 @@ +--- +fixes: + - | + The ``nova-manage cell_v2 simple_cell_setup`` command now creates the + default cell0 database connection using the ``[database]`` connection + configuration option rather than the ``[api_database]`` connection. The + cell0 database schema is the `main` database, i.e. the `instances` table, + rather than the `api` database schema. In other words, the cell0 database + would be called something like ``nova_cell0`` rather than + ``nova_api_cell0``. \ No newline at end of file