Cleanup nits in placement database changes

A few followups were identified in
I2fff528060ec52a4a2e26a6484bdf18359b95f77 and
Ic87518948ed5bf4ab79f9819cd94714e350ce265:

* explaining that the PlacementFixture usually needs the placement
  database

* removing an unused argument from _get_db_conf and commenting on the
  logic that calls it

* correcting "traits database" to "traits table"

Change-Id: I8f3c91ecc9295957579c5a74b087a51bfce3b1a7
This commit is contained in:
Chris Dent 2018-06-21 10:24:32 +01:00
parent 9882a60e69
commit e985f5ed52
3 changed files with 14 additions and 6 deletions

View File

@ -20,14 +20,13 @@ from oslo_db.sqlalchemy import enginefacade
placement_context_manager = enginefacade.transaction_context()
def _get_db_conf(conf_group, connection=None):
kw = dict(conf_group.items())
if connection is not None:
kw['connection'] = connection
return kw
def _get_db_conf(conf_group):
return dict(conf_group.items())
def configure(conf):
# If [placement_database]/connection is not set in conf, then placement
# data will be stored in the nova_api database.
if conf.placement_database.connection is None:
placement_context_manager.configure(
**_get_db_conf(conf.api_database))

View File

@ -86,7 +86,7 @@ def deploy(conf):
def update_database():
"""Do any database updates required at process boot time, such as
updating the traits database.
updating the traits table.
"""
ctx = db_api.DbContext()
resource_provider.ensure_trait_sync(ctx)

View File

@ -1717,6 +1717,15 @@ class PlacementFixture(placement.PlacementFixture):
It's possible to ask for a specific token when running the fixtures so
all calls would be passing this token.
Most of the time users of this fixture will also want the placement
database fixture (called first) as well:
self.useFixture(nova_fixtures.Database(database='placement'))
That is left as a manual step so tests may have fine grain control, and
because it is likely that these fixtures will continue to evolve as
the separation of nova and placement continues.
"""
def setUp(self):