diff mbox

[Branch,~linaro-validation/lava-dispatcher/trunk] Rev 623: KVM (aka qemu-system-x86_64) device support

Message ID 20130611124618.24358.36179.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

Antonio Terceiro June 11, 2013, 12:46 p.m. UTC
Merge authors:
  Antonio Terceiro (terceiro)
Related merge proposals:
  https://code.launchpad.net/~terceiro/lava-dispatcher/kvm/+merge/167659
  proposed by: Antonio Terceiro (terceiro)
------------------------------------------------------------
revno: 623 [merge]
committer: Antonio Terceiro <antonio.terceiro@linaro.org>
branch nick: trunk
timestamp: Tue 2013-06-11 09:40:35 -0300
message:
  KVM (aka qemu-system-x86_64) device support
  
  To create images, see:
  https://git.linaro.org/gitweb?p=lava/lava-vmdebootstrap.git
added:
  lava_dispatcher/default-config/lava-dispatcher/device-types/kvm.conf
modified:
  lava_dispatcher/config.py
  lava_dispatcher/default-config/lava-dispatcher/device-types/qemu.conf
  lava_dispatcher/default-config/lava-dispatcher/lava-dispatcher.conf
  lava_dispatcher/device/qemu.py
  lava_test_shell/distro/fedora/lava-install-packages
  lava_test_shell/distro/ubuntu/lava-install-packages


--
lp:lava-dispatcher
https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk

You are subscribed to branch lp:lava-dispatcher.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'lava_dispatcher/config.py'
--- lava_dispatcher/config.py	2013-06-04 16:00:29 +0000
+++ lava_dispatcher/config.py	2013-06-05 21:43:24 +0000
@@ -57,6 +57,8 @@ 
     lmc_dev_arg = schema.StringOption()
     master_str = schema.StringOption(default="root@master")
     pre_connect_command = schema.StringOption()
+    qemu_binary = schema.StringOption(default="qemu-system-arm")
+    qemu_options = schema.StringOption()
     qemu_drive_interface = schema.StringOption()
     qemu_machine_type = schema.StringOption()
     power_on_cmd = schema.StringOption()  # for sdmux
@@ -136,7 +138,6 @@ 
 
 
 class DispatcherSchema(schema.Schema):
-    default_qemu_binary = schema.StringOption(default="qemu")
     lava_cachedir = schema.StringOption()
     lava_cookies = schema.StringOption()
     lava_image_tmpdir = schema.StringOption()

=== added file 'lava_dispatcher/default-config/lava-dispatcher/device-types/kvm.conf'
--- lava_dispatcher/default-config/lava-dispatcher/device-types/kvm.conf	1970-01-01 00:00:00 +0000
+++ lava_dispatcher/default-config/lava-dispatcher/device-types/kvm.conf	2013-06-05 21:43:24 +0000
@@ -0,0 +1,3 @@ 
+client_type = qemu
+qemu_binary = qemu-system-x86_64
+qemu_options = -machine accel=kvm:tcg -hda {DISK_IMAGE} -nographic

=== modified file 'lava_dispatcher/default-config/lava-dispatcher/device-types/qemu.conf'
--- lava_dispatcher/default-config/lava-dispatcher/device-types/qemu.conf	2012-06-13 20:47:32 +0000
+++ lava_dispatcher/default-config/lava-dispatcher/device-types/qemu.conf	2013-06-05 21:43:24 +0000
@@ -1,6 +1,7 @@ 
-# NOTE: you also need to set something like:
-#  DEFAULT_QEMU_BINARY = qemu-system-arm
-# in your lava-dispatcher.conf file
+client_type=qemu
+
+qemu_binary = qemu-system-arm
+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
+
 qemu_machine_type = beaglexm
 qemu_drive_interface = sd
-client_type=qemu

=== modified file 'lava_dispatcher/default-config/lava-dispatcher/lava-dispatcher.conf'
--- lava_dispatcher/default-config/lava-dispatcher/lava-dispatcher.conf	2012-09-19 18:35:42 +0000
+++ lava_dispatcher/default-config/lava-dispatcher/lava-dispatcher.conf	2013-06-05 21:43:24 +0000
@@ -36,7 +36,3 @@ 
 # Use this variable if you want to use apt-get instead of pip to install lava-test
 # LAVA_TEST_DEB = lava-test
 LAVA_TEST_DEB = 
-
-# The qemu command to use.  Called 'default_qemu_binary' because we
-# want to allow testing custom qemu binaries soon.
-default_qemu_binary = qemu-system-arm

=== modified file 'lava_dispatcher/device/qemu.py'
--- lava_dispatcher/device/qemu.py	2013-02-18 03:06:06 +0000
+++ lava_dispatcher/device/qemu.py	2013-06-06 15:10:37 +0000
@@ -69,22 +69,22 @@ 
             extract_targz(tb, '%s/%s' % (mntdir, directory))
 
     def power_on(self):
-        qemu_cmd = ('%s -M %s -drive if=%s,cache=writeback,file=%s '
-                    '-clock unix -device usb-kbd -device usb-mouse -usb '
-                    '-device usb-net,netdev=mynet -netdev user,id=mynet '
-                    '-net nic -net user -nographic') % (
-            self.context.config.default_qemu_binary,
-            self.config.qemu_machine_type,
-            self.config.qemu_drive_interface,
-            self._sd_image)
+        qemu_options = self.config.qemu_options.format(
+            DISK_IMAGE=self._sd_image)
+        qemu_cmd = '%s %s' % (self.config.qemu_binary, qemu_options)
         logging.info('launching qemu with command %r' % qemu_cmd)
         proc = self.context.spawn(qemu_cmd, timeout=1200)
         return proc
 
+    def power_off(self, proc):
+        if proc:
+            proc.kill(9)
+            proc.close()
+
     def get_device_version(self):
         try:
             output = subprocess.check_output(
-                [self.context.config.default_qemu_binary, '--version'])
+                [self.config.qemu_binary, '--version'])
             matches = re.findall('[0-9]+\.[0-9a-z.+\-:~]+', output)
             return matches[-1]
         except subprocess.CalledProcessError:

=== modified file 'lava_test_shell/distro/fedora/lava-install-packages'
--- lava_test_shell/distro/fedora/lava-install-packages	2013-04-16 02:59:05 +0000
+++ lava_test_shell/distro/fedora/lava-install-packages	2013-06-06 14:47:36 +0000
@@ -1,3 +1,3 @@ 
 #!/bin/sh
 
-sudo yum -e 0 -y -q install "$@"
+yum -e 0 -y -q install "$@"

=== modified file 'lava_test_shell/distro/ubuntu/lava-install-packages'
--- lava_test_shell/distro/ubuntu/lava-install-packages	2013-04-15 19:16:44 +0000
+++ lava_test_shell/distro/ubuntu/lava-install-packages	2013-06-06 14:47:36 +0000
@@ -1,4 +1,4 @@ 
 #!/bin/sh
 
-sudo DEBIAN_FRONTEND=noninteractive apt-get update
-sudo DEBIAN_FRONTEND=noninteractive apt-get install -y -q "$@"
+DEBIAN_FRONTEND=noninteractive apt-get update
+DEBIAN_FRONTEND=noninteractive apt-get install -y -q "$@"