Skip to content

Commit

Permalink
targetcli: add portal info
Browse files Browse the repository at this point in the history
Orabug: 37444641
Signed-off-by: Richard Li <[email protected]>
  • Loading branch information
richl9 committed Feb 22, 2025
1 parent 38b3777 commit 8c668a1
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions drgn_tools/targetcli.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
from drgn import FaultError
from drgn import Object
from drgn import Program
from drgn.helpers.common.format import escape_ascii_string
from drgn.helpers.linux.list import hlist_for_each_entry
from drgn.helpers.linux.list import list_for_each_entry

from drgn_tools.corelens import CorelensModule
from drgn_tools.dentry import dentry_for_each_child
from drgn_tools.module import ensure_debuginfo

######################################
Expand Down Expand Up @@ -49,6 +51,18 @@ def for_each_iscsi_tpg(tiqn: Object) -> Iterable[Object]:
)


def for_each_portal(tpg: Object) -> Iterable[Object]:
"""
Get a list of portals under tpg
:param tpg: ``struct se_portal_group``
:returns: Iterator of str
"""
np_dentry = tpg.tpg_np_group.cg_item.ci_dentry
for portal in dentry_for_each_child(np_dentry):
yield escape_ascii_string(portal.d_name.name.string_())


def print_iscsi_info(prog) -> None:
"""Dump iscsi section info"""

Expand Down Expand Up @@ -106,6 +120,10 @@ def print_iscsi_info(prog) -> None:
):
print_lun_info(lun, nr_indent=4)

print(f"{indent * 3}o- portals")
for portal in for_each_portal(se_tpg):
print(f"{indent * 4}o- {portal}")


######################################
# vhost
Expand Down

0 comments on commit 8c668a1

Please sign in to comment.