Merge "forbid cluster creation without secondarynamenode"

This commit is contained in:
Jenkins 2016-07-07 13:13:05 +00:00 committed by Gerrit Code Review
commit 75a54004c5
2 changed files with 8 additions and 1 deletions

View File

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

View File

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