From: Andrew Perepechko Date: Mon, 2 Aug 2010 19:43:38 +0000 (+0400) Subject: b=23234 use a regular expression to parse ip_addr from ret_str in lc_net X-Git-Tag: v1_8_4_50~16 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=352e285f8b97c84ead52d416f0e26227d4432b71;p=fs%2Flustre-release.git b=23234 use a regular expression to parse ip_addr from ret_str in lc_net lc_net does not parse unexpected output from pdsh well a=Chris Horn (CRAY) i=Elena Gryaznova i=Andrew Perepechko --- diff --git a/lustre/scripts/lc_net.in b/lustre/scripts/lc_net.in index 16196d3..fef2637 100644 --- a/lustre/scripts/lc_net.in +++ b/lustre/scripts/lc_net.in @@ -169,11 +169,8 @@ remote_check() { fi # Get the IP address of ${HOST_NAMES[i]} from its own ping - if is_pdsh; then - ip_addr=`echo "${ret_str}" | head -1 | awk '{print $4}'` - else - ip_addr=`echo "${ret_str}" | head -1 | awk '{print $3}'` - fi + ip_pattern="[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}" + ip_addr=`echo "${ret_str}" | egrep -o "${ip_pattern}"` ip_addr=`echo "${ip_addr}" | sed -e 's/^(//' -e 's/)$//'` # Compare IP addresses