summaryrefslogtreecommitdiffstats
path: root/lavalab-gen.py
diff options
context:
space:
mode:
authorCorentin LABBE <clabbe@baylibre.com>2019-05-10 11:32:15 +0200
committerCorentin LABBE <clabbe@baylibre.com>2019-05-13 11:10:12 +0200
commit4ae24270f6e8e853ca97cdd1f926da486a39a387 (patch)
tree8221dc796dac83375fc93c9bbaa5cefe061a0879 /lavalab-gen.py
parentd6ac516eed6fcf2caab00ecf03b12fa4482e278d (diff)
lava-slave: support lava-coordinator
This patchs adds a new flag "lava-coordinator" for slave which enables the generation of a lava-coordinator.conf file.
Diffstat (limited to 'lavalab-gen.py')
-rwxr-xr-xlavalab-gen.py19
1 files changed, 17 insertions, 2 deletions
diff --git a/lavalab-gen.py b/lavalab-gen.py
index 366c141..86d750f 100755
--- a/lavalab-gen.py
+++ b/lavalab-gen.py
@@ -68,6 +68,15 @@ template_settings_conf = string.Template("""
}
""")
+template_lava_coordinator_conf = string.Template("""
+{
+ "port": 3079,
+ "blocksize": 4096,
+ "poll_delay": 3,
+ "coordinator_hostname": "$masterurl"
+}
+""")
+
def dockcomp_add_device(dockcomp, worker_name, devicemap):
if "devices" in dockcomp["services"][worker_name]:
dc_devices = dockcomp["services"][worker_name]["devices"]
@@ -96,7 +105,7 @@ def main():
else:
masters = workers["masters"]
for master in masters:
- keywords_master = [ "name", "type", "host", "users", "groups", "tokens", "webadmin_https", "persistent_db", "zmq_auth", "zmq_auth_key", "zmq_auth_key_secret", "http_fqdn", "slave_keys", "slaveenv", "loglevel", "allowed_hosts" ]
+ keywords_master = [ "name", "type", "host", "users", "groups", "tokens", "webadmin_https", "persistent_db", "zmq_auth", "zmq_auth_key", "zmq_auth_key_secret", "http_fqdn", "slave_keys", "slaveenv", "loglevel", "allowed_hosts", "lava-coordinator" ]
for keyword in master:
if not keyword in keywords_master:
print("WARNING: unknown keyword %s" % keyword)
@@ -119,6 +128,8 @@ def main():
dockcomp["services"][name]["volumes"] = [ "/boot:/boot", "/lib/modules:/lib/modules" ]
dockcomp["services"][name]["build"] = {}
dockcomp["services"][name]["build"]["context"] = name
+ if "lava-coordinator" in master and master["lava-coordinator"]:
+ dockcomp["services"][name]["ports"].append('3079:3079')
persistent_db = False
if "persistent_db" in master:
persistent_db = master["persistent_db"]
@@ -281,7 +292,7 @@ def main():
else:
slaves = workers["slaves"]
for slave in slaves:
- keywords_slaves = [ "name", "host", "dispatcher_ip", "remote_user", "remote_master", "remote_address", "remote_rpc_port", "remote_proto", "extra_actions", "zmq_auth_key", "zmq_auth_key_secret", "default_slave", "export_ser2net", "expose_ser2net", "remote_user_token", "zmq_auth_master_key", "expose_ports", "env", "bind_dev", "loglevel", "use_nfs", "arch", "devices" ]
+ keywords_slaves = [ "name", "host", "dispatcher_ip", "remote_user", "remote_master", "remote_address", "remote_rpc_port", "remote_proto", "extra_actions", "zmq_auth_key", "zmq_auth_key_secret", "default_slave", "export_ser2net", "expose_ser2net", "remote_user_token", "zmq_auth_master_key", "expose_ports", "env", "bind_dev", "loglevel", "use_nfs", "arch", "devices", "lava-coordinator" ]
for keyword in slave:
if not keyword in keywords_slaves:
print("WARNING: unknown keyword %s" % keyword)
@@ -403,6 +414,10 @@ def main():
remote_uri = "%s://%s:%s@%s:%s/RPC2" % (remote_proto, remote_user, remote_token, remote_address, remote_rpc_port)
dockcomp["services"][worker_name]["environment"]["LAVA_MASTER_URI"] = remote_uri
+ if "lava-coordinator" in worker and worker["lava-coordinator"]:
+ fcoordinator = open("%s/lava-coordinator/lava-coordinator.cnf" % workerdir, 'w')
+ fcoordinator.write(template_lava_coordinator_conf.substitute(masterurl=remote_address))
+ fcoordinator.close()
if "dispatcher_ip" in worker:
dockcomp["services"][worker_name]["environment"]["LAVA_DISPATCHER_IP"] = worker["dispatcher_ip"]
if "expose_ports" in worker: