Path=/var/lib/libvirt/images/nestedvm.img,bus=virtio,size=10 -graphics \ os-type=Linux -os-variant=rhel7 -ram=2048 -vcpus=2 -disk \ Let’s try creating a virtual machine either from virtual manager GUI or virt-install inside the director vm, in my case i am using virt-install command ~]# virt-install -n Nested-VM -description "Test Nested VM" \ Now login to the director VM and run lscpu and lsmod command ~]# ssh 192.168.126.1 -l root # virsh edit directorįor the new VMs for which you want to use nested virtualization, check the “C opy host CPU configuration” option under the CPU settings from virt-manager. Before testing, make sure CPU mode for the VM is either as “ host-model” or “ host-passthrough”, to check cpu mode of a virtual machine use either Virt-Manager GUI or virsh edit command. Let’s suppose we have a VM with name “director” on KVM hypervisor on which I have enabled nested virtualization. ~]# modprobe kvm-amd Test KVM Nested Virtualization ~]# echo 'options kvm-amd nested=1'>/etc/modprobe.d/nf Now verify whether nested virtualization feature enabled or not, run ~]# cat /sys/module/kvm_intel/parameters/nestedįor AMD based systems, run the below commands, ~]# rmmod kvm-amd Before removing the module, make sure VMs are shutdown otherwise we will get following error message “modprobe: FATAL: Module kvm_intel is in use” ~]# modprobe -r kvm_intel Now remove ‘ kvm_intel‘ module and then add the same module with modprobe command. Now to enable nested virtualization, create a file with the name “ /etc/modprobe.d/nf” with the following content.
If we get the output as ‘Y’ then it indicates that nested virtualization is enabled on your host. In the output above ‘N’ indicates that Nested virtualization is disabled. Verify whether nested virtualization is enabled or not on your KVM hostįor Intel based Processors run the following cat command, ~]# cat /sys/module/kvm_intel/parameters/nestedįor AMD based Processors run the command, ~]# cat /sys/module/kvm_amd/parameters/nested
Without further ado, let’s jump into actual steps.