2017-05-12 127 views
5

在我已經虛擬化主機,試圖通過該選項的選項-enable-kvm -m 1024,將失敗:嵌套虛擬化KVM:-enable-KVM在嵌套虛擬化QEMU

qemu-system-x86_64 -vga std -enable-kvm -m 1024 -monitor telnet:localhost:9313,server,nowait -drive file=my_img.img,cache=none 
# Could not access KVM kernel module: No such file or directory 
# failed to initialize KVM: No such file or directory 

如果刪除該選項-enable-kvm -m 1024,QEMU將加載(但需要永遠的,因爲它是用軟件模擬):

qemu-system-x86_64 -vga std -monitor telnet:localhost:9313,server,nowait -drive file=my_img.img,cache=none 
# qemu running, OK, but image taking forever to load. 

當然,我的這個虛擬主機有築巢自己的虛擬化能力。我到處都找不到有關它的信息[喜歡這裏:https://docs.openstack.org/developer/devstack/guides/devstack-with-nested-kvm.html]告訴我,我必須檢查的文件/sys/module/kvm_intel/parameters/nested這簡直是不可用的,因爲kvm-intel是不是,不能從圖像中加載:

sudo modprobe kvm-intel 
# modprobe: ERROR: could not insert 'kvm_intel': Operation not supported 

調試嵌套虛擬化的方法可能只適用於裸機。 那麼,如何從kvm內啓用(轉發支持)kvm?

附加信息:

lscpu # from inside the virtualized host 
# Architecture:   x86_64 
# ... 
# Vendor ID:    GenuineIntel 
# CPU family:   6 
# Model:     13 
# Model name:   QEMU Virtual CPU version (cpu64-rhel6) 
# Stepping:    3 
# ... 
# Hypervisor vendor:  KVM 

QEMU的ltrace

# open64("/dev/kvm", 524290, 00)     = -1 
# __errno_location()        = 0x7f958673c730 
# __fprintf_chk(0x7f957fd81060, 1, 0x7f9586474ce0, 0Could not access KVM kernel module: No such file or directory 

回答

4

要測試kvm支持在當前的主機(即,它工作在虛擬機)做啓用:

grep -E "(vmx|svm)" /proc/cpuinfo 
flags  : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc extd_apicid aperfmperf pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 popcnt aes xsave avx f16c lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs xop skinit wdt lwp fma4 tce tbm topoext perfctr_core perfctr_nb arat cpb hw_pstate npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold vmmcall bmi1 

在問題中:

grep -E "(vmx|svm)" /proc/cpuinfo | wc -l 
0 

這意味着支持被禁用,並且enable-kvm將不起作用。在裸機上的行動是必需的。