From 1bd576e2431ca14dc7538d186499dba21de1f070 Mon Sep 17 00:00:00 2001 From: Andrey Pavlov Date: Mon, 9 Feb 2015 14:49:56 +0300 Subject: [PATCH] Adding validation check for Spark plugin Change-Id: Ifa7cc90150f91381de32ca44cda363ac723f2ea5 Closes-bug: #1419731 --- sahara/plugins/spark/plugin.py | 9 +++++++++ .../tests/integration/tests/gating/test_spark_gating.py | 3 +-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/sahara/plugins/spark/plugin.py b/sahara/plugins/spark/plugin.py index 4aee82af..f9c4f467 100644 --- a/sahara/plugins/spark/plugin.py +++ b/sahara/plugins/spark/plugin.py @@ -75,6 +75,15 @@ class SparkProvider(p.ProvisioningPluginBase): raise ex.InvalidComponentCountException("datanode", _("1 or more"), nn_count) + rep_factor = c_helper.get_config_value('HDFS', "dfs.replication", + cluster) + if dn_count < rep_factor: + raise ex.InvalidComponentCountException( + 'datanode', _('%s or more') % rep_factor, dn_count, + _('Number of %(dn)s instances should not be less ' + 'than %(replication)s') + % {'dn': 'datanode', 'replication': 'dfs.replication'}) + # validate Spark Master Node and Spark Slaves sm_count = sum([ng.count for ng in utils.get_node_groups(cluster, "master")]) diff --git a/sahara/tests/integration/tests/gating/test_spark_gating.py b/sahara/tests/integration/tests/gating/test_spark_gating.py index 4476cdaf..ba3ebd2e 100644 --- a/sahara/tests/integration/tests/gating/test_spark_gating.py +++ b/sahara/tests/integration/tests/gating/test_spark_gating.py @@ -76,8 +76,7 @@ class SparkGatingTest(swift.SwiftTest, scaling.ScalingTest, 'name': 'test-cluster-template-spark', 'plugin_config': self.plugin_config, 'description': 'test cluster template for Spark plugin', - 'cluster_configs': { - }, + 'cluster_configs': {'HDFS': {'dfs.replication': 1}}, 'node_groups': [ { 'name': 'master-node',