summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2023-08-25 02:05:14 +0200
committerChristian Pointner <equinox@spreadspace.org>2023-08-25 02:05:14 +0200
commitd257bc25104686181c375201677c2c2238cf9047 (patch)
tree77609756a002b3f02645cc6eca5885dfbc5fa156
parentadd brt to authorized_keys for root on sk-cloudio (diff)
vm/guest: make cpu mode/model/... configurable
-rw-r--r--roles/vm/guest/create/templates/libvirt-domain.xml.j215
1 files changed, 15 insertions, 0 deletions
diff --git a/roles/vm/guest/create/templates/libvirt-domain.xml.j2 b/roles/vm/guest/create/templates/libvirt-domain.xml.j2
index ce7894c0..0d124566 100644
--- a/roles/vm/guest/create/templates/libvirt-domain.xml.j2
+++ b/roles/vm/guest/create/templates/libvirt-domain.xml.j2
@@ -31,6 +31,21 @@
<apic/>
<pae/>
</features>
+{% if 'cpu' in install.vm %}
+ <cpu mode='{{ install.vm.cpu.mode }}'>
+{% if 'model' in install.vm.cpu %}
+ <model>{{ install.vm.cpu.model }}</model>
+{% endif %}
+{% if 'topology' in install.vm.cpu %}
+ <topology sockets='{{ install.vm.cpu.topology.sockets }}' cores='{{ install.vm.cpu.topology.cores }}' threads='{{ install.vm.cpu.topology.threads }}'/>
+{% endif %}
+{% for feature, policy in (install.vm.cpu.features | default({})).items() %}
+ <feature policy='{{ policy }}' name='{{ feature }}'/>
+{% endfor %}
+ </cpu>
+{% else %}
+ <cpu mode='host-passthrough' migratable='off'/>
+{% endif %}
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
{% if vm_create_installer %}