12.2. Setup
Follow these steps to enable, configure, and start using nested virtualization:
- Enable: The feature is disabled by default. To enable it, use the following procedure on the L0 host physical machine.For Intel:
- Check whether nested virtualization is available on your host system.
cat /sys/module/kvm_intel/parameters/nested
$ cat /sys/module/kvm_intel/parameters/nested
Copy to Clipboard Copied! If this command returnsY
or1
, the feature is enabled.If the command returns0
orN
, use steps ii and iii. - Unload the
kvm_intel
module:modprobe -r kvm_intel
# modprobe -r kvm_intel
Copy to Clipboard Copied! - Activate the nesting feature:
modprobe kvm_intel nested=1
# modprobe kvm_intel nested=1
Copy to Clipboard Copied! - The nesting feature is now enabled only until the next reboot of the L0 host. To enable it permanently, add the following line to the
/etc/modprobe.d/kvm.conf
file:options kvm_intel nested=1
options kvm_intel nested=1
Copy to Clipboard Copied!
For AMD:- Check whether nested virtualization is available on your system:
cat /sys/module/kvm_amd/parameters/nested
$ cat /sys/module/kvm_amd/parameters/nested
Copy to Clipboard Copied! If this command returnsY
or1
, the feature is enabled.If the command returns0
orN
, use steps ii and iii. - Unload the
kvm_amd
modulemodprobe -r kvm_amd
# modprobe -r kvm_amd
Copy to Clipboard Copied! - Activate the nesting feature
modprobe kvm_amd nested=1
# modprobe kvm_amd nested=1
Copy to Clipboard Copied! - The nesting feature is now enabled only until the next reboot of the L0 host. To enable it permanently, add the following line to the
/etc/modprobe.d/kvm.conf
file:options kvm_amd nested=1
options kvm_amd nested=1
Copy to Clipboard Copied!
- Configure your L1 virtual machine for nested virtualization using one of the following methods:
- virt-manager
- Open the GUI of the intended guest and click the Show Virtual Hardware Details icon.
- Select the Processor menu, and in the Configuration section, type
host-passthrough
in the Model field (do not use the drop-down selection), and click Apply.
- Domain XML
- Add the following line to the domain XML file of the guest:
<cpu mode='host-passthrough'/>
<cpu mode='host-passthrough'/>
Copy to Clipboard Copied! If the guest's XML configuration file already contains a<cpu>
element, rewrite it.
- To start using nested virtualization, install an L2 guest within the L1 guest. To do this, follow the same procedure as when installing the L1 guest - see Chapter 3, Creating a Virtual Machine for more information.