[PATCH 1/2] lio-node: Add iser network portal attribute + ib_isert shutdown support

18 views
Skip to first unread message

Nicholas A. Bellinger

unread,
Apr 12, 2013, 1:09:10 AM4/12/13
to target-devel, Jerome Martin, Ritesh Raj Sarraf, James Page, Hannes Reinecke, Or Gerlitz, Nicholas Bellinger
From: Nicholas Bellinger <n...@risingtidesystems.com>

Signed-off-by: Nicholas Bellinger <n...@risingtidesystems.com>
---
lio-py/lio_node.py | 24 +++++++++++++++++++++++-
1 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/lio-py/lio_node.py b/lio-py/lio_node.py
index c7082e8..02e661b 100755
--- a/lio-py/lio_node.py
+++ b/lio-py/lio_node.py
@@ -277,7 +277,20 @@ def lio_target_del_np(option, opt_str, value, parser):
tpgt = str(value[1]);
np = str(value[2]);

- rmdir_op = "rmdir " + lio_root + "/" + iqn + "/tpgt_" + tpgt + "/np/" + np
+ path = lio_root + "/" + iqn + "/tpgt_" + tpgt + "/np/" + np
+
+ path_iser = path + "/iser"
+ if os.path.isfile(path_iser):
+ fd = open(path_iser, 'r')
+ s = fd.read()
+ set_iser_attr = s.strip()
+ fd.close()
+ if set_iser_attr == "1":
+ fd = open(path_iser, 'w')
+ fd.write("0")
+ fd.close()
+
+ rmdir_op = "rmdir " + path
# print "rmdir_op: " + rmdir_op
ret = os.system(rmdir_op)
if not ret:
@@ -1230,6 +1243,15 @@ def lio_target_unload(option, opt_str, value, parser):
if ret:
print "Unable to remove lio_root: " + lio_root

+ fd = open("/proc/modules", 'r')
+ buf = fd.read()
+ fd.close()
+ if re.search('ib_isert', buf):
+ rmmod_op = "rmmod ib_isert"
+ ret = os.system(rmmod_op)
+ if ret:
+ print "Unable to unload ib_isert"
+
rmmod_op = "rmmod iscsi_target_mod"
ret = os.system(rmmod_op)
if ret:
--
1.7.2.5

Nicholas A. Bellinger

unread,
Apr 12, 2013, 1:09:09 AM4/12/13
to target-devel, Jerome Martin, Ritesh Raj Sarraf, James Page, Hannes Reinecke, Or Gerlitz, Nicholas Bellinger
From: Nicholas Bellinger <n...@risingtidesystems.com>

Hi folks,

And finally, the associated lio-node change to handle iser-target network portal
shutdown, and associated lio-dump change to save iser-target network portal
state across init.d/target restart.

Thanks,

--nab

Nicholas Bellinger (2):
lio-node: Add iser network portal attribute + ib_isert shutdown
support
lio-dump: Add iser network portal attribute support

lio-py/lio_dump.py | 10 +++++++++-
lio-py/lio_node.py | 24 +++++++++++++++++++++++-
2 files changed, 32 insertions(+), 2 deletions(-)

--
1.7.2.5

Nicholas A. Bellinger

unread,
Apr 12, 2013, 1:09:11 AM4/12/13
to target-devel, Jerome Martin, Ritesh Raj Sarraf, James Page, Hannes Reinecke, Or Gerlitz, Nicholas Bellinger
From: Nicholas Bellinger <n...@risingtidesystems.com>

Signed-off-by: Nicholas Bellinger <n...@risingtidesystems.com>
---
lio-py/lio_dump.py | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/lio-py/lio_dump.py b/lio-py/lio_dump.py
index 6328161..3e3461f 100755
--- a/lio-py/lio_dump.py
+++ b/lio-py/lio_dump.py
@@ -57,7 +57,15 @@ def lio_target_configfs_dump(option, opt_str, value, parser):
print "#### Network portals for iSCSI Target Portal Group"
np_root = os.listdir(lio_root + "/" + iqn + "/tpgt_" + tpgt + "/np")
for np in np_root:
- print "mkdir -p " + lio_root + "/" + iqn + "/tpgt_" + tpgt + "/np/" + np
+ np_path = lio_root + "/" + iqn + "/tpgt_" + tpgt + "/np/" + np
+ print "mkdir -p " + np_path
+ np_path_iser = np_path + "/iser"
+ if os.path.isfile(np_path_iser):
+ iser_fd = open(np_path_iser, 'r')
+ iser_attr = iser_fd.read()
+ iser_attr = iser_attr.strip()
+ if iser_attr == "1":
+ print "echo 1 > " + np_path_iser

print "#### iSCSI Target Ports"
lun_root = os.listdir(lio_root + "/" + iqn + "/tpgt_" + tpgt + "/lun")
--
1.7.2.5

Reply all
Reply to author
Forward
0 new messages