summaryrefslogtreecommitdiff
path: root/roles/vm/guest/define/templates/libvirt-domain.xml.j2
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2022-01-01 17:13:26 +0100
committerChristian Pointner <equinox@spreadspace.org>2022-01-02 23:26:17 +0100
commita9c5560dcca18a0df93341289087a9585fbca29c (patch)
treebe284c40faea1e61f8304e49dcc7a9d0788be193 /roles/vm/guest/define/templates/libvirt-domain.xml.j2
parentminor cleanup for grafana dashboards (diff)
add new openwrt-based testvm
add new vm-deploy playbook and script
Diffstat (limited to 'roles/vm/guest/define/templates/libvirt-domain.xml.j2')
-rw-r--r--roles/vm/guest/define/templates/libvirt-domain.xml.j24
1 files changed, 3 insertions, 1 deletions
diff --git a/roles/vm/guest/define/templates/libvirt-domain.xml.j2 b/roles/vm/guest/define/templates/libvirt-domain.xml.j2
index 0430229b..11b1be6e 100644
--- a/roles/vm/guest/define/templates/libvirt-domain.xml.j2
+++ b/roles/vm/guest/define/templates/libvirt-domain.xml.j2
@@ -56,7 +56,7 @@
{% endif %}
{% for bus in ['virtio', 'scsi'] %}
{% for device, src in (install.disks[bus] | default({})).items() %}
- <disk type='block' device='disk'>
+ <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('-', '--') }}'/>
@@ -64,6 +64,8 @@
<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>