vmware: the object has already been deleted or has not been completely created

I’ve been performing loads of storage reclaim tasks all day and notices a few swap files in a datastore that needed to be pulled… so I calmly went ahead and disabled local swap on each ESX host with

esxcli sched swap system set -l false 

and this is all I remember doing as far as destructiveness goes. Perhaps this screwed something up but I digress… it’s too late and I neither have the time or any chance of reverting anything. 

I started getting this error in a cluster from which I pulled the darn swap datastore and reliable google wasn’t much help… I am unable to perform any tasks on VMs including power on, migrate, etc. Everything was fine half an hour ago. I can still power on the VMs through direct fat client connection to each host. Clearly it’s a cluster issue. 

I checked cluster’s swap settings… there you go. It was set to place them in the datastore I just reclaimed. In my case the quickest non-disruptive trick I could pull was to create a new cluster and move my hosts before my boss was back at his desk… so I did. However, I had to make sure to backup my folder structure, annotations, affinity rules, resource pools and vApps backed up before I could do so since I am responsible for a large environment.

1. Create a new cluster and configure
2. Right click – disconnect each host from vCenter
3. Right click – remove from inventory
4. Add hosts to new cluster
5. Attach distributed switches, if any

That’s it, now start restoring, and remember this next time you saw something sitting where it didn’t belong.