Merge lp:~terceiro/lava-dispatcher/kvm into lp:lava-dispatcher

Proposed by Antonio Terceiro
Status: Merged
Merged at revision: 623
Proposed branch: lp:~terceiro/lava-dispatcher/kvm
Merge into: lp:lava-dispatcher
Diff against target: 112 lines (+22/-21)
7 files modified
lava_dispatcher/config.py (+2/-1)
lava_dispatcher/default-config/lava-dispatcher/device-types/kvm.conf (+3/-0)
lava_dispatcher/default-config/lava-dispatcher/device-types/qemu.conf (+5/-4)
lava_dispatcher/default-config/lava-dispatcher/lava-dispatcher.conf (+0/-4)
lava_dispatcher/device/qemu.py (+9/-9)
lava_test_shell/distro/fedora/lava-install-packages (+1/-1)
lava_test_shell/distro/ubuntu/lava-install-packages (+2/-2)
To merge this branch: bzr merge lp:~terceiro/lava-dispatcher/kvm
Reviewer Review Type Date Requested Status
Linaro Validation Team Pending
Review via email: mp+167659@code.launchpad.net

Description of the change

This branch makes the QEMU device type backend more flexible and with that flexibility adds a KVM (aka qemu-system-x86_64) device type on top.

  * Extract QEMU ARM-specific options to configuration options
  * Allow qemu binary to actually be overriden for each device type
  * Add a very simple kvm.conf

The provided kvm.conf requires QEMU 1.5, although it should be easy enough to create other that supports older qemu/kvm if needed.

I was able to boot test a custom-made Debian image using this kvm device type. I will post instructions on how to create a LAVA-ready Debian image in the near future.

To post a comment you must log in.
lp:~terceiro/lava-dispatcher/kvm updated
624. By Antonio Terceiro

Remove need for sudo in test images

One of the requirement for test images is auto login as root, so there is no
point in channel those calls through sudo.

625. By Antonio Terceiro

Force termination of QEMU process

For some reason it would fail with qemu-system-x86_64 (aka KVM) after a
lava-test-shell run.

Revision history for this message
Antonio Terceiro (terceiro) wrote :

I had some issues when running lava-test-shell, so I made another 2
changes:

- removed sudo from package installation calls in lava-test-shell
  debian-based and fedora image support (LAVA-compliant images are
  supposed to boot to a root prompt anyway). This relieves test images
  from having sudo installed.

- forcing termination of the QEMU process with proc.kill(9) - for some
  reason I was hitting an exception in pexpect.close saying (close()
  could not terminate the child using terminate())

