diff options
Diffstat (limited to 'roles/vm/guest')
-rw-r--r-- | roles/vm/guest/base/tasks/Debian.yml | 12 | ||||
-rw-r--r-- | roles/vm/guest/create/templates/libvirt-domain.xml.j2 | 16 |
2 files changed, 28 insertions, 0 deletions
diff --git a/roles/vm/guest/base/tasks/Debian.yml b/roles/vm/guest/base/tasks/Debian.yml index 74778d8e..1dfc4168 100644 --- a/roles/vm/guest/base/tasks/Debian.yml +++ b/roles/vm/guest/base/tasks/Debian.yml @@ -59,3 +59,15 @@ regexp: "^{{ item.key }}=" line: "{{ item.key }}={{ item.value }}" notify: update grub + + +- name: mount virtiofs shares from host + loop: "{{ install.vm.virtiofs | default({}) | dict2items }}" + loop_control: + label: "{{ item.key }} -> {{ item.value.dest }}" + mount: + src: "{{ item.key }}" + path: "{{ item.value.dest }}" + fstype: "virtiofs" + opts: "{{ item.value.mnt_opts | default(omit) }}" + state: mounted diff --git a/roles/vm/guest/create/templates/libvirt-domain.xml.j2 b/roles/vm/guest/create/templates/libvirt-domain.xml.j2 index 96b12a74..a7d584dc 100644 --- a/roles/vm/guest/create/templates/libvirt-domain.xml.j2 +++ b/roles/vm/guest/create/templates/libvirt-domain.xml.j2 @@ -2,6 +2,12 @@ <name>{{ inventory_hostname }}</name> <memory>{{ ((install.vm.memory | human_to_bytes) / 1024) | int }}</memory> <currentMemory>{{ ((install.vm.memory | human_to_bytes) / 1024) | int }}</currentMemory> +{% if 'virtiofs' in install.vm %} + <memoryBacking> + <source type='memfd'/> + <access mode='shared'/> + </memoryBacking> +{% endif %} <vcpu>{{ install.vm.numcpus }}</vcpu> <os> <type arch='x86_64' machine='q35'>hvm</type> @@ -73,6 +79,16 @@ {% endfor %} {% endif %} +{% if 'virtiofs' in install.vm %} +{% for tag,fs in install.vm.virtiofs.items() %} + <filesystem type='mount' accessmode='passthrough'> + <driver type='virtiofs'/> + <source dir='{{ fs.src }}'/> + <target dir='{{ tag }}'/> + </filesystem> +{% endfor %} + +{% endif %} {% if install.interfaces %} {% for if in install.interfaces %} <interface type='bridge'> |