Change compute mgr placement check to region_name

Change https://review.openstack.org/#/c/492247/ in queens deprecated the
[placement]/os_region_name config option and you should be using
'region_name' in that group now, and you'll get a deprecation warning if
using 'os_region_name', but if you do that, nova-compute fails to start.

This patch fix the bug by adding [placement]/region_name to the check.

Change-Id: Iea7d5d0d6907adbcb236dc43b5af7469de2ba78b
Closes-Bug: #1757273
This commit is contained in:
Kevin_Zheng 2018-03-21 09:43:21 +08:00 committed by Eric Fried
parent 3fd863d8bf
commit be9854b0fd
3 changed files with 3 additions and 3 deletions

View File

@ -1131,7 +1131,7 @@ class ComputeManager(manager.Manager):
# NOTE(sbauza): We want the compute node to hard fail if it won't be
# able to provide its resources to the placement API, or it will not
# be able to be eligible as a destination.
if CONF.placement.os_region_name is None:
if CONF.placement.region_name is None:
raise exception.PlacementNotConfigured()
self.driver.init_host(host=self.host)

View File

@ -3711,6 +3711,7 @@ class ComputeManagerUnitTestCase(test.NoDBTestCase):
# Tests that we fail init_host if the placement section is
# configured incorrectly.
self.flags(os_region_name=None, group='placement')
self.flags(region_name=None, group='placement')
self.assertRaises(exception.PlacementNotConfigured,
self.compute.init_host)

View File

@ -77,8 +77,7 @@ class ConfFixture(config_fixture.Config):
self.conf.set_default('keep_alive', False, group="wsgi")
# placement group
self.conf.set_default('os_region_name', 'RegionOne',
group='placement')
self.conf.set_default('region_name', 'RegionOne', group='placement')
config.parse_args([], default_config_files=[], configure_db=False,
init_rpc=False)