diff options
author | khilman <khilman@users.noreply.github.com> | 2019-05-16 08:15:51 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-16 08:15:51 -0700 |
commit | 620e8e50b3d71709b28bafb6b5eac7fcea7e6bc5 (patch) | |
tree | 623814a65b61818122f64ebd3a860fef05669714 | |
parent | 7f0a27d56c83e053e00497d30bd56f40cc63b533 (diff) | |
parent | 6f153a0ac4d9361aa0f8ecf7d2ba30e16bddc274 (diff) |
Merge pull request #89 from montjoie/enhance-2019.03-2
Enhance 2019.03 2
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | lava-master/Dockerfile | 1 | ||||
-rw-r--r-- | lava-slave/Dockerfile | 7 | ||||
-rw-r--r-- | lava-slave/lava-coordinator/.empty | 0 | ||||
-rwxr-xr-x | lava-slave/scripts/setup.sh | 2 | ||||
-rwxr-xr-x | lavalab-gen.py | 22 |
6 files changed, 32 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-master/Dockerfile b/lava-master/Dockerfile index f8ed805..9b56be8 100644 --- a/lava-master/Dockerfile +++ b/lava-master/Dockerfile @@ -26,6 +26,7 @@ RUN rsync -avr /usr/lib/python3/dist-packages/lava_scheduler_app/tests/device-ty COPY device-types-patch/ /root/device-types-patch/ RUN cd /etc/lava-server/dispatcher-config/device-types/ && for patch in $(ls /root/device-types-patch/*patch) ; do sed -i 's,lava_scheduler_app/tests/device-types/,,' $patch && echo $patch && patch < $patch || exit $?; done +RUN chown -R lavaserver:lavaserver /etc/lava-server/dispatcher-config/device-types/ COPY zmq_auth/ /etc/lava-dispatcher/certificates.d/ diff --git a/lava-slave/Dockerfile b/lava-slave/Dockerfile index 60f574c..d6375f2 100644 --- a/lava-slave/Dockerfile +++ b/lava-slave/Dockerfile @@ -53,6 +53,13 @@ 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 + +# needed for lavacli identities +RUN mkdir -p /root/.config + 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/lava-slave/scripts/setup.sh b/lava-slave/scripts/setup.sh index 0b8a0b2..fce01f8 100755 --- a/lava-slave/scripts/setup.sh +++ b/lava-slave/scripts/setup.sh @@ -10,6 +10,8 @@ if [ -z "$LAVA_MASTER_URI" ];then exit 11 fi +lavacli identities add --uri $LAVA_MASTER_BASEURI --token $LAVA_MASTER_TOKEN --username $LAVA_MASTER_USER default + echo "Dynamic slave for $LAVA_MASTER ($LAVA_MASTER_URI)" LAVACLIOPTS="--uri $LAVA_MASTER_URI" diff --git a/lavalab-gen.py b/lavalab-gen.py index 366c141..e51b891 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) @@ -402,7 +413,14 @@ def main(): remote_proto = worker["remote_proto"] 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 + dockcomp["services"][worker_name]["environment"]["LAVA_MASTER_USER"] = remote_user + dockcomp["services"][worker_name]["environment"]["LAVA_MASTER_BASEURI"] = "%s://%s:%s/RPC2" % (remote_proto, remote_address, remote_rpc_port) + dockcomp["services"][worker_name]["environment"]["LAVA_MASTER_TOKEN"] = remote_token + 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: |