diff --git a/nova/cmd/manage.py b/nova/cmd/manage.py index aef4497ee56f..b12d3dfa3fe9 100644 --- a/nova/cmd/manage.py +++ b/nova/cmd/manage.py @@ -1120,7 +1120,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): @@ -1135,11 +1135,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 4ffda031205a..b54cbb3365f4 100644 --- a/nova/tests/unit/test_nova_manage.py +++ b/nova/tests/unit/test_nova_manage.py @@ -1115,22 +1115,22 @@ class CellV2CommandsTestCase(test.NoDBTestCase): 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, @@ -1169,7 +1169,7 @@ class CellV2CommandsTestCase(test.NoDBTestCase): 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 4e9a52764be5..c92d2ef6ef9c 100644 --- a/releasenotes/notes/cells-single-migration-command-0e98d66e31e02a50.yaml +++ b/releasenotes/notes/cells-single-migration-command-0e98d66e31e02a50.yaml @@ -12,7 +12,7 @@ upgrade: where transport_url is the connection information for the current message 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 API database connection, sync - the cell0 database, and associate existing hosts and instances with the - single cell. + 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 diff --git a/releasenotes/notes/ocata-requires-cellv2-96bd243be874d77f.yaml b/releasenotes/notes/ocata-requires-cellv2-96bd243be874d77f.yaml index ad0f39ec33d4..7dc8efe20760 100644 --- a/releasenotes/notes/ocata-requires-cellv2-96bd243be874d77f.yaml +++ b/releasenotes/notes/ocata-requires-cellv2-96bd243be874d77f.yaml @@ -6,7 +6,7 @@ upgrade: will want to run `nova-manage cell_v2 simple_cell_setup` on Newton before upgrading. 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 API database + 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.