diff --git a/defaults/main.yml b/defaults/main.yml index 6742c52f..d813531c 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -269,6 +269,7 @@ nova_metadata_port: 8775 ## Nova compute nova_enable_instance_password: True nova_force_config_drive: False +nova_nested_virt_enabled: False ## Nova placement nova_placement_service_enabled: True diff --git a/files/kvm.conf b/files/kvm.conf new file mode 100644 index 00000000..ea347d00 --- /dev/null +++ b/files/kvm.conf @@ -0,0 +1,2 @@ +options kvm_intel nested=1 enable_apicv=0 +options kvm_amd nested=1 diff --git a/releasenotes/notes/add-nested-virt-1db2270e73d1b34.yaml b/releasenotes/notes/add-nested-virt-1db2270e73d1b34.yaml new file mode 100644 index 00000000..c0c6234f --- /dev/null +++ b/releasenotes/notes/add-nested-virt-1db2270e73d1b34.yaml @@ -0,0 +1,7 @@ +--- +features: + - This role now optionally enables your compute nodes' KVM kernel + module nested virtualization capabilities, by setting nova_nested_virt_enabled + to true. Depending on your distribution and libvirt version, you might need to + set additional variables to fully enabled nested virtualization. + For details, please see https://docs.openstack.org/nova/latest/admin/configuration/hypervisor-kvm.html#nested-guest-support. diff --git a/tasks/drivers/kvm/nova_compute_kvm.yml b/tasks/drivers/kvm/nova_compute_kvm.yml index c8992637..b4823ccc 100644 --- a/tasks/drivers/kvm/nova_compute_kvm.yml +++ b/tasks/drivers/kvm/nova_compute_kvm.yml @@ -17,6 +17,19 @@ tags: - nova-install +- name: Set nested kvm virt + copy: + src: kvm.conf + dest: /etc/modprobe.d/kvm.conf + owner: root + group: root + mode: 0644 + when: + - nova_nested_virt_enabled | bool + tags: + - nova-config + - nova-kvm + - name: Add nova user to libvirtd group user: name: "{{ nova_system_user_name }}"