CentOS7 minimal kvm 支持嵌套虚拟化 (用于虚拟机中创建虚拟机)

  • 开启 nested(主机)
  1. 开启 nested
    echo 'options kvm_intel nested=1' >/etc/modprobe.d/kvm-nested.conf
  2. 重启
    reboot
  3. 查看
    cat /sys/module/kvm_intel/parameters/nested
    image.png
  • 配置虚拟机(基于 libvirt
  1. 配置(不使用)
    virsh edit centos7_1
    注:skylake-client特性集成到spec-ctrl特性中
 <cpu mode='custom' match='exact'>
   <model fallback='allow'>core2duo</model>
   <feature policy='require' name='vmx'/>
   <feature policy='require' name='spec-ctrl'/>
 </cpu>
#这种方式为虚拟机定义需要模拟的CPU类型"core2duo",并且为虚拟机添加"vmx"特性

#也可以使用这种
 <cpu mode='host-model'>
   <model fallback='allow'/>
 </cpu>

#或者这样
<cpu mode='host-passthrough'>
   <topology sockets='2' cores='2' threads='2'/>
 </cpu>
#CPU穿透,在虚拟机中看到的vcpu将会与物理机的CPU同样配置,这种方式缺点在于如果要对虚拟机迁移,迁移的目的服务器硬件配置必须与当前物理机一样
  1. 配置(这种情况在centos7下可以成功)
    virsh edit centos7_1
 <cpu mode='custom' match='exact' check='partial'>
   <model fallback='allow'>Skylake-Client</model>
   <feature policy='require' name='vmx'/>
 </cpu>
  1. 通过 virt-manage配置cpu特性
    image.png
  2. 重启虚拟机
    virsh destroy centos7_1
    virsh start centos7_1
  • 查看vmx(虚拟机)
  1. 查看 vmx
    cat /proc/cpuinfo |grep vmx
    image.png
  • 配置(基于openstack)

引用:https://www.linuxidc.com/Linux/2015-05/117026.htm
kvm-intel 临时开启嵌套虚拟化,没用
https://www.linuxidc.com/Linux/2015-05/117026.htm

关于skylake-client
https://mpolednik.github.io/2017/07/31/cpuflags-ovirt-hook-cpu-features/
https://fossies.org/linux/libvirt/ChangeLog

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容