Detect Virtual Hardware Version From Within the Guest

Like most enterprises, we wrap up VMware tools with our own logic and install transforms… y’know, stuff like setting the video hardware acceleration level in the VM before running the tools installer so you don’t get pop-ups, not installing the hgfs driver, etc etc.

The problem when a new version of tools comes out (ie along with an ESX patch, update or major new version) is that you need to do some kind of host level detection to ensure you don’t install a higher level tools into a VM that is running on a downlevel host, as it’s not supported. Of course, running downlevel tools on higher level hosts is supported for the most part (within the same major version at least). Often this problem exists for only a short period while your fleet is upgaded – once that is complete, you can blat out the correct tools version for your estate wholesale.

But unfortunately there is no surefire way of determining what version of ESX a guest is running on from within a guest that doesn’t have VMware tools installed. Even with tools installed, there’s no way I know of but there could be some kind of undocumented backdoor way of finding out – who knows.

So with the introduction of ESX 4, I thought the best bet would be to check whether a guest was running on Virtual Hardware 7 (HW 7) or not. Sure, it’s possible to create version 4 (HW 4) guests on ESX 4, but at least if you found HW 7 you could be absolutely certain that the ESX 4 version of tools should be installed. And besides, I will be mandating that any new machines created on vSphere will have HW 7 so the only things on HW 4 will be migrated machines.

After failing to find an easy way to determine this however, I took the simple approach of looking at the BIOS release date. VM’s created on ESX 4 have a date of 2009XXXX whereas 3.5 has 2008XXXX. But as i often do, I thought I would ask my friendly VMware SE if this approach was reliable enough or if I was overlooking some other easy way to determine the virtual hardware level.

The answer came back that it was OK for the time being, however maybe not in the future as new BIOSes are released with ESX updates sometimes in order to satisfy SVVP requirements and the like. After pointing out that detecting virtual hardware version would still not be 100% accurate for the reason above (ie the ability to create or run HW 4 machines on ESX 4), he revealed that it was in fact possible to detect the virtual hardware version by looking at PCI IDs within the guest – if you find a device with PCI ID 15AD:07A0, then you know it is HW 7. The important part is the ‘07A0‘. A hardware version 6 machine will have ‘0790’, and anything else will be HW 4 or older.

So not a perfect solution, however it definitely falls into the category of ‘obscure piece of VMware knowledge’ that I like to post about :). Perhaps VMware might consider exposing the ESX version in some way to the guest in the future, maybe via a field in the guest BIOS or something. Or at the very least get rid of that annpying “VMware Tools Out of Date” message in vCenter and change it to something more useful like displaying the actual version of tools running in the guest. At least that way managers wouldn’t think that the ‘Out of Date’ message meant there was some kind of supportability issue, which there isn’t in the majority of cases!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: