If you read my blog, you’ve probably noticed I’ve been doing a lot of stuff with hypervisors lately, more specifically setting up OpenStack. I’ve always been a VMware guy. I like the simplicity of ESXi and the intuitiveness of of the interface. Since OpenStack really works best with at least 3 servers, 2 of which don’t do much of anything, I decided to use an ESXi server to install the openstack infrastructure. The controller node and network node do not provide any type of virtualization capabilities, but the compute node(s) do.
ESXi, at least since version 5.1, has supported running 64-bit hypervisor guests, or “nested” hypervisors on any Intel i3 or newer CPU. Specfically, your CPU needs to be one of the following:
- Intel VT-x or AMD-V for 32-bit nested virtualization
- Intel EPT or AMD RVI for 64-bit nested virtualizaiton
In my case, my Xeon W5580 has VT-x and EPT support, so I can run 64-bit nested virtual machines.
This will allow you to run any nested hypervisor within an ESXi 5.1 or newer host. I’ve ran Xen, KVM, OpenStack, Proxmox, and ESXi; they all worked great.
How To Enable
The feature, or setting, of the virtual machine that allows the VT-x functionality to be passed through to the guest virtual machine is called HV (as in hypervisor). The problem is you have to be running the new vSphere Web Client to get at the nice little check box to turn this on. The vSphere Desktop Client does not have this functionality and unless you have a license for vSphere server, there is no way to enable HV on a virtual machine using the GUI. However, there is a VERY easy work around for this. You simply add a single line to the .vmx file for the virtual machine you need HV enabled on.
To do this, fire up the vSphere Client, and make sure the host is selected in the left pane. Also, verify the VM is powered OFF.
Next, select the Configuration Tab in the right pane.
Now, select Storage then right click on the Datastore where your VM resides on and select Browse.
Find the folder for your VM, which should be the same as the name of the VM, and within the folder, look for the single file with the .vmx extension. Select it and click the down arrow to download that file. It will be very small. Once you have the file downloaded, open it in Wordpad, Notepad, TextEdit, or any other text editor.
At the very bottom, add the following line:
vhv.enable = "TRUE"
Save and Exit. Now you just click the Up arrow in the datastore browser to upload the file back to the same directory, overwriting the old .vmx file. Go ahead and power on your VM and that’s it. You have now enabled nested hypervisors on VMware ESXi 5 or 6, without the vSphere Web Client.
One more thing, you can nest hypervisors 3 layers deep. So, you can run a hypervisor within a hypervisor with a hypervisor. Have fun!