Monday, October 27, 2014

Manaully reset VMware VMID values

In VMware ESX if you type the following command at the shell, you will see a list of VMs installed/registered to the ESX host, along with their under-the-covers ID value called the VMID.

[root@esxcore01]:~-> vim-cmd vmsvc/getallvms

Now every time you create a new VM the system will take the next VMID that is not currently being used, however, it does not recycle any of the VMIDs.  Meaning, if you delete a VM that was using VMID = 5, the next VM you create will be VMID 6, then 7, and so forth. 

In my case where I create and delete hundreds of VMs on a daily basis this VMID counter can get really large.  So I got wondering, is there was a way to reset the "working/next" VMID?

What I found is:   

[root@esxcore01]: /etc/vmware/hostd/vmInventory.xml

contains a list of all of the registered VMs on the host, but it calls VMID .  The is also found in: 

[root@esxcore01]: /etc/vmware/hostd/pools.xml

But neither of these helped my issue.  The work around solution I found is the following. Say for example you have 4 Guests:

Server 1 = VMID 1
Server 2 = VMID 2
Server 3 = VMID 11
Server 4 = VMID 20

If you remove server 3 and 4 from your inventory, power down server 1 and 2 and then reboot the ESX server, the VMID table will reset.  So once the ESX server/host comes back up, you can re-add server 3 and 4 back to the inventory and they will have VMID 3 and VMID 4 respectfully.

No comments:

Post a Comment