The VixDiskLib_Cleanup function can fail in a variety of scenarios. Here are the 3 most common scenarios:
When a backup application connects to a VM through ESXi, from a windows backup host, the VixDiskLib_Cleanup API fails to remove stale hotadded disks from the backup host, if tmpDirectory is not specified in the VDDK config file.
Note: This issue is not seen on the Linux backup host.
VDDK saves some configuration data related to the hotadded disks, in the tmpDirectory. If the tmpDirectory is deleted, the cleanup API then fails to remove the stale hotadded disks from a backup host.
For example, the first backup of a VM is taken by connecting to the ESXi host, using the hotadd transport mode. If this backup ends abruptly before cleanup can be run, then its disks are left hotadded to the backup host.
If the subsequent backup is run by connecting to vCenter, VixDiskLib_Cleanup API fails to cleanup the stale hotadded disks. The stale hotadded disks can be successfully removed from the backup host if the subsequent backup runs the VixDiskLib_Cleanup API, by connecting to the ESXi host that the VM is running on.
Similarly, if the first backup that ended abruptly was run by connecting to vCenter Server, then the subsequent backup should also be run by connecting to the vCenter Server only. If the subsequent backup is run by connecting to ESXi, the cleanup API fails to remove the stale hotadded disks.
If the first backup of a VM using the hotadd transport mode, abruptly ends before the cleanup can be run, then its disks are left hotadded to the backup host. If this VM is re-registered to the ESXi host before its subsequent backup completes, then the subsequent backup fails to clean up the stale hotadded disks. This is because the MoRef ID of the VM changes when it is re-registered to the ESXi host. The cleanup API uses the MoRef ID of the VM to identify the stale hotadded disks, and cannot complete the cleanup activity.
VMware recommend that if you are using a Windows backup host/proxy, to ensure you specify a tmpDirectory in the Windows proxy config file.
Note: The VixDiskLib_Cleanup function can be called with same connection parameters as VixDiskLib_ConnectEx.