From 4cdd804629fffc3266c88f7298c5e601a7d791c8 Mon Sep 17 00:00:00 2001 From: yujian Date: Sat, 9 Jun 2007 07:09:09 +0000 Subject: [PATCH] Branch b1_6 b=10760 i=brian i=nathan Improve the operation to get the corresponding NID(s) of the MGS node from the "mgs nids" field of one lustre target line for checking lnet connectivity between that lustre node and the MGS node. --- lustre/scripts/lc_common | 69 ++++++++++++++++++++++++++++++++++++++++- lustre/scripts/lc_md.in | 2 +- lustre/scripts/lustre_config.in | 37 +++++++--------------- 3 files changed, 80 insertions(+), 28 deletions(-) diff --git a/lustre/scripts/lc_common b/lustre/scripts/lc_common index 06a547f..8b1bcbe 100644 --- a/lustre/scripts/lc_common +++ b/lustre/scripts/lc_common @@ -292,7 +292,7 @@ nid2hostname() { fi # Execute remote command to get the host name - ret_str=$(${REMOTE} ${ip_addr} "hostname" 2>&1) + ret_str=$(${REMOTE} ${ip_addr} "hostname" 2>&1 &1 &2 "${MGS_NIDS_NAMES[idx]}" - return 1 - fi - FAILOVERS_NAMES[idx]=$(ip2hostname_multi_node ${FAILOVERS[idx]}) if [ ${PIPESTATUS[0]} -ne 0 ]; then echo >&2 "${FAILOVERS_NAMES[idx]}" @@ -838,7 +834,6 @@ check_lnet_connect() { local COMMAND RET_STR local mgs_prim_nids - local nids nids_names local nids_str= local mgs_nid local ping_mgs @@ -849,7 +844,7 @@ check_lnet_connect() { "${HOST_NAME[i]} and the MGS node ${mgs_node}" mgs_prim_nids=`echo ${MGS_NIDS[i]} | awk -F: '{print $1}'` - if [ -z "${mgs_node}" ]; then + if [ -z "${mgs_node}" -o $MGS_NUM -eq 1 ]; then nids_str=${mgs_prim_nids} # nids of primary MGS node if [ -z "${nids_str}" ]; then echo >&2 $"`basename $0`: check_lnet_connect() error:"\ @@ -858,21 +853,11 @@ check_lnet_connect() { return 1 fi else - for nids in ${MGS_NIDS[i]//:/ }; do - nids_names=$(ip2hostname_single_node ${nids}) - if [ ${PIPESTATUS[0]} -ne 0 ]; then - echo >&2 "${nids_names}" - return 1 - fi - - [ "${nids_names}" != "${nids_names#*$mgs_node*}" ]\ - && nids_str=${nids} # nids of backup MGS node - done - if [ -z "${nids_str}" ]; then - echo >&2 $"`basename $0`: check_lnet_connect() error:"\ - "Check the mgs nids item of host ${HOST_NAME[i]}!"\ - "Can not figure out which nids corresponding to the MGS"\ - "node ${mgs_node} from \"${MGS_NIDS[i]}\"!" + # Get the corresponding NID(s) of the MGS node ${mgs_node} + # from the "mgs nids" field + nids_str=$(get_mgs_nids ${mgs_node} ${MGS_NIDS[i]}) + if [ ${PIPESTATUS[0]} -ne 0 ]; then + echo >&2 "${nids_str}" return 1 fi fi -- 1.8.3.1