summaryrefslogtreecommitdiffstats
path: root/lavalab-gen.py
diff options
context:
space:
mode:
Diffstat (limited to 'lavalab-gen.py')
-rwxr-xr-xlavalab-gen.py34
1 files changed, 33 insertions, 1 deletions
diff --git a/lavalab-gen.py b/lavalab-gen.py
index d1a78e2..366c141 100755
--- a/lavalab-gen.py
+++ b/lavalab-gen.py
@@ -281,7 +281,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" ]
+ 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" ]
for keyword in slave:
if not keyword in keywords_slaves:
print("WARNING: unknown keyword %s" % keyword)
@@ -329,6 +329,13 @@ def main():
worker = slave
worker_name = name
slave_master = None
+ if "arch" in worker:
+ if worker["arch"] == 'arm64':
+ dockerfile = open("%s/Dockerfile" % workerdir, "r+")
+ dockerfilec = dockerfile.read().replace("lava-slave-base", "lava-slave-base-arm64")
+ dockerfile.seek(0)
+ dockerfile.write(dockerfilec)
+ dockerfile.close()
#NOTE remote_master is on slave
if not "remote_master" in worker:
remote_master = "lava-master"
@@ -413,6 +420,31 @@ def main():
fp.write("\n")
fp.close()
os.chmod("%s/scripts/extra_actions" % workerdir, 0o755)
+
+ if "devices" in worker:
+ if not os.path.isdir("output/%s/udev" % host):
+ os.mkdir("output/%s/udev" % host)
+ for udev_dev in worker["devices"]:
+ udev_line = 'SUBSYSTEM=="tty", ATTRS{idVendor}=="%04x", ATTRS{idProduct}=="%04x",' % (udev_dev["idvendor"], udev_dev["idproduct"])
+ if "serial" in udev_dev:
+ udev_line += 'ATTRS{serial}=="%s", ' % udev_dev["serial"]
+ if "devpath" in udev_dev:
+ udev_line += 'ATTRS{devpath}=="%s", ' % udev_dev["devpath"]
+ udev_line += 'MODE="0664", OWNER="uucp", SYMLINK+="%s"\n' % udev_dev["name"]
+ fudev = open("output/%s/udev/99-lavaworker-udev.rules" % host, "a")
+ fudev.write(udev_line)
+ fudev.close()
+ if not "bind_dev" in slave:
+ dockcomp_add_device(dockcomp, worker_name, "/dev/%s:/dev/%s" % (udev_dev["name"], udev_dev["name"]))
+ use_nfs = False
+ if "use_nfs" in worker:
+ use_nfs = worker["use_nfs"]
+ if use_nfs:
+ dockcomp["services"][worker_name]["volumes"].append("/var/lib/lava/dispatcher/tmp:/var/lib/lava/dispatcher/tmp")
+ fp = open("%s/scripts/extra_actions" % workerdir, "a")
+ fp.write("apt-get -y install nfs-kernel-server\n")
+ fp.close()
+ os.chmod("%s/scripts/extra_actions" % workerdir, 0o755)
if "loglevel" in worker:
for component in worker["loglevel"]:
if component != "lava-slave":