When removing dynamic discovery targets the following error is presented:
An error occurred during host configuration: , Operation failed, diagnostics report: Cannot remove discovery address (##.##.##.###:3260) as there are active sessions on the targets discovered by this address
VMware vSphere ESXi
This error is produced as the static targets are still present with active sessions.
Please ensure that the following steps have been taken to unmount and detach any datastores. - Detach a LUN device from ESXi hosts
Note: If you are removing the static target that was dynamically discovered, you need to remove dynamic target before performing the rescan.
Otherwise, the host will automatically discover and add the target to the list of static targets when you rescan the adapter.
To remove the iSCSI targets go to:
Host -> Configure -> Storage Adapters -> vmhba -> Static Discovery.
Select the iscsi targets then click "remove"
If the target was discovered using Dynamic Discovery then switch to the Dynamic Discovery tab.
Select the Dynamic Discovery target and click remove.
Now since the static target has been removed and the session have been closed and the dynamic target has been removed, now you can rescan the adapter to update the changes.