Merge "Pass a flag to disable LB in baymodels"

This commit is contained in:
Jenkins 2016-07-01 07:59:28 +00:00 committed by Gerrit Code Review
commit 2ce6320531
4 changed files with 14 additions and 3 deletions

View File

@ -42,7 +42,8 @@ BAYMODEL1 = {'id': 123,
'labels': 'key1=val1,key11=val11',
'tls_disabled': False,
'public': False,
'registry_enabled': False}
'registry_enabled': False,
'master_lb_enabled': True}
BAYMODEL2 = {'id': 124,
'uuid': '66666666-7777-8888-9999-000000000002',
@ -258,6 +259,8 @@ class BayModelManagerTest(testtools.TestCase):
self.assertEqual(BAYMODEL1['public'], baymodel.public)
self.assertEqual(BAYMODEL1['registry_enabled'],
baymodel.registry_enabled)
self.assertEqual(BAYMODEL1['master_lb_enabled'],
baymodel.master_lb_enabled)
def test_baymodel_show_by_name(self):
baymodel = self.mgr.get(BAYMODEL1['name'])
@ -283,6 +286,8 @@ class BayModelManagerTest(testtools.TestCase):
self.assertEqual(BAYMODEL1['public'], baymodel.public)
self.assertEqual(BAYMODEL1['registry_enabled'],
baymodel.registry_enabled)
self.assertEqual(BAYMODEL1['master_lb_enabled'],
baymodel.master_lb_enabled)
def test_baymodel_create(self):
baymodel = self.mgr.create(**CREATE_BAYMODEL)

View File

@ -54,7 +54,8 @@ class ShellTest(shell_test_base.TestCommandLineArgument):
'--docker-volume-size 10 '
'--docker-storage-driver devicemapper '
'--public '
'--server-type vm')
'--server-type vm'
'--master-lb-enabled')
self.assertTrue(mock_create.called)
self._test_arg_success('baymodel-create '

View File

@ -21,7 +21,7 @@ CREATION_ATTRIBUTES = ['name', 'image_id', 'flavor_id', 'master_flavor_id',
'coe', 'http_proxy', 'https_proxy', 'no_proxy',
'network_driver', 'tls_disabled', 'public',
'registry_enabled', 'volume_driver', 'server_type',
'docker_storage_driver']
'docker_storage_driver', 'master_lb_enabled']
class BayModel(base.Resource):

View File

@ -108,6 +108,10 @@ def _show_baymodel(baymodel):
help='Specify the server type to be used '
'for example vm. For this release '
'default server type will be vm.')
@utils.arg('--master-lb-enabled',
action='store_true', default=False,
help='Indicates whether created bays should have a load balancer '
'for master nodes or not.')
def do_baymodel_create(cs, args):
"""Create a baymodel."""
opts = {}
@ -132,6 +136,7 @@ def do_baymodel_create(cs, args):
opts['public'] = args.public
opts['registry_enabled'] = args.registry_enabled
opts['server_type'] = args.server_type
opts['master_lb_enabled'] = args.master_lb_enabled
baymodel = cs.baymodels.create(**opts)
_show_baymodel(baymodel)