Merge "Fix the generated cell0 default database name"
This commit is contained in:
+4
-4
@@ -1120,7 +1120,7 @@ class CellV2Commands(object):
|
||||
metavar='<database_connection>',
|
||||
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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 `<API database name>_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 `<main database name>_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.
|
||||
|
||||
@@ -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``.
|
||||
@@ -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 `<API database name>_cell0` as
|
||||
it will create a cell mapping for cell0 based on the API database
|
||||
expects the name of the cell0 database to be `<main database name>_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.
|
||||
|
||||
Reference in New Issue
Block a user