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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Nicholas Bellinger <nab@xxxxxxxxxxxxxxxxxxxxx>

Signed-off-by: Nicholas Bellinger <nab@xxxxxxxxxxxxxxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux