summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Hilman <khilman@baylibre.com>2019-09-19 18:37:45 +0200
committerGitHub <noreply@github.com>2019-09-19 18:37:45 +0200
commit8ebcea50e12756580560b4b6578ad3979682ea59 (patch)
treee348feb3a8d75adf2670a1603c6c4d0209d20dea
parentd25168d74c1d6860b4109e2b039e5d2033dc7235 (diff)
parentb8462ce7dd6e91f3c64761bca2322b35e3aa0ee7 (diff)
Merge pull request #103 from montjoie/optional-ports
Optional ports
-rw-r--r--README.md20
-rwxr-xr-xlavalab-gen.py86
2 files changed, 100 insertions, 6 deletions
diff --git a/README.md b/README.md
index 04e9b73..6776c84 100644
--- a/README.md
+++ b/README.md
@@ -247,6 +247,14 @@ masters:
- username: The LAVA user owning the token below. (This user should be created via users:)
token: The token for this callback
description: The description of this token. This string could be used with LAVA-CI.
+ smtp: WARNING: Usage of an SMTP server makes it mandatory for each user to have an email address
+ email_host: The host to use for sending email
+ email_host_user: Username to use for the SMTP server
+ email_host_password: Password to use for the SMTP server
+ email_port: Port to use for the SMTP server (default: 25)
+ email_use_tls: Whether to use a TLS (secure) connection when talking to the SMTP server
+ email_use_ssl: Whether to use an implicit TLS (secure) connection when talking to the SMTP server
+ email_backend: The backend to use for sending emails (default: 'django.core.mail.backends.smtp.EmailBackend')
slaveenv: A list of environment to pass to slave
- name: slavename The name of slave (mandatory)
env:
@@ -267,6 +275,9 @@ slaves:
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
+ use_tftp: Does LAVA need a TFTP server (default True)
+ use_nbd: Does LAVA need a NBD server (default True)
+ use_overlay_server: Does LAVA need an overlay server (default True)
use_nfs: Does the LAVA dispatcher will run NFS jobs
use_tap: Does TAP netdevices could be used
arch: The arch of the worker (if not x86_64), only accept arm64
@@ -380,8 +391,8 @@ docker-compose up -d
## Proxy cache (Work in progress)
A squid docker is provided for caching all LAVA downloads (image, dtb, rootfs, etc...)<br/>
-You have to uncomment a line in lava-master/Dockerfile to enable it.<br/>
For the moment, it is unsupported and unbuilded.
+For using an external squid server see "How to made LAVA slave use a proxy" below
## Backporting LAVA patches
All upstream LAVA patches could be backported by placing them in lava-master/lava-patch/
@@ -442,6 +453,13 @@ Add env to a slave like:
slave:
env:
- "http_proxy: http://dns:port"
+Or on master via
+ slaveenv:
+ - name: lab
+ env:
+ - "http_proxy: http://squid_IP_address:3128"
+ - "https_proxy: http://squid_IP_address:3128"
+
## How to use a board which uses PXE ?
All boards which uses PXE, could be used with LAVA via grub.
diff --git a/lavalab-gen.py b/lavalab-gen.py
index c2c5347..539d80c 100755
--- a/lavalab-gen.py
+++ b/lavalab-gen.py
@@ -64,7 +64,15 @@ template_settings_conf = string.Template("""
"ALLOWED_HOSTS": [ $allowed_hosts ],
"CSRF_TRUSTED_ORIGINS": ["$lava_http_fqdn"],
"CSRF_COOKIE_SECURE": $cookie_secure,
- "SESSION_COOKIE_SECURE": $session_cookie_secure
+ "SESSION_COOKIE_SECURE": $session_cookie_secure,
+ "SERVER_EMAIL": "$server_email",
+ "EMAIL_HOST": "$email_host",
+ "EMAIL_HOST_USER": "$email_host_user",
+ "EMAIL_HOST_PASSWORD": "$email_host_password",
+ "EMAIL_PORT": $email_port,
+ "EMAIL_USE_TLS": $email_use_tls,
+ "EMAIL_USE_SSL": $email_use_ssl,
+ "EMAIL_BACKEND": "$email_backend"
}
""")
@@ -105,7 +113,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", "loglevel", "allowed_hosts", "lava-coordinator", "healthcheck_url" ]
+ 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", "allowed_hosts", "lava-coordinator", "healthcheck_url", "smtp" ]
for keyword in master:
if not keyword in keywords_master:
print("WARNING: unknown keyword %s" % keyword)
@@ -185,8 +193,60 @@ def main():
f_fqdn = open("%s/lava_http_fqdn" % workerdir, 'w')
f_fqdn.write(lava_http_fqdn)
f_fqdn.close()
+ # DJANGO defaults
+ email_host = "localhost"
+ email_host_user = ""
+ email_host_password = ""
+ email_port = 25
+ email_use_tls = 'false'
+ email_use_ssl = 'false'
+ email_backend = 'django.core.mail.backends.smtp.EmailBackend'
+ server_email = "root@localhost"
+ if "smtp" in worker:
+ if "server_email" in worker["smtp"]:
+ server_email = worker["smtp"]["server_email"]
+ if "email_host" in worker["smtp"]:
+ email_host = worker["smtp"]["email_host"]
+ if "email_host_user" in worker["smtp"]:
+ email_host_user = worker["smtp"]["email_host_user"]
+ if "email_host_password" in worker["smtp"]:
+ email_host_password = worker["smtp"]["email_host_password"]
+ if "email_port" in worker["smtp"]:
+ email_port = worker["smtp"]["email_port"]
+ # django does not like True or False but want true/false (no upper case)
+ if "email_use_tls" in worker["smtp"]:
+ email_use_tls = worker["smtp"]["email_use_tls"]
+ if isinstance(email_use_tls, bool):
+ if email_use_tls:
+ email_use_tls = 'true'
+ else:
+ email_use_tls = 'false'
+ if "email_use_ssl" in worker["smtp"]:
+ email_use_ssl = worker["smtp"]["email_use_ssl"]
+ if isinstance(email_use_ssl, bool):
+ if email_use_ssl:
+ email_use_ssl = 'true'
+ else:
+ email_use_ssl = 'false'
+ if "email_backend" in worker["smtp"]:
+ email_backend = worker["smtp"]["email_backend"]
fsettings = open("%s/settings.conf" % workerdir, 'w')
- fsettings.write(template_settings_conf.substitute(cookie_secure=cookie_secure, session_cookie_secure=session_cookie_secure, lava_http_fqdn=lava_http_fqdn, allowed_hosts=allowed_hosts))
+ fsettings.write(
+ template_settings_conf.substitute(
+ cookie_secure=cookie_secure,
+ session_cookie_secure=session_cookie_secure,
+ lava_http_fqdn=lava_http_fqdn,
+ allowed_hosts=allowed_hosts,
+ email_host = email_host,
+ email_host_user = email_host_user,
+ email_host_password = email_host_password,
+ email_port = email_port,
+ email_use_tls = email_use_tls,
+ email_use_ssl = email_use_ssl,
+ email_backend = email_backend,
+ server_email = server_email
+ )
+ )
fsettings.close()
master_use_zmq_auth = False
if "zmq_auth" in worker:
@@ -304,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" ]
+ 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" ]
for keyword in slave:
if not keyword in keywords_slaves:
print("WARNING: unknown keyword %s" % keyword)
@@ -334,7 +394,7 @@ def main():
dockcomp["services"][name] = {}
dockcomp["services"][name]["hostname"] = name
dockcomp["services"][name]["dns_search"] = ""
- dockcomp["services"][name]["ports"] = [ "69:69/udp", "80:80", "61950-62000:61950-62000" ]
+ dockcomp["services"][name]["ports"] = []
dockcomp["services"][name]["volumes"] = [ "/boot:/boot", "/lib/modules:/lib/modules" ]
dockcomp["services"][name]["environment"] = {}
dockcomp["services"][name]["build"] = {}
@@ -474,6 +534,22 @@ def main():
fudev.close()
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_tftp = True
+ if "use_tftp" in worker:
+ use_tftp = worker["use_tftp"]
+ if use_tftp:
+ dockcomp["services"][name]["ports"].append("69:69/udp")
+ # TODO permit to change the range of NBD ports
+ use_nbd = True
+ if "use_nbd" in worker:
+ use_nbd = worker["use_nbd"]
+ if use_nbd:
+ dockcomp["services"][name]["ports"].append("61950-62000:61950-62000")
+ use_overlay_server = True
+ if "use_overlay_server" in worker:
+ use_overlay_server = worker["use_overlay_server"]
+ if use_overlay_server:
+ dockcomp["services"][name]["ports"].append("80:80")
use_nfs = False
if "use_nfs" in worker:
use_nfs = worker["use_nfs"]