Configure nested KVM. It's possible to install KVM and create virtual machines as nested KVM on KVM host.
(1)Enable the setting for Nested KVM.
[root@dlp ~]#
vi /etc/modprobe.d/kvm-nested.conf
# create new
options kvm_intel nested=1
modprobe -r kvm_intel
# unload
[root@dlp ~]#
modprobe kvm_intel
# reload again
[root@dlp ~]#
cat /sys/module/kvm_intel/parameters/nested
Y
# just enabled
|
[root@dlp ~]#
virsh edit centos7
# edit a virtual machine "centos7"
# change like folows for "cpu mode" section
<cpu mode='
host-passthrough
'> |
# show the current setting ( if the result is "Y", it's OK )
root@dlp:~#
cat /sys/module/kvm_intel/parameters/nested
Y
# if the result is "N", change like follows and reboot the system )
[root@dlp ~]#
echo 'options kvm_intel nested=1' >> /etc/modprobe.d/qemu-system-x86.conf
|
[root@dlp ~]#
virsh capabilities | egrep "/model|/vendor"
<model>Westmere</model>
# CPU model
<vendor>Intel</vendor>
# CPU vendor
<model>apparmor</model> <model>dac</model> |
[root@dlp ~]#
virsh edit www
# edit a virtual machine "www"
# add following lines
<cpu mode='custom' match='exact'>
# CPU model
<model fallback='allow'>Westmere</model>
# CPU vendor
<vendor>Intel</vendor> <feature policy='require' name='vmx'/> </cpu> |
Most hypervisors require hardware-assisted virtualization (HV). VMware products require hardware-assisted virtualization for 64-bit guests on Intel hardware. When running as a guest hypervisor, VMware products also require hardware-assisted virtualization for 64-bit guests on AMD hardware. The hardware-assisted virtualization features of the physical CPU are not typically available in a VM, because most hypervisors (from VMware or others) do not virtualize HV. However, Workstation 8, Player 4, Fusion 4, and ESXi 5.0 (or later) offer virtualized HV, so that you can run guest hypervisors which require hardware-assisted virtualization.
With virtualized HV enabled for the outer guest, you should be able to run any guest hypervisor that requires hardware-assisted virtualization. In particular, this means that you will be able to run 64-bit nested guests under VMware guest hypervisors.
Virtualized HV is fully supported for virtual hardware version 9 or later VMs on hosts that support Intel VT-x and EPT or AMD-V and RVI. To enable virtualized HV, use the web client and navigate to the processor settings screen. Check the box next to "Expose hardware-assisted virtualization to the guest operating system." This setting is not available under the traditional C# client.
Virtualized HV is fully supported for virtual hardware version 9 or later VMs on hosts that support Intel VT-x and EPT or AMD-V and RVI. To enable virtualized HV, select VM->Settings and navigate to the processor settings screen. Check the box next to "Virtualize Intel VT-x/EPT or AMD-V/RVI."
Virtualized HV is fully supported for virtual hardware version 9 or 10 VMs on hosts that support Intel VT-x and EPT or AMD-V and RVI. To enable virtualized HV, select VM->Settings and navigate to the processor settings screen. Check the box next to "Virtualize Intel VT-x/EPT or AMD-V/RVI."
Virtualized HV is fully supported for virtual hardware version 9 or 10 VMs on hosts that support Intel VT-x and EPT or AMD-V and RVI. To enable virtualized HV, use the web client and navigate to the processor settings screen. Check the box next to "Expose hardware-assisted virtualization to the guest operating system." This setting is not available under the traditional C# client.
Virtualized HV is fully supported for virtual hardware version 9 VMs on hosts that support Intel VT-x and EPT or AMD-V and RVI. To enable virtualized HV, select VM->Settings and navigate to the processor settings screen. Check the box next to "Virtualize Intel VT-x/EPT or AMD-V/RVI."
Virtualized HV is fully supported for virtual hardware version 9 VMs on hosts that support Intel VT-x and EPT or AMD-V and RVI. To enable virtualized HV, use the web client and navigate to the processor settings screen. Check the box next to "Expose hardware-assisted virtualization to the guest operating system." This setting is not available under the traditional C# client.
Virtualized HV is available for virtual hardware version 8 VMs on hosts that support Intel VT-x and EPT or AMD-V and RVI. To enable virtualized HV, select VM->Settings and navigate to the processor settings screen. Check the box next to "Virtualize Intel VT-x/EPT or AMD-V/RVI." You will see a warning that virtualized HV will make this VM incompatible with other VMware products. In particular, if this VM is moved to an ESXi 5.0 host, virtualized HV will not be available without additional tweaking.
Virtualized HV is available for virtual hardware version 8 VMs on hosts that support Intel VT-x and EPT or AMD-V and RVI, but it cannot be selected through the user interface. To enable virtualized HV, edit the outer guest's configuration file by hand and add the following line:
vhv.enable = TRUE
On ESXi 5.0, virtualized HV is prohibited by default. This feature is used internally within VMware for testing purposes, but it is not recommended for production systems. It is available on hosts that support Intel VT-x or AMD-V, but it is not recommended for systems without second level address translation (EPT or RVI), because of its poor performance without SLAT. Unfortunately, this feature does not work on AMD "Bulldozer" CPUs running ESXi 5.0.
To allow the use of this feature, the ESXi administrator must add the following configuration option to the /etc/vmware/config file on the physical host:
vhv.allow = TRUE
Once allowed by the ESXi administrator, virtualized HV will be enabled by default for all hardware version 8 VMs with guest OS type "ESX Server 4" and "ESX Server 5." To enable virtualized HV for other guests, add the following lines to the outer guest's configuration file:
cpuid.1.ecx="----:----:----:----:----:----:--h-:----"
cpuid.80000001.ecx.amd="----:----:----:----:----:----:----:-h--"
cpuid.8000000a.eax.amd="hhhh:hhhh:hhhh:hhhh:hhhh:hhhh:hhhh:hhhh"
cpuid.8000000a.ebx.amd="hhhh:hhhh:hhhh:hhhh:hhhh:hhhh:hhhh:hhhh"
cpuid.8000000a.edx.amd="hhhh:hhhh:hhhh:hhhh:hhhh:hhhh:hhhh:hhhh"