diff options
Diffstat (limited to 'roles/vm')
-rw-r--r-- | roles/vm/guest/create/templates/libvirt-domain.xml.j2 | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/roles/vm/guest/create/templates/libvirt-domain.xml.j2 b/roles/vm/guest/create/templates/libvirt-domain.xml.j2 index a7d584dc..c4ab6a4a 100644 --- a/roles/vm/guest/create/templates/libvirt-domain.xml.j2 +++ b/roles/vm/guest/create/templates/libvirt-domain.xml.j2 @@ -21,7 +21,9 @@ <boot dev='cdrom'/> {% endif %} {% else %} - <boot dev='hd'/> +{% for device in install.vm.boot | default(['hd']) %} + <boot dev='{{ device }}'/> +{% endfor %} {% endif %} </os> <features> @@ -56,7 +58,18 @@ </disk> {% endif %} -{% if install.disks %} +{% if 'cdrom' in install.vm %} +{% for device,image in install.vm.cdrom.items() %} + <disk type='file' device='cdrom'> + <driver name='qemu'/> + <source file='{{ image }}'/> + <target dev='{{ device }}' bus='sata'/> + <readonly/> + </disk> +{% endfor %} + +{% endif %} +{% if 'disks' in install %} {% if 'scsi' in install.disks %} <controller type='scsi' index='0' model='virtio-scsi'/> {% endif %} @@ -89,7 +102,7 @@ {% endfor %} {% endif %} -{% if install.interfaces %} +{% if 'interfaces' in install %} {% for if in install.interfaces %} <interface type='bridge'> {% if 'mac' in if %} @@ -102,6 +115,25 @@ {% endfor %} {% endif %} +{% if 'pci_passthrough' in install.vm %} +{% for device in install.vm.pci_passthrough %} + <hostdev mode='subsystem' type='pci' managed='yes'> + <source> + <address domain='{{ "0x%04x" | format(device.domain) }}' bus='{{ "0x%02x" | format(device.bus) }}' slot='{{ "0x%02x" | format(device.slot) }}' function='{{ "0x%01x" | format(device.slot) }}'/> + </source> + </hostdev> +{% endfor %} + +{% endif %} +{% if 'graphics' in install.vm %} + <graphics type='{{ install.vm.graphics.proto }}' port='{{ install.vm.graphics.port }}'> + <listen type='address' address='{{ install.vm.graphics.address }}' /> + </graphics> + <video> + <model type='{{ install.vm.graphics.model }}' /> + </video> + +{% endif %} <serial type='pty'> <target port='0'/> </serial> |