Get Open Ports for Storm
This patch implements the get_open_ports method to allow storm to be used with auto_security_groups. Closes-bug: #1503709 Change-Id: I4939ee9c7d53f760ee654792e017c294a288be0f
This commit is contained in:
parent
290aee99ce
commit
5f42a9a0a7
@ -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")
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user