Skip to content

QEMU device setup

LAVA can use qemu as a DUT and run test inside QEMU.

Create device-type

Create a device-type in the admin interface.

The only relevant information is the device-type name that should be qemu.

Command line

lavacli device-types add qemu
lava-server manage device-types add qemu

Create device

Create a qemu device in the admin interface:

  • hostname: name of the device
  • device-type: qemu
  • worker host: worker that will run the job

Command line

lavacli devices add --type qemu --worker <worker> <hostname>
lava-server manage devices add \
    --device-type qemu \
    --worker <worker> \
    <hostname>

Device configuration

In order to submit jobs to the newly created device, LAVA requires a device dictionary. For a simple qemu job, this device dictionary would work:

{% extends "qemu.jinja2" %}

{% set netdevice = "user" %}
{% set memory = 1024 %}

This file should be pushed to the LAVA server under /etc/lava-server/dispatcher-config/devices/<hostname>.jinja2.

Command line

lavacli devices dict set <hostname> <filename>
cp <filename> /etc/lava-server/dispatcher-config/devices/<hostname>.jinja2
chown lavaserver:lavaserver /etc/lava-server/dispatcher-config/devices/<hostname>.jinja2

Activate the device

By default, a new device is put in maintenance.

As the device is now configure, admins can put it online in the device page.

Command line

lavacli devices update --health UNKNOWN <hostname>
lava-server manage devices update --health UNKNOWN <hostname>

Submit a job

Submit this simple test job:

device_type: qemu
job_name: simple qemu job

timeouts:
  job:
    minutes: 20
priority: medium
visibility: public

context:
  arch: amd64

actions:
- deploy:
    to: tmpfs
    timeout:
      minutes: 20
    images:
      rootfs:
        url: http://images.validation.linaro.org/kvm/debian-sid-2014_08_21-amd64.qcow2.xz
        image_arg: -drive format=qcow2,file={rootfs}
        format: qcow2
        compression: xz
    os: debian

- boot:
    method: qemu
    media: tmpfs
    timeout:
      minutes: 5
    prompts:
    - 'root@debian:~#'
    auto_login:
      login_prompt: "login:"
      username: root

- test:
    timeout:
      minutes: 5
    definitions:
    - repository: https://github.com/Linaro/test-definitions
      from: git
      path: automated/linux/smoke/smoke.yaml
      name: smoke-tests
    - repository: https://github.com/Linaro/test-definitions
      from: git
      path: automated/linux/meminfo/meminfo.yaml
      name: meminfo

The job page will look like this.