Skip to content

Commit 23fea0f

Browse files
authored
Merge pull request #82 from stackhpc/aarch64
Add aarch64 libvirt host support
2 parents 1d02e5e + e2da776 commit 23fea0f

5 files changed

Lines changed: 31 additions & 7 deletions

File tree

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ Technology (VT) is enabled in order to run this role. While this provides
6262
better VM performance, it may not be available in certain environments. The
6363
default value is `true`.
6464

65+
`libvirt_host_arch`: Architecture of the libvirt host. This defaults to
66+
`ansible_facts.architecture`.
67+
6568
`libvirt_host_qemu_emulators`: List of architectures for which to install QEMU
6669
system emulators, e.g. `x86`. The default value is `['x86']` if
6770

defaults/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ libvirt_host_networks: []
2525
# be available in certain environments.
2626
libvirt_host_require_vt: true
2727

28+
# Architecture of the libvirt host.
29+
libvirt_host_arch: "{{ ansible_facts.architecture }}"
30+
2831
# List of architectures for which to install QEMU system emulators, e.g. x86.
2932
libvirt_host_qemu_emulators: "{{ [] if libvirt_host_require_vt | bool else ['x86'] }}"
3033

tasks/validate.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,26 @@
11
---
2-
- name: Verify that Virtualization Technology (VT) is enabled
2+
- name: Verify that Virtualization Technology (VT) is enabled on x86_64
33
command: grep -c -E 'svm|vmx' /proc/cpuinfo
44
check_mode: False
55
changed_when: False
66
failed_when: False
7-
register: result
7+
register: x86_vt_result
8+
when: libvirt_host_arch == 'x86_64'
9+
10+
- name: Verify that KVM is available on non-x86_64
11+
stat:
12+
path: /dev/kvm
13+
register: kvm_device
14+
when: libvirt_host_arch != 'x86_64'
815

916
- name: Set a fact about whether Virtualization Technology (VT) is enabled
1017
set_fact:
11-
libvirt_host_vt_enabled: "{{ result.rc == 0 }}"
18+
libvirt_host_vt_enabled: >-
19+
{{
20+
(x86_vt_result.rc == 0)
21+
if libvirt_host_arch == 'x86_64'
22+
else kvm_device.stat.exists
23+
}}
1224
1325
- name: Notify if Virtualization Technology (VT) is disabled
1426
debug:

vars/Debian.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
# List of package dependencies common to all Debian distributions
33
libvirt_host_libvirt_packages_common:
4-
- qemu-system-x86
4+
- "{{ 'qemu-system-arm' if libvirt_host_arch == 'aarch64' else 'qemu-system-x86' }}"
55

66
# List of all daemon packages to install.
77
libvirt_host_libvirt_packages_libvirt_daemon:
@@ -28,7 +28,7 @@ libvirt_host_libvirt_packages_client_default:
2828

2929
# Packages that are only necessary if you require EFI support
3030
libvirt_host_packages_efi:
31-
- ovmf
31+
- "{{ 'qemu-efi-aarch64' if libvirt_host_arch == 'aarch64' else 'ovmf' }}"
3232

3333
# Packages for RBD volume pool support
3434
libvirt_host_packages_rbd_volume_pool:

vars/RedHat.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,11 @@ libvirt_host_packages_efi_by_version:
2828
10:
2929
- edk2-ovmf
3030

31+
libvirt_host_packages_efi_aarch64: >-
32+
{{ [] if ansible_facts.distribution_major_version | int == 7 else ['edk2-aarch64'] }}
33+
3134
libvirt_host_packages_efi: >-
32-
{{ libvirt_host_packages_efi_by_version[ansible_facts.distribution_major_version | int] }}
35+
{{ libvirt_host_packages_efi_aarch64 if libvirt_host_arch == 'aarch64' else libvirt_host_packages_efi_by_version[ansible_facts.distribution_major_version | int] }}
3336
3437
# Packages for RBD volume pool support
3538
libvirt_host_packages_rbd_volume_pool:
@@ -61,7 +64,10 @@ libvirt_host_custom_yum_repos_efi_by_version:
6164
10: []
6265

6366
libvirt_host_custom_yum_repos: >-
64-
{{ libvirt_host_custom_yum_repos_efi_by_version[ansible_facts.distribution_major_version | int] }}
67+
{{
68+
[] if libvirt_host_arch == 'aarch64'
69+
else libvirt_host_custom_yum_repos_efi_by_version[ansible_facts.distribution_major_version | int]
70+
}}
6571
6672
# These are passed to the lineinfile module to customize configuration files
6773
libvirt_host_lineinfile_extra_rules:

0 commit comments

Comments
 (0)