aboutsummaryrefslogtreecommitdiff
path: root/lava_scheduler_app/tests/device-types/qemu.jinja2
blob: ef7dd05bd6ae8a6cace73bcd93021d659a578d17 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
{% extends 'base.jinja2' %}

{% block vland %}
{% endblock vland %}

{% block body %}
device_type: qemu

# allow job context override - use a different variable name, undefined if not in job context
{% set base_guest_fs_size = guestfs_size | default(512) %}
{% set qemu_guest_fs_interface = guestfs_interface | default('ide') %}

available_architectures:
- arm64
- arm
- aarch64
- amd64
- x86_64
- i386

actions:
  deploy:
    methods:
      nfs:
      image:
        parameters:
          guest:
            size: {{ base_guest_fs_size }}  # in Mb
            interface: {{ qemu_guest_fs_interface }}
  boot:
    connections:
      serial:
      ssh:
    methods:
      qemu:
{% block qemu_method %}
        parameters:
          command:
{% if arch == 'arm64' or arch == 'aarch64' %}
            qemu-system-aarch64
{% elif arch == 'arm' %}
            qemu-system-arm
{% elif arch == 'amd64' or arch == 'x86_64' %}
            qemu-system-x86_64
{% elif arch == 'i386' %}
            qemu-system-i386
{% endif %}
          # used by installers to relate to the empty target device
          boot_options:
{% if arch == 'arm64' or arch == 'aarch64' %}
            {root: '{{ boot_root|default("/dev/vda2") }} rw rootwait', console: {{ boot_console|default('ttyAMA0 115200') }}, ip: dhcp, mem: 1024M}
{% elif arch == 'arm' %}
{% elif arch == 'amd64' %}
            {root: {{ boot_root|default('/dev/sda1') }},
             console: '{{ boot_console|default('ttyS0,115200') }}',
             boot_order: c}
{% else %}
            {root: {{ boot_root|default('/dev/sda1') }}, console: {{ boot_console|default('ttyS0,115200') }}}
{% endif %}
          options:
{% block qemu_options %}
{% if arch == 'arm64' or arch == 'aarch64' or arch == 'arm' %}
          - -cpu {{ cpu|default('cortex-a57') }}
          - -machine {{ machine|default('virt') }}
{% if vga %}
          - {{ vga }}
{% endif %}
{% if serial %}
          - {{ serial }}
{% endif %}
{% else %}
{% if not no_kvm %}
          - -cpu host
          - -enable-kvm
{% endif %}
{% endif %}
          - -nographic
          - -net nic,{{ model|default('model=virtio') }},macaddr={{ mac_addr|default('52:54:00:12:34:58') }} -net {{ netdevice|default('user') }}
          - -m {{ memory|default(512) }}
          - -monitor {{ monitor|default('none') }}
{# If you need to pass -soundhw in extra_options, then see doc/v2/qemu_options.rst for how to set the environment var QEMU_AUDIO_DRV=none #}
{% if extra_options %}
          extra: {{ extra_options }}
{% endif %}
{% endblock qemu_options -%}
{% endblock qemu_method %}
      qemu-nfs:
{{ self.qemu_method() }}
          append:
            console: {{ console_device|default('ttyAMA0') }}
            root: /dev/nfs
            nfsrootargs: {{ base_nfsroot_args }}
            ipargs: {{ base_ip_args }}
{% endblock body %}