diff options
-rw-r--r-- | README.md | 3 | ||||
-rw-r--r-- | lava-master/Dockerfile | 3 | ||||
-rwxr-xr-x | lava-master/entrypoint.d/01_setup.sh | 2 | ||||
-rw-r--r-- | lava-slave/Dockerfile | 2 | ||||
-rwxr-xr-x | lava-slave/scripts/setup.sh | 12 | ||||
-rwxr-xr-x | lavalab-gen.py | 8 |
6 files changed, 21 insertions, 9 deletions
@@ -291,6 +291,9 @@ slaves: env: - line1 A list of line to set as environment (See /etc/lava-server/env.yaml for examples) - line2 + tags: (optional) List of tag to set on all devices attached to this slave + - tag1 + - tag2 devices: A list of devices which need UDEV rules - name: The name of the device vendorid: The VID of the UART (Formated as 0xXXXX) diff --git a/lava-master/Dockerfile b/lava-master/Dockerfile index 625ebf1..76c3425 100644 --- a/lava-master/Dockerfile +++ b/lava-master/Dockerfile @@ -1,4 +1,4 @@ -FROM lavasoftware/lava-server:2019.07 +FROM lavasoftware/lava-server:2019.09 RUN apt-get update && apt-get -y install sudo lava-coordinator git @@ -23,7 +23,6 @@ COPY settings.conf /etc/lava-server/ COPY lava-patch/ /root/lava-patch RUN cd /usr/lib/python3/dist-packages && for patch in $(ls /root/lava-patch/*patch| sort) ; do echo $patch && patch -p1 < $patch || exit $?;done -RUN rsync -avr /usr/lib/python3/dist-packages/lava_scheduler_app/tests/device-types/ /etc/lava-server/dispatcher-config/device-types/ 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 diff --git a/lava-master/entrypoint.d/01_setup.sh b/lava-master/entrypoint.d/01_setup.sh index be950b7..4755bc4 100755 --- a/lava-master/entrypoint.d/01_setup.sh +++ b/lava-master/entrypoint.d/01_setup.sh @@ -14,7 +14,7 @@ fi if [ -e /root/backup/db_lavaserver ];then echo "Restore database from backup" sudo -u postgres psql < /root/backup/db_lavaserver || exit $? - lava-server manage migrate || exit $? + yes yes | lava-server manage migrate || exit $? echo "Restore jobs output from backup" rm -r /var/lib/lava-server/default/media/job-output/* tar xzf /root/backup/joboutput.tar.gz || exit $? diff --git a/lava-slave/Dockerfile b/lava-slave/Dockerfile index b93e310..a2ce4b3 100644 --- a/lava-slave/Dockerfile +++ b/lava-slave/Dockerfile @@ -1,4 +1,4 @@ -FROM lavasoftware/lava-dispatcher:2019.07 +FROM lavasoftware/lava-dispatcher:2019.09 RUN apt-get update diff --git a/lava-slave/scripts/setup.sh b/lava-slave/scripts/setup.sh index 4bf2f67..c39fdc4 100755 --- a/lava-slave/scripts/setup.sh +++ b/lava-slave/scripts/setup.sh @@ -105,10 +105,14 @@ do if [ $? -eq 0 ];then echo "$devicename already present" #verify if present on another worker - #TODO - lavacli $LAVACLIOPTS devices show $devicename |grep ^worker |grep -q $worker - if [ $? -ne 0 ];then - echo "ERROR: $devicename already present on another worker" + lavacli $LAVACLIOPTS devices show $devicename |grep ^worker > /tmp/current-worker + if [ $? -ne 0 ]; then + CURR_WORKER="" + else + CURR_WORKER=$(cat /tmp/current-worker | sed '^.* ,,') + fi + if [ ! -z "$CURR_WORKER" -a "$CURR_WORKER" != "$worker" ];then + echo "ERROR: $devicename already present on another worker $CURR_WORKER" exit 1 fi DEVICE_HEALTH=$(grep "$devicename[[:space:]]" /tmp/devices.list | sed 's/.*,//') diff --git a/lavalab-gen.py b/lavalab-gen.py index 539d80c..d37eb90 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" ] + 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" ] for keyword in slave: if not keyword in keywords_slaves: print("WARNING: unknown keyword %s" % keyword) @@ -702,6 +702,12 @@ def main(): for tag in board["tags"]: ftag.write("%s\n" % tag) ftag.close() + if "tags" in slave: + tagdir = "%s/tags/" % workerdir + ftag = open("%s/%s" % (tagdir, board_name), 'a') + for tag in slave["tags"]: + ftag.write("%s\n" % tag) + ftag.close() if "aliases" in board: aliases_dir = "%s/aliases/" % workerdir falias = open("%s/%s" % (aliases_dir, board["type"]), 'a') |