summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md6
-rw-r--r--lava-master/Dockerfile2
-rw-r--r--lava-master/default/.empty0
-rwxr-xr-xlava-master/scripts/setup.sh16
-rw-r--r--lava-slave/Dockerfile4
-rw-r--r--lava-slave/default/.empty0
-rwxr-xr-xlavalab-gen.py58
7 files changed, 70 insertions, 16 deletions
diff --git a/README.md b/README.md
index e795934..177667a 100644
--- a/README.md
+++ b/README.md
@@ -221,6 +221,11 @@ masters:
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.
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.
+ loglevel:
+ lava-logs: DEBUG/INFO/WARN/ERROR (optional) select the loglevel of lava-logs (default to DEBUG)
+ lava-slave: DEBUG/INFO/WARN/ERROR (optional) select the loglevel of lava-slave (default to DEBUG)
+ lava-master: DEBUG/INFO/WARN/ERROR (optional) select the loglevel of lava-master (default to DEBUG)
+ lava-server-gunicorn: DEBUG/INFO/WARN/ERROR (optional) select the loglevel of lava-server-gunicorn (default to DEBUG)
users:
- name: LAVA username
token: The token of this user (optional)
@@ -271,6 +276,7 @@ boards:
type: the LAVA device-type of this device
slave: (optional) Name of the slave managing this device. Default to first slave found or default_slave if set.
kvm: (For qemu only) Does the qemu could use KVM (default: no)
+ tap: (For qemu only) Does the qemu could use TAP devices (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
diff --git a/lava-master/Dockerfile b/lava-master/Dockerfile
index b41446f..5d2a119 100644
--- a/lava-master/Dockerfile
+++ b/lava-master/Dockerfile
@@ -4,6 +4,8 @@ COPY backup /root/backup/
COPY configs/tftpd-hpa /etc/default/tftpd-hpa
+COPY default/* /etc/default/
+
RUN git clone https://github.com/BayLibre/lava-healthchecks.git
RUN cp lava-healthchecks/health-checks/* /etc/lava-server/dispatcher-config/health-checks/
COPY health-checks/* /etc/lava-server/dispatcher-config/health-checks/
diff --git a/lava-master/default/.empty b/lava-master/default/.empty
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/lava-master/default/.empty
diff --git a/lava-master/scripts/setup.sh b/lava-master/scripts/setup.sh
index 6153c9d..c22a06f 100755
--- a/lava-master/scripts/setup.sh
+++ b/lava-master/scripts/setup.sh
@@ -55,12 +55,24 @@ if [ -e /root/lava-users ];then
if [ $SUPERUSER -eq 1 ];then
USER_OPTION="$USER_OPTION --superuser"
fi
- lava-server manage users list | grep -q "[[:space:]]$USER$"
+ lava-server manage users list --all > /tmp/allusers
+ if [ $? -ne 0 ];then
+ echo "ERROR: cannot generate user list"
+ exit 1
+ fi
+ #filter first name/last name (enclose by "()")
+ sed -i 's,[[:space:]](.*$,,' /tmp/allusers
+ grep -q "[[:space:]]${USER}$" /tmp/allusers
if [ $? -eq 0 ];then
echo "Skip already existing $USER DEBUG(with $TOKEN / $PASSWORD / $USER_OPTION)"
else
echo "Adding username $USER DEBUG(with $TOKEN / $PASSWORD / $USER_OPTION)"
- lava-server manage users add --passwd $PASSWORD $USER_OPTION $USER || exit 1
+ lava-server manage users add --passwd $PASSWORD $USER_OPTION $USER
+ if [ $? -ne 0 ];then
+ echo "ERROR: Adding user $USER"
+ cat /tmp/allusers
+ exit 1
+ fi
if [ ! -z "$TOKEN" ];then
echo "Adding token to user $USER"
lava-server manage tokens add --user $USER --secret $TOKEN || exit 1
diff --git a/lava-slave/Dockerfile b/lava-slave/Dockerfile
index f0e699d..7cb607b 100644
--- a/lava-slave/Dockerfile
+++ b/lava-slave/Dockerfile
@@ -1,5 +1,7 @@
FROM baylibre/lava-slave-base:2018.11-1_bpo9_1
+RUN apt-get update
+
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install cu conmux
COPY configs/lava-slave /etc/lava-dispatcher/lava-slave
@@ -32,6 +34,8 @@ RUN apt-get update
RUN apt-get -y install lavacli
+COPY default/* /etc/default/
+
COPY phyhostname /root/
COPY scripts/setup.sh .
diff --git a/lava-slave/default/.empty b/lava-slave/default/.empty
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/lava-slave/default/.empty
diff --git a/lavalab-gen.py b/lavalab-gen.py
index 312dfd1..b0b58b4 100755
--- a/lavalab-gen.py
+++ b/lavalab-gen.py
@@ -66,6 +66,17 @@ template_settings_conf = string.Template("""
}
""")
+def dockcomp_add_device(dockcomp, worker_name, devicemap):
+ if "devices" in dockcomp["services"][worker_name]:
+ dc_devices = dockcomp["services"][worker_name]["devices"]
+ else:
+ dockcomp["services"][worker_name]["devices"] = []
+ dc_devices = dockcomp["services"][worker_name]["devices"]
+ for dmap in dc_devices:
+ if dmap == devicemap:
+ return
+ dc_devices.append(devicemap)
+
def usage():
print("%s [boardsfile.yaml]" % sys.argv[0])
@@ -83,7 +94,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" ]
+ 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" ]
for keyword in master:
if not keyword in keywords_master:
print("WARNING: unknown keyword %s" % keyword)
@@ -243,6 +254,18 @@ def main():
for line in slaveenv["env"]:
fenv.write(" %s\n" % line)
fenv.close()
+ if "loglevel" in worker:
+ for component in worker["loglevel"]:
+ if component != "lava-master" and component != "lava-logs" and component != 'lava-server-gunicorn':
+ print("ERROR: invalid loglevel component %s" % component)
+ sys.exit(1)
+ loglevel = worker["loglevel"][component]
+ if loglevel != 'DEBUG' and loglevel != 'INFO' and loglevel != 'WARN' and loglevel != 'ERROR':
+ print("ERROR: invalid loglevel %s for %s" % (loglevel, component))
+ sys.exit(1)
+ fcomponent = open("%s/default/%s" % (workerdir, component), 'w')
+ fcomponent.write("LOGLEVEL=%s\n" % loglevel)
+ fcomponent.close()
default_slave = "lab-slave-0"
if "slaves" not in workers:
@@ -250,7 +273,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" ]
+ 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" ]
for keyword in slave:
if not keyword in keywords_slaves:
print("WARNING: unknown keyword %s" % keyword)
@@ -382,6 +405,18 @@ def main():
fp.write("\n")
fp.close()
os.chmod("%s/scripts/extra_actions" % workerdir, 0o755)
+ if "loglevel" in worker:
+ for component in worker["loglevel"]:
+ if component != "lava-slave":
+ print("ERROR: invalid loglevel component %s" % component)
+ sys.exit(1)
+ loglevel = worker["loglevel"][component]
+ if loglevel != 'DEBUG' and loglevel != 'INFO' and loglevel != 'WARN' and loglevel != 'ERROR':
+ print("ERROR: invalid loglevel %s for %s" % (loglevel, component))
+ sys.exit(1)
+ fcomponent = open("%s/default/%s" % (workerdir, component), 'w')
+ fcomponent.write("LOGLEVEL=%s\n" % loglevel)
+ fcomponent.close()
if "boards" not in workers:
boards = {}
@@ -424,13 +459,13 @@ def main():
if "kvm" in board:
use_kvm = board["kvm"]
if use_kvm:
- if "devices" in dockcomp["services"][worker_name]:
- dc_devices = dockcomp["services"][worker_name]["devices"]
- else:
- dockcomp["services"][worker_name]["devices"] = []
- dc_devices = dockcomp["services"][worker_name]["devices"]
- dc_devices.append("/dev/kvm:/dev/kvm")
+ dockcomp_add_device(dockcomp, worker_name, "/dev/kvm:/dev/kvm")
# board specific hacks
+ use_tap = False
+ if "tap" in board:
+ use_tap = board["tap"]
+ if use_tap:
+ dockcomp_add_device(dockcomp, worker_name, "/dev/net/tun:/dev/net/tun")
if devicetype == "qemu" and not use_kvm:
device_line += "{% set no_kvm = True %}\n"
if "uart" in board:
@@ -457,13 +492,8 @@ def main():
fp = open("output/%s/udev/99-lavaworker-udev.rules" % host, "a")
fp.write(udev_line)
fp.close()
- if "devices" in dockcomp["services"][worker_name]:
- dc_devices = dockcomp["services"][worker_name]["devices"]
- else:
- dockcomp["services"][worker_name]["devices"] = []
- dc_devices = dockcomp["services"][worker_name]["devices"]
if not "bind_dev" in slave:
- dc_devices.append("/dev/%s:/dev/%s" % (board_name, board_name))
+ dockcomp_add_device(dockcomp, worker_name, "/dev/%s:/dev/%s" % (board_name, board_name))
use_conmux = False
use_ser2net = False
use_screen = False