Skip to content

Add Context.lun_reset() to expose iscsi_task_mgmt_lun_reset_sync#11

Merged
bmeagherix merged 2 commits into
python-scsi:masterfrom
bmeagherix:add_lun_reset
May 4, 2026
Merged

Add Context.lun_reset() to expose iscsi_task_mgmt_lun_reset_sync#11
bmeagherix merged 2 commits into
python-scsi:masterfrom
bmeagherix:add_lun_reset

Conversation

@bmeagherix
Copy link
Copy Markdown
Contributor

Expose iscsi_task_mgmt_lun_reset_sync as Context.lun_reset(lun).

iscsi_task_mgmt_lun_reset_sync has been part of libiscsi for more than a decade. The new method follows the same error-handling convention as the rest of the Context API: returns None on success, raises RuntimeError on failure.

@bmeagherix
Copy link
Copy Markdown
Contributor Author

Tested by issuing a LUN RESET against a live iSCSI target and confirming the Logical Unit Reset PDU on the wire via tcpdump.

import iscsi

ctx = iscsi.Context("<initiator-iqn>")
ctx.set_targetname("<target-iqn>")
ctx.set_session_type(iscsi.iscsi_session_type.ISCSI_SESSION_NORMAL)
ctx.connect("<target-ip>:3260", 0)
print("connected")
ctx.lun_reset(0)
print("LUN RESET OK")
ctx.disconnect()
print("disconnected")

@bmeagherix bmeagherix requested review from Flameeyes and rosjat April 30, 2026 18:48
@rosjat
Copy link
Copy Markdown
Contributor

rosjat commented May 2, 2026

@bmeagherix if you feel confident just merge the change. Im not sure if @Flameeyes will review any time soon

@bmeagherix bmeagherix merged commit c96ed3c into python-scsi:master May 4, 2026
3 checks passed
@bmeagherix bmeagherix deleted the add_lun_reset branch May 4, 2026 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants