aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorentin LABBE <clabbe@baylibre.com>2019-08-21 10:53:16 +0200
committerCorentin LABBE <clabbe@baylibre.com>2020-01-16 11:43:22 +0100
commit8cf19027a638428f3267f2da5fb594bff7ed2841 (patch)
tree4f54aa88e39dc0f67fd5a7ddbc7ed33ca53fd55b
parent694f774c113da4e2b15fead6b3e19ac95a9528bd (diff)
Add custom volumes
For some case, we need to add custom volumes (like for /var/lib/lxc/cache)
-rw-r--r--README.md2
-rwxr-xr-xlavalab-gen.py9
2 files changed, 10 insertions, 1 deletions
diff --git a/README.md b/README.md
index 5898e10..954d90d 100644
--- a/README.md
+++ b/README.md
@@ -285,6 +285,8 @@ slaves:
host_healthcheck: If true, enable the optional healthcheck container. See hosting healthchecks below
lava-coordinator: Does the slave should ran a lava-coordinator
expose_ser2net: Do ser2net ports need to be available on host
+ custom_volumes:
+ - "name:path" Add a custom volume
expose_ports: Expose port p1 on the host to p2 on the worker slave.
- p1:p2
extra_actions: An optional list of action to do at end of the docker build
diff --git a/lavalab-gen.py b/lavalab-gen.py
index a766e5f..218f5ec 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", "tags", "use_docker" ]
+ 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", "use_docker", "custom_volumes" ]
for keyword in slave:
if not keyword in keywords_slaves:
print("WARNING: unknown keyword %s" % keyword)
@@ -479,6 +479,13 @@ def main():
for line in slave["env"]:
fenv.write(" %s\n" % line)
fenv.close()
+ if "custom_volumes" in slave:
+ for cvolume in slave["custom_volumes"]:
+ dockcomp["services"][worker_name]["volumes"].append(cvolume)
+ volume_name = cvolume.split(':')[0]
+ if "volumes" not in dockcomp:
+ dockcomp["volumes"] = {}
+ dockcomp["volumes"][volume_name] = {}
if not "remote_proto" in worker:
remote_proto = "http"
else: