I just got into a very interesting problem recently – the vim-cmd does not work as expected when used for renaming a datastore in vSphere.
What is the problem exactly?
Lost VMs or Containers? Too Many Consoles? Too Slow GUI? Time to learn how to "Google" and manage your VMware and clouds in a fast and secure HTML5 App.
The following command, for example, should change the name of a datastore from datastore1 (which is the default datastore name) to doublecloudDS.
# vim-cmd hostsvc/datastore/rename datastore1 doubecloudDS
After the command is executed, there is no error message reported. But the datastore name remains the same as shown in either the vSphere Client or using the following command:
# vim-cmd hostsvc/datastore/listsummary
After a few tries with the command, for example, change order of the source and destination datastore, adding  to wrap aournd the datastore names, all these resulted errors. So the command itself is most likely correct.
What possibly went wrong?
The ESXi is not running as a standalone server but is managed by a vCenter. It turns out that right after the vim-cmd renamed a datastore, the vCenter reverses back, immediately. There is an entry in the /var/log/vpxa.log file:
/var/log/vpxa.log:2013-15-10T16:13:28.916Z [51326B90 verbose 'vpxavpxaDatastore' opID=SWI-3a603987] [VpxaDatastore] Renaming datastore doublecloudDS -> datastore1
So the problem is really the vCenter. This is not necessarily a bad thing as vCenter wants to make sure it’s in control. I kind of think the ideal case would be that the vCenter reads back the changes from ESXi. That would of course needs more work.
What can be the fix?
The easier approach is to ALWAYS rename your datastore via vCenter, either from vSphere GUI (standalone client or Web client) or APIs like vijava APIs. vCenter will send the change to ESXi and make sure the data is consistent.
If you still wants to use the vim-cmd, you have to detach the ESXi from its managing vCenter and add it back again. It may sounds too much. Will disconnecting and connecting back work? Not really. The new name remains as long as you don’t connect the ESXi back to the vCenter. Once you do connect it back, vCenter will reverse back the name. I think the vCenter uses an internal ID for the datastore. So it knows the datastore regardless it new name.