diff options
author | khilman <khilman@baylibre.com> | 2019-05-23 17:28:37 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-23 17:28:37 -0700 |
commit | 678a0a4cb8993897609b48a32ec2497c7ee5e01a (patch) | |
tree | 226043d2653af5a654bee88aec4d39f52688e0f1 /lavalab-gen.py | |
parent | 620e8e50b3d71709b28bafb6b5eac7fcea7e6bc5 (diff) | |
parent | 395a97a7f0ab362a513e344eb5f1c82104a77804 (diff) |
Merge pull request #90 from montjoie/fix-2019.03
Fix 2019.03
Diffstat (limited to 'lavalab-gen.py')
-rwxr-xr-x | lavalab-gen.py | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/lavalab-gen.py b/lavalab-gen.py index e51b891..6332284 100755 --- a/lavalab-gen.py +++ b/lavalab-gen.py @@ -292,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", "lava-coordinator" ] + 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" ] for keyword in slave: if not keyword in keywords_slaves: print("WARNING: unknown keyword %s" % keyword) @@ -426,11 +426,13 @@ def main(): if "expose_ports" in worker: for eports in worker["expose_ports"]: dockcomp["services"][name]["ports"].append("%s" % eports) - if "bind_dev" in worker: + if "bind_dev" in worker and worker["bind_dev"]: dockcomp["services"][worker_name]["volumes"].append("/dev:/dev") dockcomp["services"][worker_name]["privileged"] = True - with open(dockcomposeymlpath, 'w') as f: - yaml.dump(dockcomp, f) + if "use_tap" in worker and worker["use_tap"]: + dockcomp_add_device(dockcomp, worker_name, "/dev/net/tun:/dev/net/tun") + dockcomp["services"][worker_name]["cap_add"] = [] + dockcomp["services"][worker_name]["cap_add"].append("NET_ADMIN") if "extra_actions" in worker: fp = open("%s/scripts/extra_actions" % workerdir, "w") for eaction in worker["extra_actions"]: @@ -452,7 +454,7 @@ def main(): fudev = open("output/%s/udev/99-lavaworker-udev.rules" % host, "a") fudev.write(udev_line) fudev.close() - if not "bind_dev" in slave: + if not "bind_dev" in slave or not slave["bind_dev"]: dockcomp_add_device(dockcomp, worker_name, "/dev/%s:/dev/%s" % (udev_dev["name"], udev_dev["name"])) use_nfs = False if "use_nfs" in worker: @@ -463,6 +465,8 @@ def main(): fp.write("apt-get -y install nfs-kernel-server\n") fp.close() os.chmod("%s/scripts/extra_actions" % workerdir, 0o755) + with open(dockcomposeymlpath, 'w') as f: + yaml.dump(dockcomp, f) if "loglevel" in worker: for component in worker["loglevel"]: if component != "lava-slave": @@ -519,11 +523,6 @@ def main(): if use_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: @@ -550,7 +549,7 @@ def main(): fp = open("output/%s/udev/99-lavaworker-udev.rules" % host, "a") fp.write(udev_line) fp.close() - if not "bind_dev" in slave: + if not "bind_dev" in slave or not slave["bind_dev"]: dockcomp_add_device(dockcomp, worker_name, "/dev/%s:/dev/%s" % (board_name, board_name)) use_conmux = False use_ser2net = False |