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.

MethodManaged ObjectSince
AttachScsiLunEx_TaskHostStorageSystem6.0
ConfigureVFlashResourceEx_TaskHostVFlashManager5.5
CreateSecondaryVMEx_TaskVirtualMachine6.0
CreateSnapshotEx_TaskVirtualMachine6.5
DeleteVStorageObjectEx_TaskVcenterVStorageObjectManager7.0.2.0
DetachScsiLunEx_TaskHostStorageSystem6.0
HostDeleteVStorageObjectEx_TaskVcenterVStorageObjectManager7.0.2.0
HostUpdateVStorageObjectMetadataEx_TaskVcenterVStorageObjectManager7.0.2.0
MarkPerenniallyReservedEx_TaskHostStorageSystem6.7.2
MountVmfsVolumeEx_TaskHostStorageSystem6.0
QueryVMotionCompatibilityEx_TaskVirtualMachineProvisioningChecker4.0
RemoveDatastoreEx_TaskHostStorageSystem6.0
ResolveMultipleUnresolvedVmfsVolumesEx_TaskHostStorageSystem5.5
UnmapVmfsVolumeEx_TaskHostStorageSystem6.0
UnmountVmfsVolumeEx_TaskHostStorageSystem6.0
VCenterUpdateVStorageObjectMetadataEx_TaskVcenterVStorageObjectManager7.0.2.0

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!


Rudolf Kleijwegt

I am an experienced IT professional with over 20 years of hands-on experience designing, deploying, and maintaining IT infrastructure in both enterprise and service provider environments. My skills span across Linux and Windows and a multitude of server applications, allowing me to excel in a wide range of IT roles. Currently, my primary focus is on Software Defined DataCenter and DevOps. I am passionate about staying up to date with the latest trends in the industry to achieve superior outcomes.

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *