forbid cluster creation without secondarynamenode

if ambari blueprint was submitted without secondary namenode, we will
recieve ValidationError. This affects only clusters without enabled HA
mode.

Change-Id: I88d429b9b5ba509dc6f3983f442659e0ec8af141
Closes-bug: 1596113
This commit is contained in:
Vitaly Gridnev 2016-06-25 19:05:12 +03:00
parent 5fefb63270
commit 1bb6c999a1
2 changed files with 8 additions and 1 deletions

View File

@ -53,6 +53,7 @@ def _check_ambari(cluster):
def _check_hdfs(cluster):
nn_count = utils.get_instances_count(cluster, common.NAMENODE)
dn_count = utils.get_instances_count(cluster, common.DATANODE)
snn_count = utils.get_instances_count(cluster, common.SECONDARY_NAMENODE)
if cluster.cluster_configs.get("general", {}).get(common.NAMENODE_HA):
_check_zk_ha(cluster)
@ -65,6 +66,11 @@ def _check_hdfs(cluster):
if nn_count != 1:
raise ex.InvalidComponentCountException(common.NAMENODE, 1,
nn_count)
if snn_count != 1:
raise ex.InvalidComponentCountException(common.SECONDARY_NAMENODE,
1, snn_count)
if dn_count == 0:
raise ex.InvalidComponentCountException(
common.DATANODE, _("1 or more"), dn_count)

View File

@ -47,7 +47,8 @@ class AmbariValidationTestCase(base.SaharaTestCase):
p_common.RESOURCEMANAGER,
p_common.NODEMANAGER,
p_common.HISTORYSERVER,
p_common.APP_TIMELINE_SERVER]})
p_common.APP_TIMELINE_SERVER,
p_common.SECONDARY_NAMENODE]})
cluster.cluster_configs = {"general": {}}
with mock.patch("sahara.plugins.ambari.validation.conductor") as p:
p.cluster_get = mock.Mock()