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:
x
# tgt-admin --delete <target_iqn> -ftgtadm: this target is still activeThis 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:
- Active iSCSI sessions: The target is still being accessed by connected clients.
- Lingering iSCSI sessions: Previously established connections were not properly closed.
- Kernel locks on the volume: The logical volume is still being referenced.
- 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:
# tgtadm --mode target --op showLook for session related to <target_iqn>
Check for the Active ISCSI sessions connected to the target:
# tgtadm --mode connection --op show --tid=<target-id>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:
# tgtadm --mode connection --op delete --tid=<target-id> --sid=<session-id> --forceStep 3: Restart the TGT Service
Restarting the tgt service helps clear stale sessions:
# systemctl restart tgtWas this page helpful?