Today I had an experience that was not very different than some of the ‘I was today years old’ memes which are floating on the web. I was working on a script to detach a LUN on all hosts within a cluster when I stumbled on a contribution from LucD in the VMware Technology Network.
Now I already knew the vSphere Web Services API had a method to detach a LUN (DetachScsiLun), but was unaware of a variant that will run asynchronously (DetachScsiLunEx_Task). The latter being of course much faster. This led me to browse the API reference documentation and found that there are actually more methods with the Ex_Task suffix.
As you can see from the table above some of these methods have been around for quite a while. And the list has grown over time.
For my purposes the DetachScsiLunEx_Task and UnmountVmfsVolumeEx_Task are the most useful. But there are of course more use cases, like this post from vcloudvision co-author Bryan which used esxcli but could just as easily used the MarkPerenniallyReservedEx_Task method.
One thing to note is that when using running tasks asynchronously you need to approach error handling differently. But if you monitor the progress in vCenter like I do for most batch operations you’ll be fine.
For more information on the above mentioned methods, head on over to the API reference for the vSphere Web Services API on developer.vmware.com.
I hope that this finding is of use to you too. Happy multitasking!