-
Notifications
You must be signed in to change notification settings - Fork 23
targetcli: dump iscsi and vhost info as in targetcli #128
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
Conversation
e36abdb to
9c2f73d
Compare
|
Added struct type before address based on feedback from @biger410 |
biger410
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for creating this helpers. Put some comments, please review, thanks.
drgn_tools/targetcli.py
Outdated
| """ | ||
| Get a list of tpg from tiqn | ||
|
|
||
| :param tiqn: ``struct iscsi_tiqn`` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
struct iscsi_tiqn *
drgn_tools/targetcli.py
Outdated
| "{}o- {} (struct iscsi_tiqn {})".format( | ||
| indent, | ||
| get_tiqn_name(tiqn), | ||
| hex(tiqn), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tiqn.value_()?
drgn_tools/targetcli.py
Outdated
| "{}o- {} (struct se_portal_group {}) ({})".format( | ||
| indent, | ||
| get_tpg_name(tpg.se_tpg), | ||
| hex(tpg), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tpg.value_()
drgn_tools/targetcli.py
Outdated
| "acl_list", | ||
| ): | ||
| if not acl: | ||
| break |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question with above, why do this check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We check it since it may not be configured by users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i am not following. To me, acl is getting from a linked list, list_for_each_entry will never return a NULL until the linked list is corrupted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed it.
drgn_tools/targetcli.py
Outdated
| ): | ||
| if not acl: | ||
| break | ||
| print(f"{indent * 3}o- {get_acl_name(acl)}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not clear about vhost, does it not have the lun mapping to each acl like iscsi target?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does, but may not be configured by user.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the same, the output format for iscsi and vhost should be the same? I mean line 97 to 103 should be done for vhost as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I missed your point earlier. Just added it!
drgn_tools/targetcli.py
Outdated
| "struct se_lun", tpg.se_tpg.tpg_lun_hlist.address_of_(), "link" | ||
| ): | ||
| if not lun: | ||
| break |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same with above, why checking this?
9c2f73d to
b12392b
Compare
|
Thanks a lot for the comments. I have added the module checks and fixed the return type (e.g. struct iscsi_tiqn *) issues. |
b12392b to
8adea83
Compare
drgn_tools/targetcli.py
Outdated
| vhost_scsi_list = prog["vhost_scsi_list"] | ||
| except KeyError: | ||
| print("No vhost session found.") | ||
| return [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same issue with g_tiqn_list
drgn_tools/targetcli.py
Outdated
| print("o- vhost") | ||
| for tpg in for_each_vhost_tpg(prog): | ||
| if not tpg: | ||
| break |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Above comment is still not addressed, i don't think we need the check in line 146 to 147.
drgn_tools/targetcli.py
Outdated
| "acl_list", | ||
| ): | ||
| if not acl: | ||
| break |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i am not following. To me, acl is getting from a linked list, list_for_each_entry will never return a NULL until the linked list is corrupted.
drgn_tools/targetcli.py
Outdated
| ): | ||
| if not acl: | ||
| break | ||
| print(f"{indent * 3}o- {get_acl_name(acl)}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the same, the output format for iscsi and vhost should be the same? I mean line 97 to 103 should be done for vhost as well?
drgn_tools/targetcli.py
Outdated
| @@ -0,0 +1,286 @@ | |||
| # Copyright (c) 2024, Oracle and/or its affiliates. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update to 2025
8adea83 to
9958f32
Compare
Orabug: 37301968 Signed-off-by: Richard Li <[email protected]>
9958f32 to
a1b2dc8
Compare
biger410
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks for creating these helpers.
Helper to reconstruct a targetcli-like structure and dump its iscsi and vhost sections info on iscsi target.