Error when vMotioning or Storage vMotioning - The object 'vim. Datastore:datastore-XXXX' has already been deleted or has not been completely created
Ran in to this error today when trying to storage vMotion a Virtual Machine, on further investigation the ability to perform a standard vMotion was also affected.
I then tried to vMotion another VM on the same ESXi host, this reported the same error, pointing to an issue with the host itself I began digging.
The host was complaining about a datastore that was no longer present and it was right !
I first checked for the datastore id with the powercli cmd below, it did not exist (you will see 116607 is missing)
The solution to my specific issue was with the VM swap file location and the ability to configure it to use either a Cluster wide setting or a specific ESXi host setting that can be different (or the same) for each host in the cluster.
Cluster Setting
ESXi Host Setting
When configured at the cluster level the individual host setting becomes "greyed out" however if there was a previous local ESXi setting this still remains under the covers and in my case this was configured to use Missing Datastore 116607.
To resolve the problem first configure the Cluster setting to "Datastore specified by host"
Once applied navigate to the ESXi host(s) affected and configure the VM swap location to a valid datastore (this is temporary and used to remove the stale entry of the datastore that has been deleted \ unmounted)
Once configured to a valid datastore on each host go back to the Cluster setting and change back to "Virtual machine directory"
After this I was able to carry out both vMotion's and svMotion's as normal.
Thanks for reading
Adam