Fix validation for master_lb_enabled
Currently master_lb_enabled can be enabled at cluster creation but validation is only done for cluster_template. We need to validate in cluster. Fix testing task: 41535 story: 2007634 story: 2008487 Change-Id: Icf32de2b803aa160dc3b7993e128deff11d02fcb
This commit is contained in:
parent
1af0cd0a97
commit
acc7084889
|
@ -209,7 +209,7 @@ def validate_os_resources(context, cluster_template, cluster=None):
|
||||||
|
|
||||||
def validate_master_count(cluster, cluster_template):
|
def validate_master_count(cluster, cluster_template):
|
||||||
if cluster['master_count'] > 1 and \
|
if cluster['master_count'] > 1 and \
|
||||||
not cluster_template['master_lb_enabled']:
|
not cluster['master_lb_enabled']:
|
||||||
raise exception.InvalidParameterValue(_(
|
raise exception.InvalidParameterValue(_(
|
||||||
"master_count must be 1 when master_lb_enabled is False"))
|
"master_count must be 1 when master_lb_enabled is False"))
|
||||||
|
|
||||||
|
|
|
@ -803,7 +803,7 @@ class TestPost(api_base.FunctionalTest):
|
||||||
cluster_template = obj_utils.create_test_cluster_template(
|
cluster_template = obj_utils.create_test_cluster_template(
|
||||||
self.context, name='foo', uuid='foo', master_lb_enabled=False)
|
self.context, name='foo', uuid='foo', master_lb_enabled=False)
|
||||||
bdict = apiutils.bay_post_data(baymodel_id=cluster_template.name,
|
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)
|
response = self.post_json('/bays', bdict, expect_errors=True)
|
||||||
self.assertEqual('application/json', response.content_type)
|
self.assertEqual('application/json', response.content_type)
|
||||||
self.assertEqual(400, response.status_int)
|
self.assertEqual(400, response.status_int)
|
||||||
|
|
|
@ -845,7 +845,8 @@ class TestPost(api_base.FunctionalTest):
|
||||||
cluster_template = obj_utils.create_test_cluster_template(
|
cluster_template = obj_utils.create_test_cluster_template(
|
||||||
self.context, name='foo', uuid='foo', master_lb_enabled=False)
|
self.context, name='foo', uuid='foo', master_lb_enabled=False)
|
||||||
bdict = apiutils.cluster_post_data(
|
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)
|
response = self.post_json('/clusters', bdict, expect_errors=True)
|
||||||
self.assertEqual('application/json', response.content_type)
|
self.assertEqual('application/json', response.content_type)
|
||||||
self.assertEqual(400, response.status_int)
|
self.assertEqual(400, response.status_int)
|
||||||
|
|
|
@ -101,7 +101,7 @@ def get_test_cluster(**kw):
|
||||||
'fixed_network': kw.get('fixed_network', None),
|
'fixed_network': kw.get('fixed_network', None),
|
||||||
'fixed_subnet': kw.get('fixed_subnet', None),
|
'fixed_subnet': kw.get('fixed_subnet', None),
|
||||||
'floating_ip_enabled': kw.get('floating_ip_enabled', True),
|
'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):
|
if kw.pop('for_api_use', False):
|
||||||
|
|
Loading…
Reference in New Issue