常规情况下,如果在kvm的虚拟机里,又想使用kvm的虚拟机,会报如下的错误信息:
[root@host0 nlb]# Could not access KVM kernel module: No such file or directory
qemu-system-x86_64: failed to initialize KVM: No such file or directory
这个时候,我们可以类似下面的操作这样处理:
https://docs.fedoraproject.org/en-US/quick-docs/using-nested-virtualization-in-kvm/
1. 在最外层的物理设备删,关掉所有的kvm虚拟机
tong@T17 ~/V/host0> ps -ef |grep qemu
tong : pts/ :: grep --color=auto qemu
tong@T17 ~/V/host0>
2. 修改内核模块 kvm_intel的参数
tong@T17 ~/V/host0> cat /sys/module/kvm_intel/parameters/nested
N
tong@T17 ~/V/host0> sudo modprobe -r kvm_intel
[sudo] password for tong:
tong@T17 ~/V/host0> sudo modprobe kvm_intel nested=
tong@T17 ~/V/host0> cat /sys/module/kvm_intel/parameters/nested
Y
3. 持久化这个参数
在文件
tong@T17 ~/V/host0> rpm -qf /etc/modprobe.d/kvm.conf
qemu-common-2.11.-.fc28.x86_64
tong@T17 ~/V/host0>
中,打开如下行:
options kvm_intel nested=
好了,哇咔咔!
[root@host0 VM]# lsmod |grep kvm
kvm_intel
kvm kvm_intel
irqbypass kvm