diff options
author | Christian Pointner <equinox@spreadspace.org> | 2022-01-06 19:22:14 +0100 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2022-01-06 19:22:14 +0100 |
commit | e3d0be5df3a8a43b19da0bb814c8174048cfc79f (patch) | |
tree | adf9917fb0dbe94328c465da5e46b96317a3870d /roles/vm/guest/define/templates | |
parent | Merge branch 'topic/openwrt-deploy' (diff) |
split up vm/define into remove and create
Diffstat (limited to 'roles/vm/guest/define/templates')
-rw-r--r-- | roles/vm/guest/define/templates/libvirt-domain.xml.j2 | 96 |
1 files changed, 0 insertions, 96 deletions
diff --git a/roles/vm/guest/define/templates/libvirt-domain.xml.j2 b/roles/vm/guest/define/templates/libvirt-domain.xml.j2 deleted file mode 100644 index 11b1be6e..00000000 --- a/roles/vm/guest/define/templates/libvirt-domain.xml.j2 +++ /dev/null @@ -1,96 +0,0 @@ -<domain type='kvm'> - <name>{{ inventory_hostname }}</name> - <memory>{{ ((install.vm.memory | human_to_bytes) / 1024) | int }}</memory> - <currentMemory>{{ ((install.vm.memory | human_to_bytes) / 1024) | int }}</currentMemory> - <vcpu>{{ install.vm.numcpus }}</vcpu> - <os> - <type arch='x86_64' machine='q35'>hvm</type> -{% if vm_define_installer %} -{% if install_distro == 'debian' or install_distro == 'ubuntu' %} - <kernel>{{ installer_tmpdir }}/linux</kernel> - <initrd>{{ installer_tmpdir }}/initrd.gz</initrd> - <cmdline>console=ttyS0,115200n8 auto</cmdline> - <boot dev='hd'/> -{% elif install_distro == 'openbsd' %} - <boot dev='cdrom'/> -{% endif %} -{% else %} - <boot dev='hd'/> -{% endif %} - </os> - <features> - <acpi/> - <apic/> - <pae/> - </features> - <clock offset='utc'/> - <on_poweroff>destroy</on_poweroff> -{% if vm_define_installer %} - <on_reboot>destroy</on_reboot> - <on_crash>destroy</on_crash> -{% else %} - <on_reboot>restart</on_reboot> - <on_crash>restart</on_crash> -{% endif %} - <devices> - <emulator>/usr/bin/kvm</emulator> - <!-- Provide a virtualized RNG to the guest --> - <rng model='virtio'> - <!-- Allow consuming up to 10kb/s, measured over 2s --> - <rate period="2000" bytes="20480"/> - <backend model='random'>/dev/random</backend> - </rng> - -{% if vm_define_installer and install_distro == 'openbsd' %} - <disk type='file' device='cdrom'> - <driver name='qemu'/> - <source file='{{ installer_tmpdir }}/{{ inventory_hostname }}.iso'/> - <target dev='sdz' bus='sata'/> - <readonly/> - </disk> - -{% endif %} -{% if install.disks %} -{% if 'scsi' in install.disks %} - <controller type='scsi' index='0' model='virtio-scsi'/> -{% endif %} -{% for bus in ['virtio', 'scsi'] %} -{% for device, src in (install.disks[bus] | default({})).items() %} - <disk type='{{ (src.type == 'image') | ternary('file', 'block') }}' device='disk'> - <driver name='qemu' type='raw' cache='none' discard='unmap'/> -{% if src.type == 'lvm' %} - <source dev='/dev/mapper/{{ src.vg | replace('-', '--') }}-{{ src.lv | replace('-', '--') }}'/> -{% elif src.type == 'zfs' %} - <source dev='/dev/zvol/{{ vm_host.zfs[src.backend | default('default')].pool }}/{{ vm_host.zfs[src.backend | default('default')].name }}/{{ inventory_hostname }}/{{ src.name }}'/> -{% elif src.type == 'blockdev' %} - <source dev='{{ src.path }}'/> -{% elif src.type == 'image' %} - <source file='{{ src.path }}'/> -{% endif %} - <target dev='{{ device }}' bus='{{ bus }}'/> - </disk> -{% endfor %} -{% endfor %} - -{% endif %} -{% if install.interfaces %} -{% for if in install.interfaces %} - <interface type='bridge'> -{% if 'mac' in if %} - <mac address='{{ if.mac }}'/> -{% endif %} - <source bridge='{{ if.bridge }}'/> - <model type='virtio'/> - <address type='pci' domain='0x0000' bus='0x{{ "%02x" | format(loop.index0 + 16) }}' slot='0x00' function='0x0'/> - </interface> -{% endfor %} - -{% endif %} - <serial type='pty'> - <target port='0'/> - </serial> - <console type='pty'> - <target type='serial' port='0'/> - </console> - </devices> -</domain> |