暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

Nested KVM Hypervisor Support

Linux技术宅 2024-04-09
157

点击蓝字,关注我

Every Day

宿新市徐公店

[作者] 杨万里 [朝代] 宋

篱落疏疏一径深,树头新绿未成阴。

儿童急走追黄蝶,飞入菜花无处寻。

Description

    Nested KVM是指基于虚拟化技术的虚拟机管理系统。


    Nested KVM在Intel处理器上,KVM使用Intel的vmx(virtualmachine eXtensions)来提高虚拟机性能,即硬件辅助虚拟化技术。如果一台虚拟机能够和物理机一样支持vmx,那么就可以在这台虚拟机上再次安装虚拟机。Nested KVM是一个可通过内核参数来启用的功能,它能够使一台虚拟机具有物理CPU特性,支持vmx或者svm(AMD)硬件虚拟化。

See

  • hypervisor-kvm

  • How to Enable Nested KVM Virtualization

  • Nested KVM Hypervisor Support

Official


Checking Whether Nested Virtualization is Enabled

  • Support nested:Kernel version at least 3.X

    modinfo kvm_intel | grep nested
    parm: nested:bool
    systool -m kvm_intel -v | grep -i nested
    nested = "N"
    # or
    cat /sys/module/kvm_intel/parameters/nested
    Y (Y for yes) or N (N for no)

    Enabling Nested Virtualization

    • Tested

      # cat etc/modprobe.d/kvm.conf
      # To enable nesting, simply add or change the nested parameter so it has 1 as its value
      # For Intel
      options kvm_intel nested=1
      # For AMD
      # options kvm_amd nested=1




      # Unload and reload kvm-intel kernel module with nested support.
      # Unload the module
      $ sudo modprobe -r kvm_intel


      # Reload the module with new settings
      $ sudo modprobe kvm_intel




      # command setting
      modprobe kvm-intel nested=1


      • Not Test

        # Modify grub.cfg
        # Add kvm-intel.nested=1 to the end of the row of quiet in the kernel parameter
        # grep quiet boot/grub2/grub.cfg
        linux16 vmlinuz-3.10.0-862.el7.x86_64 root=UUID=8c936eea-af89-48bd-83cb-b5d9cdb440e8 ro crashkernel=auto rhgb quiet kvm-intel.nested=1 LANG=zh_CN.UTF-8

        Activating Nested Virtualization For a Guest

        • Tested

          # virsh edit virtualhost-name
          # Define the CPU mode :"core2duo", And add the "vmx" feature to the virtual machine
          <cpu mode='custom' match='exact'>
          <model fallback='allow'>core2duo</model>
          <feature policy='require' name='vmx'/>
          </cpu>
          • Not Test

              <cpu mode='host-model'>
            <model fallback='allow'/>
            </cpu>
            # or
            # host-passthrough:
            # Advantages: The vcpu of the virtual machine is the same as that of the physical machine
            # Disadvantages: The cpus of the two servers must be the same during VM migration; otherwise, the migration fails.
            <cpu mode='host-passthrough'>
            <topology sockets='2' cores='2' threads='2'/>
            </cpu>
            <cpu>
            <topology sockets='8' cores='1' threads='1'/>
            </cpu>


            # command start virtualhost, Add Option.
            -enable-kvm -cpu qemu64,+vmx

            Checking a Guest Can Nested

              # start virtualhost
              lscpu | grep -P "vmx"






              分享、在看与点赞

              只要你点,我们就是胖友

              文章转载自Linux技术宅,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

              评论