Merge "Get Open Ports for Storm"

This commit is contained in:
Jenkins 2015-11-08 21:08:30 +00:00 committed by Gerrit Code Review
commit 4c1c5a03c6
2 changed files with 23 additions and 0 deletions

View File

@ -121,6 +121,18 @@ class StormProvider(p.ProvisioningPluginBase):
return edp_engine.EdpEngine.get_possible_job_config(job_type)
return {}
def get_open_ports(self, node_group):
ports_map = {
'nimbus': [8080]
}
ports = []
for process in node_group.node_processes:
if process in ports_map:
ports.extend(ports_map[process])
return ports
def _extract_configs_to_extra(self, cluster):
st_master = utils.get_instance(cluster, "nimbus")
zk_servers = utils.get_instances(cluster, "zookeeper")

View File

@ -19,6 +19,7 @@ from sahara import conductor as cond
from sahara import context
from sahara.plugins import base as pb
from sahara.plugins import exceptions as ex
from sahara.plugins.storm import plugin as pl
from sahara.tests.unit import base
@ -157,3 +158,13 @@ class StormPluginTest(base.SaharaWithDbTestCase):
self.assertRaises(ex.NodeGroupCannotBeScaled,
plugin._validate_existing_ng_scaling,
cluster, master_id)
def test_get_open_port(self):
plugin_storm = pl.StormProvider()
cluster = mock.Mock()
ng = mock.Mock()
ng.node_processes = ['nimbus']
cluster.node_groups = [ng]
ng.cluster = cluster
ports = plugin_storm.get_open_ports(ng)
self.assertEqual([8080], ports)