javascript:void(0)

Tuesday, July 12, 2011

How to Enable Support for Nested 64bit & Hyper-V VMs in vSphere 5

With the release of vSphere 5, one of the most sought out feature from VMware is the ability to run nested 64bit and Hyper-V guest virtual machines in a virtual ESXi instance. Previous to this, only 32bit virtual machines were supported as the VT-x/AMD-V Hardware Virtualization CPU instructions could not be virtualized and presented to the virtual ESX(i) guest. This feature is quite useful for home and lab setups in testing new features or studying for VMware certifications and running multiple vESX(i) instances.

You will still be required to have a 64bit capable system and CPU and you will need to be running ESXi 5.0, this will not work for ESX(i) 4.x or older.
The above diagram depicts the various levels of inception where pESXi is your physical ESXi 5.0 hosts. We then create a vESXi 5.0 host which will contain the necessary Hardware Virtualization CPU instructions to support a 64bit nested guest OS which I've created as another ESXi host called vvESXi.

Note: You will not be able to run a 4th level nested 64bit VM (I have tried by further passing the HV instructions in the nested guest) and it will just boot up and spin your CPUs for hours.

This feature by default is disabled in ESXi 5.0, to enable this virtualized HV (Hardware Virtualization) you will need to add the following string vhv.allow = "TRUE"  to /etc/vmware/config of your Physical ESXi 5.0 host
Once the configuration change has been made, the feature goes into effect right away. A reboot of the system is not necessary. To verify, you should now be able to power on a 64bit guest OS and see that the HV instructions bits are being passed into the guestOS which will then allow you to run a nested 64bit guestOS. You can also verify by looking in the vmware.log file of the virtual machine and grep for the string "monitorControl.vhv" and if you see the following message, then Virtualized HV is not enabled.
In the past to run a virtual ESX(i) instance, a few advanced .vmx configuration entries were needed as documented here. With ESXi 5.0, if you are using virtual hardware version 8, then you do not need to make any additional changes. If you are using hardware version 4 or 7, then you will need to add a few changes to the VM's configuration file.

Creating vESXi 5.0 Instance using Hardware Version 8:
1. To create a virtual ESXi 5.0 instance, start off by just creating a standard RHEL5/6 64bit VM using the vSphere Client

2. Once the VM has been created, edit the settings of the VM and change over to the "Options" and now have the ability to select a new guestOS type: VMware ESXi 5.x or VMware ESXi 4.x under the "Other" section.
Note: I'm not sure why these two additional guestOS type is not available from the default creation menu, but are available after the initial VM shell is created.

3. You are now ready to install ESXi 5.0 in this new vESXi host and then you can create and power on nested 64bit guestOS within that vESXi instance as denoted from the picture below

Creating vESXi 5.0 Instance using Hardware Version 4/7:
1. To create a virtual ESXi 5.0 instance, start off by just creating a standard RHEL5/6 64bit VM using the vSphere Client

2. Now you will need to add the following advanced .vmx parameter:  monitor.virtual_exec = "hardware" which can be done through the vSphere Client and/or editing the .vmx parameter manually.

3. Next you will need to add some cpuid bits, depending if you are running an Intel or AMD CPU, the respective entries are required:

Intel Hosts:
cpuid.1.ecx = "----:----:----:----:----:----:--h-:----"
AMD Hosts:
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"
4. You are now ready to install ESXi 5.0 in this new vESXi host and then you can create and power on nested 64bit guestOS within that vESXi instance

By using a VM that is hardware version 8, you can easily automate the creation of vESXi 5.0 instance by changing the guestOS string in the .vmx parameter to "vmkernel" and the above configurations other than "vhv" string needed for either an Intel or AMD system are automatically configured.

Creating a vHyper-V  Instance on physical ESXi 5.0:
1. To create a virtual Hyper-V instance, start off by creating a Windows 2008 Server R2 64bit VM using the vSphere Client

2. If you are using Hardware Version 7, you will need to follow the instructions in "Creating vESXi 5.0 Instance using Hardware Version 4/7" to add the additional parameters to the VM. If you are using Hardware Version 8, you just need to change the guestOS type to VMware ESXi 5.0

3. You need to add one additional .vmx parameter which tells the underlying guestOS (Hyper-V) that it is not running as a virtual guest which in fact it really is. The parameter is hypervisor.cpuid.v0 = FALSE

4. You are now ready to install Hyper-V in a virtual machine and you can also spin up nested 64bit guestOSes in this virtual Hyper-V instance.
As you can see, now you can even run Hyper-Crap, err I mean Hyper-V as a virtualized guest under ESXi 5.0. I did not get a chance to try out Xen, but I'm sure with the ability to virtualize the Hardware Virtualization instructions, you should be able to run other types of hypervisors for testing purposes.

This is a really awesome feature but note that this is not officially supported by VMware, use at your own risk.

