Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for iSCSI discovery #9

Merged
merged 1 commit into from
Nov 5, 2024

Conversation

bmeagherix
Copy link
Contributor

Add support for iSCSI discovery

This uses iscsi_discovery_sync which was added to libiscsi in version 1.18.0 (Oct 9 2016) in commit sahlberg/libiscsi@d3ef192

Have also added CHAP and Mutual CHAP support by plumbing iscsi_set_initiator_username_pwd and iscsi_set_target_username_pwd. The former is available since version 1.1.0 (commit sahlberg/libiscsi@40abe84), whereas the latter was added in version 1.14.0 (commit sahlberg/libiscsi@b1d0ac4)

Example usage:

import iscsi
import pprint
ctx = iscsi.Context('iqn.1993-08.org.debian:01:1da68ca3c4ec')
ctx.set_session_type(iscsi.ISCSI_SESSION_DISCOVERY)
ctx.set_header_digest(iscsi.ISCSI_HEADER_DIGEST_NONE)
# ctx.set_initiator_username_pwd("user1", "12charsecret")
# ctx.set_target_username_pwd("user2", "13charsecret1")
ctx.connect('192.168.100.101', -1)
result = ctx.discover()
ctx.disconnect()
pprint.pprint(result)

@bmeagherix
Copy link
Contributor Author

@rosjat @Flameeyes Friendly ping.

Copy link
Member

@Flameeyes Flameeyes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable to me. I'm going to assume that you have checked utf-8 is the right encoding for the iSCSI protocol (I can't remember off the top of my head, but it does sound right.)

@bmeagherix
Copy link
Contributor Author

Looks reasonable to me. I'm going to assume that you have checked utf-8 is the right encoding for the iSCSI protocol (I can't remember off the top of my head, but it does sound right.)

Thanks.

Yes, UTF-8 is the encoding used by iSCSI. (see e.g. https://www.rfc-editor.org/rfc/rfc3720#section-3.2.6.2)

@bmeagherix
Copy link
Contributor Author

@rosjat Now that this PR is approved, are you the person to merge it? Thanks!

@rosjat
Copy link
Contributor

rosjat commented Nov 5, 2024

Thought @Flameeyes will merge it but I can do it later . Sorry for the mixup

@bmeagherix
Copy link
Contributor Author

Thought @Flameeyes will merge it but I can do it later . Sorry for the mixup

No problem, and thanks.

@rosjat rosjat merged commit 9fd811c into python-scsi:master Nov 5, 2024
2 checks passed
@bmeagherix bmeagherix deleted the add_discovery branch November 5, 2024 15:40
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.

3 participants