diff options
author | Corentin LABBE <clabbe@baylibre.com> | 2019-05-10 11:32:15 +0200 |
---|---|---|
committer | Corentin LABBE <clabbe@baylibre.com> | 2019-05-13 11:10:12 +0200 |
commit | 4ae24270f6e8e853ca97cdd1f926da486a39a387 (patch) | |
tree | 8221dc796dac83375fc93c9bbaa5cefe061a0879 | |
parent | d6ac516eed6fcf2caab00ecf03b12fa4482e278d (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.
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | lava-slave/Dockerfile | 4 | ||||
-rw-r--r-- | lava-slave/lava-coordinator/.empty | 0 | ||||
-rwxr-xr-x | lavalab-gen.py | 19 |
4 files changed, 23 insertions, 2 deletions
@@ -219,6 +219,7 @@ masters: zmq_auth_key: optional path to a public ZMQ key zmq_auth_key_secret: optional path to a private ZMQ key slave_keys: optional path to a directory with slaves public key. Usefull when you want to create a master without slaves nodes in boards.yaml. + lava-coordinator: Does the master should ran a lava-coordinator and export its port persistent_db: True/False (default False) Is the postgres DB is persistent over reboot http_fqdn: The FQDN used to access the LAVA web interface. This is necessary if you use https otherwise you will issue CSRF errors. allowed_hosts: A list of FQDN used to access the LAVA master @@ -267,6 +268,7 @@ slaves: bind_dev: Bind /dev from host to slave. This is needed when using some HID PDU use_nfs: Does the LAVA dispatcher will run NFS jobs arch: The arch of the worker (if not x86_64), only accept arm64 + lava-coordinator: Does the slave should ran a lava-coordinator expose_ser2net: Do ser2net ports need to be available on host expose_ports: Expose port p1 on the host to p2 on the worker slave. - p1:p2 diff --git a/lava-slave/Dockerfile b/lava-slave/Dockerfile index 60f574c..f5ce287 100644 --- a/lava-slave/Dockerfile +++ b/lava-slave/Dockerfile @@ -53,6 +53,10 @@ RUN apt-get -y install patch COPY lava-patch/ /root/lava-patch RUN cd /usr/lib/python3/dist-packages && for patch in $(ls /root/lava-patch/*patch) ; do patch -p1 < $patch || exit $?;done +RUN mkdir /etc/lava-coordinator/ +COPY lava-coordinator/* /etc/lava-coordinator/ +RUN if [ -e /etc/lava-coordinator/lava-coordinator.cnf ]; then DEBIAN_FRONTEND=noninteractive apt-get -y install lava-coordinator && mv /etc/lava-coordinator/lava-coordinator.cnf /etc/lava-coordinator/lava-coordinator.conf ; fi + COPY devices/ /root/devices/ COPY tags/ /root/tags/ COPY deviceinfo/ /root/deviceinfo/ diff --git a/lava-slave/lava-coordinator/.empty b/lava-slave/lava-coordinator/.empty new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/lava-slave/lava-coordinator/.empty 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: |