I am using ESXi 5.5.0 update 1, but this is relevant in general to all versions of ESXi. My question is, how can you reset the VMID value for a VM or reset the counter so that new VMs will start over at a lower number? When you run:
[root@esxcore01]:~-> vim-cmd vmsvc/getallvms
You get a list of VMs on the host and they all have a VMID associated with them. Usually starting at 1 and counting up. Every time you delete a VM and recreate it, it will just take the next value in the list. In my case where I spin up a lot of VMs for a short period of time and then delete them when I am done, the VMID numbers can easily get up in the hundreds or thousands very quickly. What I would like to do, without doing a CD re-install of the host, is reset the VMID table. The steps I would like to follow is something like:
1) Delete all VMs on the host or un-register all VMs on the host.
2) Edit the right configuration file to reset the counter
3) Create a new VM or re-register a VM and have it start back at VMID 1.
Has anyone figured out which configuration files need to be edited to make this happen?
What I have 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 <objID>. The <objID> is also found in: [root@esxcore01]: /etc/vmware/hostd/pools.xml
I can not find any other reference to that in the system configuration. So unless there is a database file that has that in there, I am not sure where else to look. Is there a command that can reset the value?
I have found a way to reset the counter that is currently being used. 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.
I don't think there is a way to reset this, I hope this could be some reference ID (probably something to do with Managed Object of the VM). I looked up my environment and checked the VPX_VM table, this contains all the VM details and I found the ID for the VM to be the MoRef (Managed Object Reference), the same can be got in the ExtensionData for the VM (using PowerCli Get-View). But this is not same as the Vmid.
You shouldn't be running out of this value as you spin too many VMs. It could very well be a normal integer field of 4 byte size, so it can hold 2^31 - 1 (2,147,483,647). Hope you won't be going beyond this.
I am curious to know whats the reason you wanted a lower number? is that causing any problme?
I am using a lot of automation to make my setup work and it would be easier and cleaner if when I started a new cycle I could reset the VM host.
I have found a way to reset the counter that is currently being used. 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.