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
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
- Activate the nesting feature:
#
modprobe kvm_intel nested=1
- 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
For AMD:- Check whether nested virtualization is available on your system:
$
cat /sys/module/kvm_amd/parameters/nested
If this command returnsY
or1
, the feature is enabled.If the command returns0
orN
, use steps ii and iii. - Unload the
kvm_amd
module#
modprobe -r kvm_amd
- Activate the nesting feature
#
modprobe kvm_amd nested=1
- 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
- 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'/>
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.