Nested virtualization¶
Part of the KVM overview. Run a hypervisor inside a KVM guest.
Run a hypervisor inside a VM.
grep -E 'vmx|svm' /proc/cpuinfo | head -1 # CPU flag present?
cat /sys/module/kvm_intel/parameters/nested # Intel: Y or 1 means enabled
cat /sys/module/kvm_amd/parameters/nested # AMD
Enable it if needed (with no VMs running):
echo 'options kvm_intel nested=1' | sudo tee /etc/modprobe.d/kvm-nested.conf # kvm_amd on AMD
sudo modprobe -r kvm_intel && sudo modprobe kvm_intel
The inner hypervisor's VM must use CPU passthrough: virt-install --cpu host-passthrough ... or <cpu mode='host-passthrough'/> in the XML.