source: gpfs_3.1_ker2.6.20/lpp/mmfs/bin/mmlscluster

Last change on this file was 16, checked in by rock, 17 years ago
  • Property svn:executable set to *
File size: 6.2 KB
Line 
1#!/bin/ksh
2# IBM_PROLOG_BEGIN_TAG
3# This is an automatically generated prolog.
4
5
6
7# Licensed Materials - Property of IBM
8
9# (C) COPYRIGHT International Business Machines Corp. 2000,2005
10# All Rights Reserved
11
12# US Government Users Restricted Rights - Use, duplication or
13# disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
14
15# IBM_PROLOG_END_TAG
16# @(#)33 1.35 src/avs/fs/mmfs/ts/admin/mmlscluster.sh, mmfs, avs_rgpfs24, rgpfs240610b 8/11/05 01:46:29
17##########################################################################
18#
19#  List data for the nodes that belong to a GPFS cluster.
20#
21#  Usage:  mmlscluster
22#
23##########################################################################
24
25# Include global declarations and service routines.
26. /usr/lpp/mmfs/bin/mmglobfuncs
27. /usr/lpp/mmfs/bin/mmsdrfsdef
28
29sourceFile="mmlscluster.sh"
30[[ -n $DEBUG || -n $DEBUGmmlscluster ]] && set -x
31$mmTRACE_ENTER "$*"
32
33# Local work files.  Names should be of the form:
34#   fn=${tmpDir}fn.${mmcmd}.$$
35
36LOCAL_FILES=" "
37
38# Local variables
39usageMsg=357
40firstFreenode=yes
41
42underline="----------------------------------------------------------"
43underline="${underline}----------------------------------------------"
44dblunderline="======================================================="
45dblunderline="${dblunderline}========================================"
46
47
48#############################
49# Check the input arguments.
50#############################
51[[ $arg1 = '-?' || $arg1 = '-h' || $arg1 = '--help' || $arg1 = '--' ]] &&  \
52  syntaxError "help" $usageMsg
53
54[[ $argc -ge 1 ]] &&  \
55  syntaxError "extraArg"  $usageMsg "$arg1"
56
57
58#######################################################################
59# Set up trap exception handling and call the gpfsInit function.
60# It will ensure that the local copy of the mmsdrfs and the rest
61# of the GPFS system files are up-to-date.  No need to lock the sdr.
62#######################################################################
63trap pretrap2 HUP INT QUIT KILL
64gpfsInitOutput=$(gpfsInit nolock)
65setGlobalVar $? $gpfsInitOutput
66
67
68##################################################################
69# Determine the value of the uidDomain parameter.  We do this
70# separately because the value is not kept in the version line
71# while we want to display it early in the mmlscluster output.
72##################################################################
73uidDomain=$(showCfgValue uidDomain)
74
75
76##################################################################
77# Prepare the mmsdrfs file.  This involves an additional sorting
78# to assure that the node numbers come out in numerical order.
79##################################################################
80LC_ALL=C $sort -t: -k 1,1 -k 3,3 -k 2,2 -k 5,5n -k 4,4n $mmsdrfsFile -o $tmpsdrfs
81checkForErrors sort $?
82
83
84################################
85# Display the principal header.
86################################
87header=$(printInfoMsg 400)
88printf "\n%s\n%.${#header}s\n" "$header" "$dblunderline"
89
90
91###############################################
92# Display the information in the mmsdrfs file.
93###############################################
94IFS=":"
95exec 3<&-
96exec 3< $tmpsdrfs
97while read -u3 sdrfsLine
98do
99  # Parse the line.
100  set -f ; set -A v -- - $sdrfsLine ; set +f
101  IFS="$IFS_sv"
102
103  # Display information from some of the fields depending on the type of line.
104  case ${v[$LINE_TYPE_Field]} in
105
106    $VERSION_LINE )
107      # Ensure we have the correct paths for the remote commands.
108      [[ -z ${v[$RSH_PATH_Field]} || ${v[$RSH_PATH_Field]} = "_DEFAULT_" ]] && \
109        v[$RSH_PATH_Field]=$rsh
110      [[ -z ${v[$RCP_PATH_Field]} || ${v[$RCP_PATH_Field]} = "_DEFAULT_" ]] && \
111        v[$RCP_PATH_Field]=$rcp
112
113      # Display the GPFS cluster type and id.
114      printInfoMsg 430 ${v[$CLUSTER_NAME_Field]}
115      printInfoMsg 434 ${v[$CLUSTERID_Field]}
116
117      # Display the UID domain value.
118      [[ -z $uidDomain ]] && uidDomain=${v[$CLUSTER_NAME_Field]}
119      printInfoMsg 451 $uidDomain
120
121      # If this is not a single node cluster,
122      # display remote command paths, network information, etc.
123      if [[ $environmentType != single ]]
124      then
125        # Display the remote commands in effect.
126        printInfoMsg 435 ${v[$RSH_PATH_Field]}
127        printInfoMsg 436 ${v[$RCP_PATH_Field]}
128
129        # Display the primary and secondary servers.
130        header=$(printInfoMsg 401)
131        printf "\n%s\n%.${#header}s\n" "$header" "$underline"
132        printInfoMsg 402 ${v[$PRIMARY_SERVER_Field]}
133        [[ -z ${v[$BACKUP_SERVER_Field]} || ${v[$BACKUP_SERVER_Field]} = "_NOSECONDARY_" ]] &&  \
134          v[$BACKUP_SERVER_Field]=$(printInfoMsg 409)
135        printInfoMsg 403 ${v[$BACKUP_SERVER_Field]}
136      fi  # end if [[ $environmentType != single ]]
137
138      # Display the header line for the node information.
139      # " Node  Daemon node name   IP address  Admin node name  Designation"
140      header=$(printInfoMsg 404)
141      printf "\n%s\n%.${#header}s\n" "$header" "$underline"
142      ;;
143
144    $MEMBER_NODE )
145
146      if [[ ${v[$CORE_QUORUM_Field]} = $quorumNode ]]
147      then
148        if [[ ${v[$DESIGNATION_Field]} = $MANAGER ]]
149        then
150          nodeRole=$(printInfoMsg 414)  # "quorum-manager"
151        else
152          nodeRole=$(printInfoMsg 475)  # "quorum"
153        fi
154      else
155        if [[ ${v[$DESIGNATION_Field]} = $MANAGER ]]
156        then
157          nodeRole=$(printInfoMsg 482)  # "manager"
158        else
159          nodeRole=""
160        fi
161      fi
162
163      if [[ -n ${v[$DAEMON_NODENAME_Field]} ]]
164      then
165        daemonNodeName=${v[$DAEMON_NODENAME_Field]}
166      else
167        daemonNodeName=${v[$REL_HOSTNAME_Field]}
168      fi
169 
170      printf "%4s %1s %-27s %-16s %-27s %s\n"  \
171             "${v[$NODE_NUMBER_Field]}" "$BLANKchar" "$daemonNodeName"  \
172             "${v[$IPA_Field]}" "${v[$REL_HOSTNAME_Field]}" "$nodeRole"
173      ;;
174
175    * )  # No need to look at any of the other lines.
176      ;;
177
178  esac  # end of Display information from some of the fields
179
180  IFS=":"  # Change the separator back to ":" for the next iteration.
181
182done  # end of while read -u3 sdrfsLine
183
184IFS="$IFS_sv"  # Restore the default IFS settings.
185
186
187######################
188# Cleanup and return.
189######################
190print ""                   # Add a blank line for nicer formatting.
191cleanupAndExit 0
192
Note: See TracBrowser for help on using the repository browser.