From ba1194d18f296c474dc5d1d85402cccae860128e Mon Sep 17 00:00:00 2001 From: Corentin LABBE Date: Thu, 1 Feb 2018 12:09:10 +0100 Subject: Fix the lab-slave-0 name The boards.yaml documentation state that lava-slave should be named lab-slave-XXX but docker-compose.template does not use this convention. This force the use of this convention. --- docker-compose.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.template b/docker-compose.template index d125af8..63a708b 100644 --- a/docker-compose.template +++ b/docker-compose.template @@ -18,7 +18,7 @@ services: # boot and /lib/modules are for libguestfs (TODO set them read_only with docker-compose 3.0) - "/boot:/boot" - "/lib/modules:/lib/modules" - lava-slave: + lab-slave-0: hostname: lab-slave-0 #conmux does not support dns_search dns_search: "" -- cgit 1.2.3-korg From e0bb2bb05421169d9b5a4e9f515eced1e3bf2c13 Mon Sep 17 00:00:00 2001 From: Corentin LABBE Date: Thu, 1 Feb 2018 11:56:34 +0100 Subject: Remove hardcoded devices for lava-slave The node devices was hardcoded for lava-slave. For example, lava-master could never have devices. Remove that hard-coding and made devices dynamic for any labname. --- lavalab-gen.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lavalab-gen.py b/lavalab-gen.py index f8a5d95..21e2c0b 100755 --- a/lavalab-gen.py +++ b/lavalab-gen.py @@ -51,10 +51,6 @@ def main(args): tdc = open("docker-compose.template", "r") dockcomp = yaml.load(tdc) tdc.close() - dc_devices = dockcomp["services"]["lava-slave"]["devices"] - if dc_devices is None: - dockcomp["services"]["lava-slave"]["devices"] = [] - dc_devices = dockcomp["services"]["lava-slave"]["devices"] # The slaves directory must exists if not os.path.isdir("lava-master/slaves/"): @@ -93,6 +89,11 @@ def main(args): else: devpath = b["uart"]["devpath"] udev_line += template_udev_devpath.substitute(board=board_name, devpath=devpath, idvendor=idvendor, idproduct=idproduct) + if dockcomp["services"][lab_name].has_key("devices"): + dc_devices = dockcomp["services"][lab_name]["devices"] + else: + dockcomp["services"][lab_name]["devices"] = [] + dc_devices = dockcomp["services"][lab_name]["devices"] dc_devices.append("/dev/%s:/dev/%s" % (board_name, board_name)) fp = open("lava-slave/conmux/%s.cf" % board_name, "w") fp.write(line) -- cgit 1.2.3-korg From 8a0086b4f620ea44c5fff1070df9e71c891f4680 Mon Sep 17 00:00:00 2001 From: Corentin LABBE Date: Thu, 1 Feb 2018 12:16:22 +0100 Subject: Reintroduce qemu KVM support Since lava-docker must run on all arch, and that KVM is x86 specific, KVM support was disabled for qemu. Reintroduce it now as an option for each lab via the host_has_cpuflag_kvm flag. --- lavalab-gen.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lavalab-gen.py b/lavalab-gen.py index 21e2c0b..6264179 100755 --- a/lavalab-gen.py +++ b/lavalab-gen.py @@ -65,6 +65,16 @@ def main(args): for lab_name in labs: udev_line ="" lab = labs[lab_name] + use_kvm = False + if lab.has_key("host_has_cpuflag_kvm"): + use_kvm = lab["host_has_cpuflag_kvm"] + if use_kvm: + if dockcomp["services"][lab_name].has_key("devices"): + dc_devices = dockcomp["services"][lab_name]["devices"] + else: + dockcomp["services"][lab_name]["devices"] = [] + dc_devices = dockcomp["services"][lab_name]["devices"] + dc_devices.append("/dev/kvm:/dev/kvm") for board_name in lab["boardlist"]: b = lab["boardlist"][board_name] if b.get("disabled", None): @@ -110,7 +120,7 @@ def main(args): device_line += "{%% set fastboot_serial_number = '%s' %%}" % fserial # board specific hacks - if devicetype == "qemu": + if devicetype == "qemu" and not use_kvm: device_line += "{% set no_kvm = True %}\n" if not os.path.isdir("lava-master/devices/"): os.mkdir("lava-master/devices/") -- cgit 1.2.3-korg From ad471f82e990a8bca20aa44dab3c984ec5198b51 Mon Sep 17 00:00:00 2001 From: Corentin LABBE Date: Thu, 1 Feb 2018 12:09:37 +0100 Subject: Remove old devices node The "devices" node is now automaticly generated and added, so remove them from docker-compose.template. --- docker-compose.template | 4 ---- 1 file changed, 4 deletions(-) diff --git a/docker-compose.template b/docker-compose.template index 63a708b..87d59d3 100644 --- a/docker-compose.template +++ b/docker-compose.template @@ -7,9 +7,6 @@ services: tty: true build: context: lava-master -# TODO handle kvm option -# devices: -# - "/dev/kvm:/dev/kvm" ports: - "10080:80" - "5555:5555" @@ -25,7 +22,6 @@ services: restart: always build: context: lava-slave - devices: environment: LAVA_MASTER: "lava-master" ports: -- cgit 1.2.3-korg From b955ed71c99585837e7e9dba2c7073b32f1d2b1e Mon Sep 17 00:00:00 2001 From: Corentin LABBE Date: Thu, 1 Feb 2018 13:12:25 +0100 Subject: Document host_has_cpuflag_kvm Now host_has_cpuflag_kvm is used, we need to document it. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 14913e5..e54b729 100644 --- a/README.md +++ b/README.md @@ -216,6 +216,7 @@ This file describe how the DUTs are connected and powered. ``` lab-slave-XX: The name of the slave (where XX is a number) dispatcher_ip: the IP where the slave could be contacted. In lava-docker it is the host IP since docker proxify TFTP from host to the slave. + host_has_cpuflag_kvm: Does the host running lab-slave-XX have KVM boardlist: devicename: Each board must be named by their device-type as "device-type-XX" (where XX is a number) type: the LAVA device-type of this device -- cgit 1.2.3-korg