Skip to content

Commit 750252d

Browse files
author
jovial
authored
Merge pull request #13 from stackhpc/fix/arch-emulator
Default to software emulation if target architecture != host_architecture
2 parents 435ea81 + 6140738 commit 750252d

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

tasks/autodetect.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,18 @@
1414

1515
- name: Set a fact containing the virtualisation engine
1616
set_fact:
17-
libvirt_vm_engine: "{% if stat_kvm.stat.exists %}kvm{% else %}qemu{% endif %}"
17+
libvirt_vm_engine: >-
18+
{%- if ansible_architecture != libvirt_vm_arch -%}
19+
{# Virtualisation instructions are generally available only for the host
20+
architecture. Ideally we would test for virtualisation instructions, eg. vt-d
21+
as it is possible that another architecture could support these even
22+
if the emulated cpu architecture is not the same. #}
23+
qemu
24+
{%- elif stat_kvm.stat.exists -%}
25+
kvm
26+
{%- else -%}
27+
qemu
28+
{%- endif -%}
1829
when: libvirt_vm_engine is none
1930

2031
- name: Detect the virtualisation emulator

0 commit comments

Comments
 (0)