Enabling nested virtualization

Nested virtualization allows you to run virtual machines in Virtuozzo Hybrid Infrastructure clusters that are deployed inside Virtuozzo Hybrid Infrastructure virtual machines. To support nested virtualization, the virtualization engine adds Intel VT-x or AMD-V instructions to VMs, so that a virtual machine can use the hypervisor to run nested VMs.

Limitations

  • Virtuozzo Hybrid Infrastructure supports nested virtualization for evaluation purposes only. Do not use nested virtualization for production workloads.

To enable nested virtualization

  1. Log in to your compute node via SSH.
  2. Create the /etc/modprobe.d/dist.conf file as follows:

    • [For Intel-based systems] Add the line options kvm_intel nested=y:

      # cat > /etc/modprobe.d/dist.conf <<\EOT
      options kvm_intel nested=y
      EOT
    • [For AMD-based systems] Add the line options kvm_amd nested=y:

      # cat > /etc/modprobe.d/dist.conf <<\EOT
      options kvm_amd nested=y
      EOT
  3. [For AMD-based systems only] Add the svm flag to your CPU model. For example:

    # vinfra service compute set --cpu-model EPYC-IBPB --cpu-features svm
  4. Reboot the node:

    # reboot
  5. Repeat the steps on all other compute nodes.

All virtual machines created after the configuration will support nested virtualization.

You can check if nested virtualization is enabled as follows:

  • For a node:

    • [For Intel-based systems] Run this command on the node:

      # cat /sys/module/kvm_intel/parameters/nested
      Y
    • [For AMD-based systems] Run this command on the node:

      # cat /sys/module/kvm_amd/parameters/nested
      Y
  • For a virtual machine, run this command inside the VM:

    The virtual machine should be created after enabling nested virtualization.

    # cat /proc/cpuinfo | grep vmx