summaryrefslogtreecommitdiffstats
path: root/lavalab-gen.py
diff options
context:
space:
mode:
authorkhilman <khilman@users.noreply.github.com>2018-02-14 09:29:51 -0800
committerGitHub <noreply@github.com>2018-02-14 09:29:51 -0800
commit7af6b055f0961e6fca7dc628cee3cd0a8d034d07 (patch)
treed40e278dbf675949b604b597cb033303501a9a5d /lavalab-gen.py
parent10a657a9767b998f4503318c60eae3816b5863e9 (diff)
parentb955ed71c99585837e7e9dba2c7073b32f1d2b1e (diff)
Merge pull request #21 from montjoie/enablekvm
Allow KVM support for slaves
Diffstat (limited to 'lavalab-gen.py')
-rwxr-xr-xlavalab-gen.py21
1 files changed, 16 insertions, 5 deletions
diff --git a/lavalab-gen.py b/lavalab-gen.py
index f8a5d95..6264179 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/"):
@@ -69,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):
@@ -93,6 +99,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)
@@ -109,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/")