iSCSI Target Deletion Failure Due to Active Sessions

Problem

When attempting to delete an iSCSI target in an OpenStack environment, the operation fails with the following error message:

Terminal
Copy

This issue occurs because the iSCSI target is still active, preventing its removal. The target may be in use by active sessions, stale connections, or underlying kernel locks.

Environment

  • Platform9 Managed OpenStack - v4.0 and Higher

Cause

The failure to delete the iSCSI target is commonly due to:

  1. Active iSCSI sessions: The target is still being accessed by connected clients.
  2. Lingering iSCSI sessions: Previously established connections were not properly closed.
  3. Kernel locks on the volume: The logical volume is still being referenced.
  4. TGT service state: The iSCSI target daemon (tgtd) has stale sessions preventing cleanup.

Resolution

Step 1: Identify Active iSCSI Sessions

Run the following command on the Cinder node to list active iSCSI sessions:

Terminal
Copy

Look for session related to <target_iqn>

Check for the Active ISCSI sessions connected to the target:

Terminal
Copy

Step 2: Delete the Active iSCSI Sessions

If there are active connections, then terminate forcefully the active sessions for the target to allow its removal:

Terminal
Copy

Step 3: Restart the TGT Service

Restarting the tgt service helps clear stale sessions:

Terminal
Copy
Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard