From a681d6e6e7d11743b6d893a68dc98347c68b779c Mon Sep 17 00:00:00 2001 From: Corentin LABBE Date: Mon, 13 Jan 2020 10:45:59 +0100 Subject: master: handle migrations This patch permits to handle migrations when upgrading. --- lava-master/entrypoint.d/01_setup.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lava-master/entrypoint.d/01_setup.sh b/lava-master/entrypoint.d/01_setup.sh index 4755bc4..eb5c8ef 100755 --- a/lava-master/entrypoint.d/01_setup.sh +++ b/lava-master/entrypoint.d/01_setup.sh @@ -19,6 +19,8 @@ if [ -e /root/backup/db_lavaserver ];then rm -r /var/lib/lava-server/default/media/job-output/* tar xzf /root/backup/joboutput.tar.gz || exit $? fi + lava-server manage makemigrations + yes yes | lava-server manage migrate || exit $? if [ -e /root/backup/devices.tar.gz ];then echo "INFO: Restoring devices files" -- cgit 1.2.3-korg From 694f774c113da4e2b15fead6b3e19ac95a9528bd Mon Sep 17 00:00:00 2001 From: Corentin LABBE Date: Thu, 5 Dec 2019 16:22:08 +0100 Subject: Add raw_custom_option For some options we need to not have the space around them, like ones needing "-%}" or coments. Introduce raw_custom_option for such cases. --- README.md | 4 +++- lavalab-gen.py | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e2d531c..5898e10 100644 --- a/README.md +++ b/README.md @@ -309,8 +309,10 @@ boards: kvm: (For qemu only) Does the qemu could use KVM (default: no) uboot_ipaddr: (optional) a static IP to set in uboot uboot_macaddr: (Optional) the MAC address to set in uboot - custom_option: (optional) All following strings will be directly append to devicefile + custom_option: (optional) All following strings will be directly append to devicefile included in {% opt %} - "set x=1" + raw_custom_option: (optional) All following strings will be directly append to devicefile + - "{% set x=1 %}" tags: (optional) List of tag to set on this device - tag1 - tag2 diff --git a/lavalab-gen.py b/lavalab-gen.py index 0c7f726..a766e5f 100755 --- a/lavalab-gen.py +++ b/lavalab-gen.py @@ -743,6 +743,9 @@ def main(): else: for line in board["custom_option"].splitlines(): device_line += "{%% %s %%}\n" % line + if "raw_custom_option" in board: + for coption in board["raw_custom_option"]: + device_line += "%s\n" % coption if not os.path.isdir(device_path): os.mkdir(device_path) if not os.path.isdir(devices_path): -- cgit 1.2.3-korg From 8cf19027a638428f3267f2da5fb594bff7ed2841 Mon Sep 17 00:00:00 2001 From: Corentin LABBE Date: Wed, 21 Aug 2019 10:53:16 +0200 Subject: Add custom volumes For some case, we need to add custom volumes (like for /var/lib/lxc/cache) --- README.md | 2 ++ lavalab-gen.py | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5898e10..954d90d 100644 --- a/README.md +++ b/README.md @@ -285,6 +285,8 @@ slaves: host_healthcheck: If true, enable the optional healthcheck container. See hosting healthchecks below lava-coordinator: Does the slave should ran a lava-coordinator expose_ser2net: Do ser2net ports need to be available on host + custom_volumes: + - "name:path" Add a custom volume expose_ports: Expose port p1 on the host to p2 on the worker slave. - p1:p2 extra_actions: An optional list of action to do at end of the docker build diff --git a/lavalab-gen.py b/lavalab-gen.py index a766e5f..218f5ec 100755 --- a/lavalab-gen.py +++ b/lavalab-gen.py @@ -364,7 +364,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", "lava-coordinator", "use_tap", "host_healthcheck", "use_tftp", "use_nbd", "use_overlay_server", "tags", "use_docker" ] + 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", "use_tap", "host_healthcheck", "use_tftp", "use_nbd", "use_overlay_server", "tags", "use_docker", "custom_volumes" ] for keyword in slave: if not keyword in keywords_slaves: print("WARNING: unknown keyword %s" % keyword) @@ -479,6 +479,13 @@ def main(): for line in slave["env"]: fenv.write(" %s\n" % line) fenv.close() + if "custom_volumes" in slave: + for cvolume in slave["custom_volumes"]: + dockcomp["services"][worker_name]["volumes"].append(cvolume) + volume_name = cvolume.split(':')[0] + if "volumes" not in dockcomp: + dockcomp["volumes"] = {} + dockcomp["volumes"][volume_name] = {} if not "remote_proto" in worker: remote_proto = "http" else: -- cgit 1.2.3-korg From 0ffd1e217b5463124131b22de480deed73910580 Mon Sep 17 00:00:00 2001 From: Corentin LABBE Date: Fri, 29 Nov 2019 15:38:43 +0100 Subject: Permit to specify LAVA version in boards.yaml This patch permit to override the LAVA version in boards.yaml For example with 'version: 2020.01' the Dockerfile FROM lavasoftware/lava-server:2019.09 become FROM lavasoftware/lava-server:2020.01 --- lavalab-gen.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/lavalab-gen.py b/lavalab-gen.py index 218f5ec..ea4417d 100755 --- a/lavalab-gen.py +++ b/lavalab-gen.py @@ -4,6 +4,7 @@ from __future__ import print_function import os, sys, time import subprocess import yaml +import re import string import socket import shutil @@ -113,7 +114,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", "lava-coordinator", "healthcheck_url", "smtp" ] + 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", "healthcheck_url", "smtp", "version" ] for keyword in master: if not keyword in keywords_master: print("WARNING: unknown keyword %s" % keyword) @@ -155,6 +156,12 @@ def main(): groupdir = "%s/groups" % workerdir os.mkdir(groupdir) worker = master + if "version" in worker: + dockerfile = open("%s/Dockerfile" % workerdir, "r+") + dockerfilec = re.sub('(^FROM.*:).*', '\g<1>%s' % worker["version"], dockerfile.read()) + dockerfile.seek(0) + dockerfile.write(dockerfilec) + dockerfile.close() if "lava-coordinator" in master and master["lava-coordinator"]: dockcomp["services"][name]["ports"].append('3079:3079') f_entrypoint = open("%s/entrypoint.d/02_lava-coordinator.sh" % workerdir, 'w') @@ -364,7 +371,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", "lava-coordinator", "use_tap", "host_healthcheck", "use_tftp", "use_nbd", "use_overlay_server", "tags", "use_docker", "custom_volumes" ] + 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", "use_tap", "host_healthcheck", "use_tftp", "use_nbd", "use_overlay_server", "tags", "use_docker", "version", "custom_volumes" ] for keyword in slave: if not keyword in keywords_slaves: print("WARNING: unknown keyword %s" % keyword) @@ -412,6 +419,12 @@ def main(): worker = slave worker_name = name slave_master = None + if "version" in worker: + dockerfile = open("%s/Dockerfile" % workerdir, "r+") + dockerfilec = re.sub('(^FROM.*:).*', '\g<1>%s' % worker["version"], dockerfile.read()) + dockerfile.seek(0) + dockerfile.write(dockerfilec) + dockerfile.close() if "arch" in worker: if worker["arch"] == 'arm64': dockerfile = open("%s/Dockerfile" % workerdir, "r+") -- cgit 1.2.3-korg From 3c351c8a3e168efec48c5d4000ecdc948c0085a1 Mon Sep 17 00:00:00 2001 From: Corentin LABBE Date: Thu, 16 Jan 2020 14:50:52 +0100 Subject: lava-slave: copy entrypoints This patch permit to adds custom entrypoints. --- lava-slave/Dockerfile | 2 ++ lava-slave/entrypoint.d/.empty | 0 2 files changed, 2 insertions(+) create mode 100644 lava-slave/entrypoint.d/.empty diff --git a/lava-slave/Dockerfile b/lava-slave/Dockerfile index a2ce4b3..b16da41 100644 --- a/lava-slave/Dockerfile +++ b/lava-slave/Dockerfile @@ -63,6 +63,8 @@ COPY devices/ /root/devices/ COPY tags/ /root/tags/ COPY aliases/ /root/aliases/ COPY deviceinfo/ /root/deviceinfo/ +COPY entrypoint.d/*sh /root/entrypoint.d/ +RUN chmod +x /root/entrypoint.d/* RUN if [ -x /usr/local/bin/extra_actions ] ; then /usr/local/bin/extra_actions ; fi diff --git a/lava-slave/entrypoint.d/.empty b/lava-slave/entrypoint.d/.empty new file mode 100644 index 0000000..e69de29 -- cgit 1.2.3-korg