From 2fb6759a52e2e7ba267d0c0b93c1b32d4bd98dcb Mon Sep 17 00:00:00 2001 From: Corentin LABBE Date: Thu, 25 Apr 2019 15:41:28 +0200 Subject: README: Add an example on how to use PXE This patch adds an example on how to uses PXE with lava-docker. --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index 7002c57..1008842 100644 --- a/README.md +++ b/README.md @@ -422,6 +422,19 @@ slave: env: - "http_proxy: http://dns:port" +## How to use a board which uses PXE ? +All boards which uses PXE, could be used with LAVA via grub. +But you need to add a configuration in your DHCP server for that board. +This configuration need tell to the PXE to get GRUB for the dispatcher TFTP. +EXample for an upsquare and a dispatcher availlable at 192.168.66.1: +``` + host upsquare { + hardware ethernet 00:07:32:54:41:bb; + filename "/boot/grub/x86_64-efi/core.efi"; + next-server 192.168.66.1; + } +``` + ## Bugs, Contact The prefered way to submit bugs are via the github issue tracker You can also contact us on #lava-docker on the freenode IRC network -- cgit 1.2.3-korg From 1a945b23055136e5e89cd24585884b568d86a625 Mon Sep 17 00:00:00 2001 From: Corentin LABBE Date: Thu, 25 Apr 2019 16:33:09 +0200 Subject: Permit to do NFS jobs This patch adds an helper for doing NFS jobs --- README.md | 7 +++++++ lavalab-gen.py | 11 ++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1008842..91a0d72 100644 --- a/README.md +++ b/README.md @@ -265,6 +265,7 @@ 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_nfs: Does the LAVA dispatcher will run NFS jobs 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 @@ -405,6 +406,12 @@ For building an arm64 lava-docker, some little trick are necesssary: For building lava-xxx-base images - replace "bitnami/minideb" by "arm64v8/debian" on lava-master-base/lava-slave-base dockerfiles. +# How to ran NFS jobs +You need to se use_nfs: True on slave that will ran NFS jobs. +A working NFS server must be working on the host. +Furthermore, you must create a /var/lib/lava/dispatcher/tmp directory on the host and export it like: +/var/lib/lava/dispatcher/tmp 192.168.66.0/24(no_root_squash,rw,no_subtree_check) + ## How to add custom LAVA patchs You can add custom or backported LAVA patchs in lava-master/lava-patch Doing the same for lava-slave will be done later. diff --git a/lavalab-gen.py b/lavalab-gen.py index d1a78e2..af01b2a 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" ] for keyword in slave: if not keyword in keywords_slaves: print("WARNING: unknown keyword %s" % keyword) @@ -413,6 +413,15 @@ def main(): fp.write("\n") fp.close() os.chmod("%s/scripts/extra_actions" % workerdir, 0o755) + 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": -- cgit 1.2.3-korg From ad91a66ca580976a929f1e07045fa52bf1633c2b Mon Sep 17 00:00:00 2001 From: Corentin LABBE Date: Thu, 25 Apr 2019 16:49:06 +0200 Subject: Permit to set arch for arm64 slaves Currently arm64 workers need to modify at hand the from in the dockerfile for using arm64 images. This patch automate this; --- README.md | 1 + lavalab-gen.py | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 91a0d72..5c7c57c 100644 --- a/README.md +++ b/README.md @@ -266,6 +266,7 @@ slaves: 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_nfs: Does the LAVA dispatcher will run NFS jobs + arch: The arch of the worker (if not x86_64), only accept arm64 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 af01b2a..65e2560 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", "use_nfs" ] + 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" ] 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" -- cgit 1.2.3-korg From c56647c31313fe9cbf6aff9ab1e5c6ef5faf14f2 Mon Sep 17 00:00:00 2001 From: Corentin LABBE Date: Thu, 25 Apr 2019 17:20:52 +0200 Subject: Permit to add extra devices in the slave This patch permit to adds extra devices (like a USB relay) in the slave --- README.md | 6 ++++++ lavalab-gen.py | 18 +++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5c7c57c..de78d7b 100644 --- a/README.md +++ b/README.md @@ -275,6 +275,12 @@ slaves: env: - line1 A list of line to set as environment (See /etc/lava-server/env.yaml for examples) - line2 + devices: A list of devices which need UDEV rules + - name: The name of the device + vendorid: The VID of the UART (Formated as 0xXXXX) + productid: the PID of the UART (Formated as 0xXXXX) + serial: The serial number of the device if the device got one + devpath: The UDEV devpath to this device if more than one is present boards: - name: devicename Each board must be named by their device-type as "device-type-XX" (where XX is a number) diff --git a/lavalab-gen.py b/lavalab-gen.py index 65e2560..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", "use_nfs", "arch" ] + 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) @@ -420,6 +420,22 @@ 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"] -- cgit 1.2.3-korg