File 0107-lio_dump-Add-TPG-auth-attribute-check-for-lio_target.patch of Package lio-utils

From eb55eee43e5a265a9a2f39f5b4d452a5d11dc8b9 Mon Sep 17 00:00:00 2001
From: Nicholas Bellinger <nab@risingtidesystems.com>
Date: Sat, 10 Dec 2011 00:04:24 -0800
Subject: lio_dump: Add TPG auth attribute check for lio_target_configfs_dump

This patch adds an optional TPG auth attribute that may be present
while scanning TPG entries in lio_target_configfs_dump().

Signed-off-by: Nicholas Bellinger <nab@risingtidesystems.com>
---
 lio-py/lio_dump.py | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/lio-py/lio_dump.py b/lio-py/lio_dump.py
index eb65675..6328161 100755
--- a/lio-py/lio_dump.py
+++ b/lio-py/lio_dump.py
@@ -121,6 +121,22 @@ def lio_target_configfs_dump(option, opt_str, value, parser):
 				print "echo " + value.rstrip() + " > " + attrib_file
 				os.close(p)
 	
+			# Dump values of iscsi/iqn/tpgt/attrib/
+			print "#### authentication for iSCSI Target Portal Group"
+			auth_dir = lio_root + "/" + iqn + "/tpgt_" + tpgt + "/auth/"
+			if os.path.isdir(auth_dir):
+				auth_root = os.listdir(auth_dir)
+				for auth in auth_root:
+					auth_file = auth_dir + auth
+					p = os.open(auth_file, 0)
+					value = os.read(p, 256)
+					ret = value.isspace()
+					if ret:
+						os.close(p)
+						continue
+					print "echo -n " + value.rstrip() + " > " + auth_file
+					os.close(p)
+
 			# Dump values for iscsi/iqn/tpgt/param
 			print "#### Parameters for iSCSI Target Portal Group"
 			param_dir = lio_root + "/" + iqn + "/tpgt_" + tpgt + "/param/"
-- 
1.8.1.4