So now I have tested and working both a simple boot test and lava-test-shell.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lava_dispatcher/config.py'
2--- lava_dispatcher/config.py 2013-06-04 16:00:29 +0000
3+++ lava_dispatcher/config.py 2013-06-06 15:16:23 +0000
4@@ -57,6 +57,8 @@
5 lmc_dev_arg = schema.StringOption()
6 master_str = schema.StringOption(default="root@master")
7 pre_connect_command = schema.StringOption()
8+ qemu_binary = schema.StringOption(default="qemu-system-arm")
9+ qemu_options = schema.StringOption()
10 qemu_drive_interface = schema.StringOption()
11 qemu_machine_type = schema.StringOption()
12 power_on_cmd = schema.StringOption() # for sdmux
13@@ -136,7 +138,6 @@
14
15
16 class DispatcherSchema(schema.Schema):
17- default_qemu_binary = schema.StringOption(default="qemu")
18 lava_cachedir = schema.StringOption()
19 lava_cookies = schema.StringOption()
20 lava_image_tmpdir = schema.StringOption()
21
22=== added file 'lava_dispatcher/default-config/lava-dispatcher/device-types/kvm.conf'
23--- lava_dispatcher/default-config/lava-dispatcher/device-types/kvm.conf 1970-01-01 00:00:00 +0000
24+++ lava_dispatcher/default-config/lava-dispatcher/device-types/kvm.conf 2013-06-06 15:16:23 +0000
25@@ -0,0 +1,3 @@
26+client_type = qemu
27+qemu_binary = qemu-system-x86_64
28+qemu_options = -machine accel=kvm:tcg -hda {DISK_IMAGE} -nographic
29
30=== modified file 'lava_dispatcher/default-config/lava-dispatcher/device-types/qemu.conf'
31--- lava_dispatcher/default-config/lava-dispatcher/device-types/qemu.conf 2012-06-13 20:47:32 +0000
32+++ lava_dispatcher/default-config/lava-dispatcher/device-types/qemu.conf 2013-06-06 15:16:23 +0000
33@@ -1,6 +1,7 @@
34-# NOTE: you also need to set something like:
35-# DEFAULT_QEMU_BINARY = qemu-system-arm
36-# in your lava-dispatcher.conf file
37+client_type=qemu
38+
39+qemu_binary = qemu-system-arm
40+qemu_options = -M %(qemu_machine_type)s -drive if=%(qemu_drive_interface)s,cache=writeback,file={DISK_IMAGE} -clock unix -device usb-kbd -device usb-mouse -usb -device usb-net,netdev=mynet -netdev user,id=mynet -net nic -net user -nographic
41+
42 qemu_machine_type = beaglexm
43 qemu_drive_interface = sd
44-client_type=qemu
45
46=== modified file 'lava_dispatcher/default-config/lava-dispatcher/lava-dispatcher.conf'
47--- lava_dispatcher/default-config/lava-dispatcher/lava-dispatcher.conf 2012-09-19 18:35:42 +0000
48+++ lava_dispatcher/default-config/lava-dispatcher/lava-dispatcher.conf 2013-06-06 15:16:23 +0000
49@@ -36,7 +36,3 @@
50 # Use this variable if you want to use apt-get instead of pip to install lava-test
51 # LAVA_TEST_DEB = lava-test
52 LAVA_TEST_DEB =
53-
54-# The qemu command to use. Called 'default_qemu_binary' because we
55-# want to allow testing custom qemu binaries soon.
56-default_qemu_binary = qemu-system-arm
57
58=== modified file 'lava_dispatcher/device/qemu.py'
59--- lava_dispatcher/device/qemu.py 2013-02-18 03:06:06 +0000
60+++ lava_dispatcher/device/qemu.py 2013-06-06 15:16:23 +0000
61@@ -69,22 +69,22 @@
62 extract_targz(tb, '%s/%s' % (mntdir, directory))
63
64 def power_on(self):
65- qemu_cmd = ('%s -M %s -drive if=%s,cache=writeback,file=%s '
66- '-clock unix -device usb-kbd -device usb-mouse -usb '
67- '-device usb-net,netdev=mynet -netdev user,id=mynet '
68- '-net nic -net user -nographic') % (
69- self.context.config.default_qemu_binary,
70- self.config.qemu_machine_type,
71- self.config.qemu_drive_interface,
72- self._sd_image)
73+ qemu_options = self.config.qemu_options.format(
74+ DISK_IMAGE=self._sd_image)
75+ qemu_cmd = '%s %s' % (self.config.qemu_binary, qemu_options)
76 logging.info('launching qemu with command %r' % qemu_cmd)
77 proc = self.context.spawn(qemu_cmd, timeout=1200)
78 return proc
79
80+ def power_off(self, proc):
81+ if proc:
82+ proc.kill(9)
83+ proc.close()
84+
85 def get_device_version(self):
86 try:
87 output = subprocess.check_output(
88- [self.context.config.default_qemu_binary, '--version'])
89+ [self.config.qemu_binary, '--version'])
90 matches = re.findall('[0-9]+\.[0-9a-z.+\-:~]+', output)
91 return matches[-1]
92 except subprocess.CalledProcessError:
93
94=== modified file 'lava_test_shell/distro/fedora/lava-install-packages'
95--- lava_test_shell/distro/fedora/lava-install-packages 2013-04-16 02:59:05 +0000
96+++ lava_test_shell/distro/fedora/lava-install-packages 2013-06-06 15:16:23 +0000
97@@ -1,3 +1,3 @@
98 #!/bin/sh
99
100-sudo yum -e 0 -y -q install "$@"
101+yum -e 0 -y -q install "$@"
102
103=== modified file 'lava_test_shell/distro/ubuntu/lava-install-packages'
104--- lava_test_shell/distro/ubuntu/lava-install-packages 2013-04-15 19:16:44 +0000
105+++ lava_test_shell/distro/ubuntu/lava-install-packages 2013-06-06 15:16:23 +0000
106@@ -1,4 +1,4 @@
107 #!/bin/sh
108
109-sudo DEBIAN_FRONTEND=noninteractive apt-get update
110-sudo DEBIAN_FRONTEND=noninteractive apt-get install -y -q "$@"
111+DEBIAN_FRONTEND=noninteractive apt-get update
112+DEBIAN_FRONTEND=noninteractive apt-get install -y -q "$@"

Subscribers

People subscribed via source and target branches