Skip to content

Commit

Permalink
DS: Docker network allocations (#2220)
Browse files Browse the repository at this point in the history
Make sure that DS is reachable in docker topology
  • Loading branch information
oncilla authored Dec 11, 2018
1 parent 6e999e2 commit aa6b385
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions python/topology/topo.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,18 +200,19 @@ def _gen_srv_entries(self, topo_id, as_conf):
("certificate_servers", DEFAULT_CERTIFICATE_SERVERS, "cs",
"CertificateService"),
("path_servers", DEFAULT_PATH_SERVERS, "ps", "PathService"),
("discovery_servers", DEFAULT_DISCOVERY_SERVERS, "ds",
"DiscoveryService"),
):
self._gen_srv_entry(
topo_id, as_conf, conf_key, def_num, nick, topo_key)
# The discovery service does not run on top of the dispatcher.
self._gen_srv_entry(topo_id, as_conf, "discovery_servers", DEFAULT_DISCOVERY_SERVERS,
"ds", "DiscoveryService", lambda elem_id: elem_id)

def _gen_srv_entry(self, topo_id, as_conf, conf_key, def_num, nick,
topo_key):
topo_key, reg_id_func=None):
count = self._srv_count(as_conf, conf_key, def_num)
for i in range(1, count + 1):
elem_id = "%s%s-%s" % (nick, topo_id.file_fmt(), i)
reg_id = "disp" + topo_id.file_fmt() if self.args.docker else elem_id
reg_id = reg_id_func(elem_id) if reg_id_func else self._reg_id_disp(topo_id, elem_id)
d = {
'Addrs': {
self.addr_type: {
Expand All @@ -229,6 +230,9 @@ def _gen_srv_entry(self, topo_id, as_conf, conf_key, def_num, nick,
}
self.topo_dicts[topo_id][topo_key][elem_id] = d

def _reg_id_disp(self, topo_id, elem_id):
return "disp" + topo_id.file_fmt() if self.args.docker else elem_id

def _srv_count(self, as_conf, conf_key, def_num):
count = as_conf.get(conf_key, def_num)
# only a single Go-PS/Go-CS per AS is currently supported
Expand Down

0 comments on commit aa6b385

Please sign in to comment.