How to Run Hyper-V in vSphere 5.1
Today, Server 2012 Hyper-V cannot be virtualized inside a Microsoft virtualization product. In other words, you can’t run Hyper-V as virtual machine inside Hyper-V on Windows 2012, or as a virtual machine inside Client Hyper-V in Windows 8.
You can, however, virtualize Hyper-V as a virtual machine inside VMware products like Fusion, Workstation, Free ESXi, or the commercial vSphere / vCloud Suite — just a few tweaks are required.
Typically, the first time that admins have trouble running Hyper-V in one of these virtualization platforms is after they have created the VM and installed Windows. They try to go ahead and add the Hyper-V role and they get the message:
Hyper-V cannot be installed
The processor on this computer is not compatible with Hyper-V. To install this role, the processor must have a supported version of hardware-assisted virtualization, and that feature must be turned on in the BIOS.
If you are running Hyper-V on a physical server (with no virtualization hypervisor in between) then either your CPU really is not compatible or you need to enable Intel-VT or AMD-V in your server’s BIOS.
However, if you are trying to run Hyper-V in a virtual machine (and your physical server has Intel-VT / AMD-V enabled) and you are getting this message in a VMware product then you need to make the tweaks below.
If you are using vSphere 5 or greater then you need to modify the vmware config file on the ESXi host that will run the Hyper-V virtual machine. To edit this file, ssh to the server and vi /etc/config/vmware. Add the line vhv.allow = “TRUE” to the file and save it with “wq”.
Next, power off the Hyper-V VM and remove it from inventory. Browse the datastore that the VM is stored on and download the VMX configuration file to your local computer. Use Wordpad, or a similar text editor, to edit the VMX configuration file that you downloaded.
Change the guestos line to read:
guestOS = “winhyperv”
Save the file and upload it back to the datastore using the datastore browser.
Right-click on the virtual machine’s VMX configuration and use “Add to Inventory” to add the VM back to the ESXi host that it was on (where you added the vhv.allow line).
Finally, upgrade the virtual machine hardware to hardware version 9 by right-clicking on the VM and clicking Upgrade Virtual Hardware.
Now, power on the virtual machine and you shouldn’t have any trouble adding the Hyper-V role, as you see below.
With this configuration, you’ll also be able to run 64-bit nested virtual machines inside this virtualized Hyper-V host. In the example below, you can see Windows Server 2012 running inside Windows 2008 R2 as a Hyper-V VM, which is running inside vSphere 5.1 as a virtual machine (that’s a VM in a VM, all running inside vSphere).
Note that you don’t have to do all this work to run Hyper-V virtual machines in Workstation or Fusion – it’s much easier (stay tuned for a future article on that from me, here on TST blogs).
For another great post on running Hyper-V in vSphere, see this post from Tinkertry.com