27 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Found a way to add the entry using VI editor.

    ReplyDelete
  3. Hi,

    Do you have a trick to do the same on VMware workstation 7.1 or workstation 8.0 beta ?

    thanks :)

    ReplyDelete
  4. For information, in VMware Workstation 8.0 we have to choose “ESXi 5.0″ in “Guest Operating System” but the CPU must have Intel EPT or AMD RVI… mine does not :( .

    ReplyDelete
  5. I am unable to run 2008 r2 nested. I have 2 vesxi5 running. I have made necessary changes on the physical host for vhv.allow. Created virtual cluster and added 2 vesxi5 host. Was able to create virtual machine and installed 2008 r2. After finishing the install, I restarted the machine. The OS boot but BLACK screen. Why, I am unable to run nested virtual machine on vesxi5 host. No clue. Still searching for an answer. Hope somebody here can help me.

    ReplyDelete
  6. i tried to Creating a vHyper-V Instance on VMware Fusion & i didn't work..you think it's possible? any helpful lead?

    ReplyDelete
  7. For others: I missed the config change to the host, and got the "Black Screen" issue above. Fixing the host config worked.

    ReplyDelete
  8. anyone tried with kvm like a nested hypervisor ? I tried but with no success :(

    ReplyDelete
    Replies
    1. Have the same. Did you already resolved this issue?

      Delete
  9. Pretty strange that I did everything correct, but can`t install Hyper-V role inside VM, and if I set GuestOS type to ESXi5 or 4 I get Black screen, while safe mode works.

    ReplyDelete
  10. can we use same settings to create Citrix Xen Server 5.6 too on vSphere 5i?

    ReplyDelete
  11. Has anyone been able to install the VMware tools within a nested VM? That was my problem with ESX 4.x

    ReplyDelete
  12. Could you post the VMX file for the Hyper-V Instance and the physical hardware specs?

    ReplyDelete
  13. I have followed all the steps for VHyper-V on a physical ESXi 5.0 and receive a black screen when booting up the 2008 server as well. Has anyone found a solution to this yet? I need to run hyper-V for a program that requires it but don't have another physical server to install it on. Any help would be great.

    ReplyDelete
  14. Not quite sure what I'm missing. The nested vESXi5.0 starts to install but fails as it can't see a disk to install on. Any ideas?

    ReplyDelete
  15. Hi, Can anyone help me here. Im able to create Nested 64 bit Windows 2008 servers, but those manys are not reachable from outside. I understand this is a problem with Esx 5.0, as 32 bit windows 2008 when created from Esx 4.1 works fine.

    Does any one faced this issue before, and any tweaks to fix this?

    ReplyDelete
  16. Keep in mind that the vSwitch might block the VM's created in Xen. You need to configure the vSwitch to promiscuous mode ACCEPT.

    ReplyDelete
  17. This comment has been removed by the author.

    ReplyDelete
  18. Has any one had issues with the networking on their nested VMs? From my nested VM I'm not able to ping the GW; from the nested ESXi server I'm able to ping it without issue.

    ReplyDelete
  19. I am able to create vESXi 5.0 v8 guest hosts in my existing ESXi 5.0 cluster with no issue, and can create 32bit v8 guests on the nested host. However, I do not have the option to choose ESXi as the OS after creation, and I cannot create 64 bit nested guests.
    I've set vhv.allow = "TRUE" and hardware virtualization is enabled on my pyhsical hosts.
    Any suggestions as to what my issue may be?

    ReplyDelete
  20. @JC

    Not sure I follow what your statments, you mention you can create vESXi 5.0 v8 host but then later say you can not select ESXi as guestOS. This is contradicting? If you running ESXi 5.0 on your physical host and follow the steps above, you can run nested ESXi hosts and power on 64bit nested VM within that nested ESXi host.

    Recommend you re-read the article and perform some troubleshooting such as checking "monitorControl.vhv" in your vmware.log file

    ReplyDelete
    Replies
    1. Hi William,

      Thank you for your reply and my apologies for the confusion.
      I have added the vhv.allow = "TRUE" line to etc/vmware/config on my physical hosts
      I have confirmed that hardware virtualization is enabled on the physicsal hosts.
      I have created guests running ESXi 5.0 by choosing "Red Hat Enterprise Linux 5" as the guest OS.
      On these vESXi hosts I have successfully created 32-bit guests. (Hardware ESXi > vESXi > 32-bit VM)

      However...
      I do not have the option to choose "VMware ESXi 5.x" in the edit settings dialog of my vESXi VM.
      I cannot make 64-bit nested guests off of the vESXi

      Any thoughts?

      Delete
  21. @JC,

    Have you checked vmware.log as I recommended in my last reply? Also are you running ESXi 5 on your physical host?

    ReplyDelete
    Replies
    1. My apologies, forgot that in my last post.

      The grep in vmware.log returns nothing. In fact, the only instances of "vhv" are:
      vmx| DICT vhv.allow = TRUE
      vmx| DICT vhv.allow = TRUE
      vmx| OvhdMem OvhdUser_vhvMSRBitmap
      vmx| OvhdMem OvhdUser_vhvMSRBitmap

      I checked on multiple vESXi 5 machines, and got the same result.

      My physical hosts are running ESXi 5, and VT is enabled at the BIOS.

      Delete
  22. All
    I'm running Esx5 on top of Vmware fusion and it's working well , but when i try to run 64 bit VM on ESX5 it doesn;t boot and say that 64bit support is not available. Let me know what can be done, Appreciate the help.

    ReplyDelete

 
/*http://blog.cartercole.com/2009/10/awesome-syntax-highlighting-made-easy.html*/