Merge "Fix validation for master_lb_enabled"

This commit is contained in:
Zuul 2021-01-05 18:34:57 +00:00 committed by Gerrit Code Review
commit f2aae8834e
4 changed files with 5 additions and 4 deletions

View File

@ -209,7 +209,7 @@ def validate_os_resources(context, cluster_template, cluster=None):
def validate_master_count(cluster, cluster_template):
if cluster['master_count'] > 1 and \
not cluster_template['master_lb_enabled']:
not cluster['master_lb_enabled']:
raise exception.InvalidParameterValue(_(
"master_count must be 1 when master_lb_enabled is False"))

View File

@ -803,7 +803,7 @@ class TestPost(api_base.FunctionalTest):
cluster_template = obj_utils.create_test_cluster_template(
self.context, name='foo', uuid='foo', master_lb_enabled=False)
bdict = apiutils.bay_post_data(baymodel_id=cluster_template.name,
master_count=3)
master_count=3, master_lb_enabled=False)
response = self.post_json('/bays', bdict, expect_errors=True)
self.assertEqual('application/json', response.content_type)
self.assertEqual(400, response.status_int)

View File

@ -845,7 +845,8 @@ class TestPost(api_base.FunctionalTest):
cluster_template = obj_utils.create_test_cluster_template(
self.context, name='foo', uuid='foo', master_lb_enabled=False)
bdict = apiutils.cluster_post_data(
cluster_template_id=cluster_template.name, master_count=3)
cluster_template_id=cluster_template.name, master_count=3,
master_lb_enabled=False)
response = self.post_json('/clusters', bdict, expect_errors=True)
self.assertEqual('application/json', response.content_type)
self.assertEqual(400, response.status_int)

View File

@ -101,7 +101,7 @@ def get_test_cluster(**kw):
'fixed_network': kw.get('fixed_network', None),
'fixed_subnet': kw.get('fixed_subnet', None),
'floating_ip_enabled': kw.get('floating_ip_enabled', True),
'master_lb_enabled': kw.get('master_lb_enabled', False),
'master_lb_enabled': kw.get('master_lb_enabled', True),
}
if kw.pop('for_api_use', False):