Wednesday, July 25, 2012

Nested Virtualization

One of my main goals of migrating from ESXi 3.5 to ESXi 5 was to be able to run 64-bit operating systems in virtual machines,  one of them being Windows Server 2008 R2, which would give me the ability to run Hyper-V.  Little did I know that there is an issue that somewhat prevents this.

As most know, Hyper-V is Microsoft's virtualization platform, the successor to Virtual Server.  It is not as robust as VMware even though Microsoft is gaining ground with the new version to be released with Windows Server 2012.  My main goal is to learn at least the basics of Hyper-V.

When I set out to install the Hyper-V role in my Windows Server 2008 R2 VM, I figured I'd be able to add the role and be done with it.  However, when I tried I was greeted with an error message stating that virtualization was not supported by the CPU.

After checking with HWINFO32 that the virtualization instruction set was detected inside the VM, I did some Googling to see if I could find the root cause of the error.  This is when I learned about nested virtualization.

Nested virtualization is essentially running a VM inside of another VM.  This isn't supported natively by VMware, but it can be done with a few hacks.  Here's what I did:

1) Added vhv.allow = "TRUE", which allows Virtualized Hardware Virtualization, to the /etc/vmware/config file on ESXi 5 host (host reboot is not required):
2) Added the following, which are CPUid bits, to the .vmx (/vmfs/volumes/(name of datastore/(name of VM) file for the VM:
3) Powered on the VM.
4) Nested VM!

The performance isn't the greatest.  But it works.

Thanks to the following sites for instructions:
http://thephuck.com/virtualization/installing-windows-server-8-hyper-v-3-in-esxi-5/
http://www.virtuallyghetto.com/2011/07/how-to-enable-support-for-nested-64bit.html