Merge "Replace default_availability_zone with default_schedule_zone"

This commit is contained in:
Jenkins 2017-08-11 07:19:43 +00:00 committed by Gerrit Code Review
commit 905962ed32
3 changed files with 16 additions and 7 deletions

View File

@ -34,9 +34,19 @@ opts = [
default=60,
help=_('Interval between syncing the resources from underlying '
'hypervisor, in seconds.')),
cfg.StrOpt('default_availability_zone',
default='mogan',
help=_("Default bare metal node availability zone.")),
cfg.StrOpt('default_schedule_zone',
help="""
Availability zone to use when user doesn't specify one.
This option is used by the scheduler to determine which availability
zone to place a new server into if the user did not specify one at the
time of server boot request.
Possible values:
* Any string representing an availability zone name
* Default value is None.
"""),
cfg.IntOpt('sync_power_state_pool_size',
default=1000,
help=_("Number of greenthreads available for use to sync "

View File

@ -275,7 +275,7 @@ class API(object):
self._get_image(context, image_uuid)
if not availability_zone:
availability_zone = CONF.engine.default_availability_zone
availability_zone = CONF.engine.default_schedule_zone
base_options, max_net_count, key_pair = \
self._validate_and_build_base_options(
@ -404,7 +404,6 @@ class API(object):
context, 'availability_zone')
azs = set([agg.metadata['availability_zone'] for agg in aggregates
if 'availability_zone' in agg.metadata])
azs.add(CONF.engine.default_availability_zone)
return {'availability_zones': list(azs)}
def lock(self, context, server):

View File

@ -152,7 +152,7 @@ class TestServers(v1_test.APITestV1):
self.assertEqual(self.FLAVOR_UUID, resp['flavor_uuid'])
self.assertEqual('b8f82429-3a13-4ffe-9398-4d1abdc256a8',
resp['image_uuid'])
self.assertEqual('mogan', resp['availability_zone'])
self.assertIsNone(resp['availability_zone'])
self.assertEqual([], resp['nics'])
self.assertEqual({'fake_key': 'fake_value'}, resp['metadata'])
self.assertIn('links', resp)
@ -174,7 +174,7 @@ class TestServers(v1_test.APITestV1):
self.assertEqual(self.FLAVOR_UUID, resp['flavor_uuid'])
self.assertEqual('b8f82429-3a13-4ffe-9398-4d1abdc256a8',
resp['image_uuid'])
self.assertEqual('mogan', resp['availability_zone'])
self.assertIsNone(resp['availability_zone'])
self.assertEqual([], resp['nics'])
self.assertEqual({'fake_key': 'fake_value'}, resp['metadata'])
self.assertIn('links', resp)