Notes nested virtualization

prereq

Source : https://gist.github.com/plembo/782e1511e463221b5772e85b6f2f72d4#file-nestedvirtkvm-md

Make sure that the Intel-VT-x/AMD-V extensions are enabled in the host machine's BIOS. For Intel:

grep vmx /proc/cpuinfo

For AMD:

grep svm /proc/cpuinfo

Check to see if /etc/modprobe.d/qemu-system-x86.conf exists and if it does not have the following line, add it and reboot:

options kvm_intel nested=1

Go into the graphical virt-manager, open the subject guest's config, and click on “CPUs”.

Check the box “Copy host CPU configuration” and Apply.

Restart the virtual machine, open a terminal in it and check for the extensions:

grep vmx /proc/cpuinfo

Source : https://docs.fedoraproject.org/en-US/quick-docs/using-nested-virtualization-in-kvm/

Checking if nested virtualization is supported

cat /sys/module/kvm_intel/parameters/nested
Y

To enable nested virtualization for Intel processors:

Shut down all running VMs and unload the kvm_probe module:

sudo modprobe -r kvm_intel

Activate the nesting feature:

sudo modprobe kvm_intel nested=1

Nested virtualization is enabled until the host is rebooted. To enable it permanently, add the following line to the /etc/modprobe.d/kvm.conf file:

options kvm_intel nested=1

To enable nested virtualization for AMD processors:

Shut down all running VMs and unload the kvm_amd module:

sudo modprobe -r kvm_amd

Activate the nesting feature:

sudo modprobe kvm_amd nested=1

Nested virtualization is enabled until the host is rebooted. To enable it permanently, add the following line to the /etc/modprobe.d/kvm.conf file:

options kvm_amd nested=1

Testing nested virtualization

virt-host-validate