常规情况下,如果在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 15401 14747 0 19:23 pts/1 00:00:00 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=1 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.1-2.fc28.x86_64 tong@T17 ~/V/host0>
中,打开如下行:
options kvm_intel nested=1
好了,哇咔咔!
[root@host0 VM]# lsmod |grep kvm kvm_intel 183720 0 kvm 578558 1 kvm_intel irqbypass 13503 1 kvm