Thanks to Colin Watson

Signed-off-by: Ritesh Raj Sarraf <rsar...@netapp.com>
---
 utils/iscsi_discovery |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/utils/iscsi_discovery b/utils/iscsi_discovery
index 1bddc25..d07ecc2 100755
--- a/utils/iscsi_discovery
+++ b/utils/iscsi_discovery
@@ -104,24 +104,22 @@ discover()
 
        connected=0
        discovered=0
-       df=/tmp/discovered.$$
 
        dbg "starting discovery to $ip"
-       iscsiadm -m discovery --type sendtargets --portal ${ip}:${port} > ${df}
-       while read portal target
+       disc="$(iscsiadm -m discovery --type sendtargets --portal 
${ip}:${port})"
+       echo "${disc}" | while read portal target
        do
                portal=${portal%,*}
                select_transport
-       done < ${df}
+       done
 
-       discovered=$(cat ${df} | wc -l)
+       discovered=$(echo "${disc}" | wc -l)
        if [ ${discovered} = 0 ]; then
                echo "failed to discover targets at ${ip}"
                exit 2
        else
                echo "discovered ${discovered} targets at ${ip}"
        fi
-       /bin/rm -f ${df}
 }
 
 try_login()
-- 
1.7.0

-- 
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To post to this group, send email to open-is...@googlegroups.com.
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/open-iscsi?hl=en.

Reply via email to