summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkhilman <khilman@users.noreply.github.com>2018-11-26 15:21:50 -0800
committerGitHub <noreply@github.com>2018-11-26 15:21:50 -0800
commit52d2feb37ec3e11c99e28540c7b7a14fd0de6747 (patch)
tree5cca3f63e7e8d3cac1a5079ea92a0317151015f2
parent048d3751fabc7edb66d5bbd0349b5936f1d04f29 (diff)
parent3e5c111cd1a05a148bc1d66df815d93a831e4d9d (diff)
Merge pull request #71 from montjoie/bind_dev
lavalab-gen.py: Permits to bind host /dev to slave
-rw-r--r--README.md1
-rwxr-xr-xlavalab-gen.py8
2 files changed, 7 insertions, 2 deletions
diff --git a/README.md b/README.md
index 2ac99af..8d40736 100644
--- a/README.md
+++ b/README.md
@@ -256,6 +256,7 @@ slaves:
remote_user_token: The remote_user's token. This option is necessary only if no master node exists in boards.yaml. Otherwise lavalab-gen.py will get from it.
remote_proto: http(default) or https
default_slave: Does this slave is the default slave where to add boards (default: lab-slave-0)
+ bind_dev: Bind /dev from host to slave. This is needed when using some HID PDU
expose_ser2net: Do ser2net ports need to be available on host
expose_ports: Expose port p1 on the host to p2 on the worker slave.
- p1:p2
diff --git a/lavalab-gen.py b/lavalab-gen.py
index 4287efc..e9c228f 100755
--- a/lavalab-gen.py
+++ b/lavalab-gen.py
@@ -250,7 +250,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" ]
+ 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" ]
for keyword in slave:
if not keyword in keywords_slaves:
print("WARNING: unknown keyword %s" % keyword)
@@ -370,6 +370,9 @@ 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:
+ 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 "extra_actions" in worker:
@@ -459,7 +462,8 @@ def main():
else:
dockcomp["services"][worker_name]["devices"] = []
dc_devices = dockcomp["services"][worker_name]["devices"]
- dc_devices.append("/dev/%s:/dev/%s" % (board_name, board_name))
+ if not "bind_dev" in slave:
+ dc_devices.append("/dev/%s:/dev/%s" % (board_name, board_name))
use_conmux = True
use_ser2net = False
use_screen = False