2 <name>{{ hostname }}</name>
3 <memory>{{ hostvars[hostname].install_cooked.mem * 1024 }}</memory>
4 <currentMemory>{{ hostvars[hostname].install_cooked.mem * 1024 }}</currentMemory>
5 <vcpu>{{ hostvars[hostname].install_cooked.numcpu }}</vcpu>
7 <type arch='x86_64' machine='pc-0.12'>hvm</type>
8 {% if vm_define_installer %}
9 <kernel>{{ debian_installer_path }}/{{ install_distro }}-{{ install_codename }}/{{ hostvars[hostname].install_cooked.arch | default('amd64') }}/linux</kernel>
10 <initrd>{{ preseed_tmpdir }}/initrd.preseed.gz</initrd>
11 <cmdline>console=ttyS0,115200n8</cmdline>
21 <on_poweroff>destroy</on_poweroff>
22 {% if vm_define_installer %}
23 <on_reboot>destroy</on_reboot>
24 <on_crash>destroy</on_crash>
26 <on_reboot>restart</on_reboot>
27 <on_crash>restart</on_crash>
30 <emulator>/usr/bin/kvm</emulator>
31 <!-- Provide a virtualized RNG to the guest -->
33 <!-- Allow consuming up to 10kb/s, measured over 2s -->
34 <rate period="2000" bytes="20480"/>
35 <backend model='random'>/dev/urandom</backend>
38 {% if 'virtio' in hostvars[hostname].install_cooked.disks %}
39 {% for device, lv in hostvars[hostname].install_cooked.disks.virtio.items() %}
40 <disk type='block' device='disk'>
41 <driver name='qemu' type='raw' cache='none' discard='unmap'/>
42 <source dev='/dev/mapper/{{ lv.vg | replace('-', '--') }}-{{ lv.lv | replace('-', '--') }}'/>
43 <target dev='{{ device }}' bus='virtio'/>
48 {% if 'scsi' in hostvars[hostname].install_cooked.disks %}
49 <controller type='scsi' index='0' model='virtio-scsi'/>
50 {% for device, lv in hostvars[hostname].install_cooked.disks.scsi.items() %}
51 <disk type='block' device='disk'>
52 <driver name='qemu' type='raw' cache='none' discard='unmap'/>
53 <source dev='/dev/mapper/{{ lv.vg | replace('-', '--') }}-{{ lv.lv | replace('-', '--') }}'/>
54 <target dev='{{ device }}' bus='scsi'/>
59 {% if hostvars[hostname].install_cooked.interfaces %}
60 {% for if in hostvars[hostname].install_cooked.interfaces %}
61 <interface type='bridge'>
62 <source bridge='{{ if.bridge }}'/>
63 <model type='virtio'/>
64 <address type='pci' domain='0x0000' bus='0x01' slot='0x0{{ loop.index }}' function='0x0'/>
73 <target type='serial' port='0'/>