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"
分享、在看与点赞
只要你点,我们就是胖友
来自: Nested KVM Hypervisor Supporthttps://mp.weixin.qq.com/s?__biz=Mzk0NTQ3OTk3MQ==&mid=2247487423&idx=1&sn=5fd512154aebf450112be6f62f18195d&chksm=c31587f3f4620ee5341ef3e16e9f43cfa0d6d85e10fc6f61c253c595acbedc8a4a2696d95fb0&token=355315523&lang=zh_CN#rd