source: gpfs_3.1_ker2.6.20/lpp/mmfs/bin/mmglobfuncs @ 77

Last change on this file since 77 was 16, checked in by rock, 17 years ago
  • Property svn:executable set to *
File size: 136.5 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. 1999,2007
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# @(#)84 1.473.1.23 src/avs/fs/mmfs/ts/admin/mmglobfuncs.sh, mmfs, avs_rgpfs24, rgpfs24s012a 4/18/07 15:05:42
17#####################################################################
18#
19#  This file contains declarations and functions that are
20#  common to most of the commands.  All mm commands must
21#  read this dot script before they do anything else.
22#
23#  If a command needs additional dot scripts, they must
24#  be read after this one.
25#
26#####################################################################
27
28sourceFile="mmglobfuncs.sh"
29PS4='${0##*/}:${sourceFile}[$LINENO]> '
30[[ -n $DEBUGmmglobfuncs ]] && set -x
31
32#-----------------------------------------------------------
33# Determine the operating system name.
34#-----------------------------------------------------------
35osName=$(/bin/uname -s)
36
37
38#-----------------------------------------------------------
39# Set environment and save input arguments.
40#-----------------------------------------------------------
41unset ENV
42umask 022
43UMASK_sv=022
44export PATH="/bin:/usr/bin:/sbin:/usr/sbin:/usr/lpp/mmfs/bin"
45export PERL_BADLANG=0
46integer argc=$#
47cmdline=$*
48mmcmd=${0##*/}
49if [[ $mmcmd = mmremote && "$1" = mmrpc* ]]
50then
51  mmrpc="$1"
52  shift 1
53fi
54arg1="$1"
55arg2="$2"
56arg3="$3"
57arg4="$4"
58arg5="$5"
59arg6="$6"
60arg7="$7"
61arg8="$8"
62arg9="$9"
63
64
65#-----------------------------------------------------------
66# Global variables and constants
67#-----------------------------------------------------------
68primaryServer=""                # primary server for cluster sdr files
69backupServer=""                 # backup server for cluster sdr files
70mmmode=""                       # mm mode (cluster type)
71environmentType=""              # environment type
72gpfsObjectInfo=""               # GPFS object info
73sdrLocked=no                    # If yes, the sdr is locked.
74gpfsLocked=no                   # If yes, the Gpfs object is locked.
75envLocked=no                    # If yes, the local env update lock is held.
76lockId=$$                       # identifier for sdr locking
77getCredCalled=no                # If yes, the getCred function was executed.
78new_krb5=""                     # newly-obtained DCE credentials
79old_krb5="$KRB5CCNAME"          # DCE credentials prior to entering this script
80new_KRBTKFILE="/tmp/tktmmfs$$"  # Kerberos ticket file for the command
81old_KRBTKFILE="$KRBTKFILE"      # Kerberos file prior to entering this script
82nodesetId=""                    # the nodeset to which the command applies
83nsId=""                         # the nodeset to which this node belongs
84preferredNode=0                 # the first node to try when shipping command
85noUsageMsg=0                    # suppress the usage statement
86integer newGenNumber=0          # generation number for the mmsdrfs file
87integer sdrGenNumber=0          # most recent mmsdrfs generation number
88integer sdrGenTimestamp=0       # timestamp of the mmsdrfs generation number
89sdrfsFormatLevel=0              # the format level of the mmsdrfs file
90IFS_sv="$IFS"                   # value of the IFS environment variable
91ourNodeNumber=""                # the node number of this node
92ourNodeName=""                  # the reliable node name of this node
93ourShortName=""                 # the unqualified node name of this node
94ourUid=$(/usr/bin/id -u)        # the uid of the process invoking the command
95
96BLANKchar=" "
97TABchar=" "
98NO_MOUNT_CHECK="_NO_MOUNT_CHECK_"
99MOUNT_CHECK_ONLY="_MOUNT_CHECK_ONLY_"
100CHECK_ALL="_CHECK_ALL_"
101RESIGN_FSMGR="_RESIGN_FSMGR_"
102NO_FILE_COPY="_NO_FILE_COPY_"
103LINK="_LINK_"
104NO_LINK="_NO_LINK_"
105UNKNOWN="_UNKNOWN_"
106UNRESOLVED="-"
107
108
109#-----------------------------------------------------------
110# Return codes and constants for internal mm command use.
111#-----------------------------------------------------------
112# mm command unique values:
113MM_Version3=3              # node runs version 2.3 or later
114MM_IncompatibleCode=188    # installed GPFS code is not compatible
115MM_FsMounted=189           # file system mounted somewhere
116MM_KExtFailure=190         # kernel extension load/unload failure
117
118# Values based on the AIX errno.h constants:
119MM_RemoteNotFound=2        # remote cluster not found (ENOENT)
120MM_QuorumWait=11           # daemon waits for quorum (EAGAIN)
121MM_AccessDenied=13         # access denied (EACCES)
122MM_NotJoined=16            # node has not joined the cluster (EBUSY)
123MM_FsExists=17             # device already exists (EEXIST)
124MM_FsNotFound=19           # device does not exist (ENODEV)
125MM_DeviceNotFound=19       # device does not exist (ENODEV)
126MM_InvalidName=22          # invalid (device) name (EINVAL)
127MM_DaemonDown=50           # daemon not running (ENOCONNECT)
128MM_UnknownCluster=70       # unknown cluster (ENETUNREACH)
129MM_ConnectionReset=73      # connection reset (ECONNRESET)
130MM_TimedOut=78             # connection timed out (ETIMEDOUT)
131MM_HostDown=80             # host is down (EHOSTDOWN)
132MM_Remotefs=93             # remote file system (EREMOTE)
133
134# Values based on GPFS ShErrno.h constants modulo 256:
135MM_ConnectTimeout=107      # connection timeout or error (E_NOTCONN)
136MM_SecurityCfg=208         # failed to load security keys (E_SECURITY_CFG mod 256)
137MM_AuthorizationFailed=214 # authorization failed (E_AUTHORIZATION_FAILED mod 256)
138
139
140#-----------------------------------------------------------
141# Well-known directories
142#-----------------------------------------------------------
143# Set the directory with the mm commands.
144if [[ -n $MMFSDIR ]]
145then
146  mmcmdDir="${MMFSDIR}/bin"
147elif [[ -z $mmcmdDir ]]
148then
149  mmcmdDir="/usr/lpp/mmfs/bin"
150else
151  : # mmcmdDir must have been set by the caller
152fi
153
154tscmdDir="$mmcmdDir"                           # directory with ts commands
155mmdataDir="/usr/lpp/mmfs/data/"                # directory for various mm data files
156mmsdrfsDir="/var/mmfs/gen/"                    # directory for various mm system files
157mmfscfgDir="/var/mmfs/etc/"                    # directory for mmfs config files
158tmpDir="/var/mmfs/tmp/"                        # directory for temporary files
159mmbackupDir="/var/mmfs/mmbackup"               # directory for use by mmbackup
160lockdir="/var/mmfs/etc/mmlock"                 # common lock directory
161mmfsEnvLockDir="/var/mmfs/gen/mmfsEnvLockDir"  # local mmfsEnv lock directory
162links=".links"                                 # directory with links to ts commands
163rasDir="/var/adm/ras/"                         # directory for daemon log files
164sslDir="/var/mmfs/ssl/"                        # directory for cluster security files
165sslStageDir="/var/mmfs/ssl/stage/"             # directory for cluster security files
166defaultAutomountDir="/gpfs/automountdir"       # default directory for automounts
167
168# Keep the following two items in sync with globcfg.C
169mmpmonDir="/var/mmfs/mmpmon/"                  # directory for use by mmpmon
170mmpmonSocket="mmpmonSocket"                    # name of mmpmon named socket
171
172# The env lock location can be altered with an environment variable.
173[[ -n $mmfsEnvLockLocation ]] &&  \
174   mmfsEnvLockDir="$mmfsEnvLockLocation/mmfsEnvLockDir"
175
176# If the user is not root, relocate files used by
177# mmls commands to /tmp instead of /var/mmfs/tmp.
178[[ $ourUid -ne 0 ]] && tmpDir="/tmp/"
179
180#-----------------------------------------------------------
181# Well-known file names
182#-----------------------------------------------------------
183if [[ $ourUid -eq 0 ]]
184then
185  MULTIPLE_KEYS_5="${mmsdrfsDir}MULTIPLE_KEYS_5"          #esjxx ifdef file
186# mkdir -p $mmsdrfsDir ; touch $MULTIPLE_KEYS_5           #esjxx ifdef file
187fi
188
189ignoreStartupMount=${mmfscfgDir}ignoreStartupMount # node-override for -A yes mounting
190localMountOptions=${mmfscfgDir}localMountOptions   # node-specific mount options;
191                                                   #  the suffix is the file system name
192mmfscfgFile=${mmfscfgDir}mmfs.cfg              # mmfs.cfg file used by the daemon
193mmfscfg=${mmfscfgDir}mmfs.cfg                  # mmfs.cfg file used by the daemon
194haslock=${lockdir}/haslock                     # pid and node of command that has lock
195hasEnvLock=${mmfsEnvLockDir}/hasEnvLock        # pid of cmd that has the mmfsEnv lock
196mmsdrfsFile=${mmsdrfsDir}mmsdrfs               # cached copy of the mmsdrfs file
197mmsdrfsTmp=${mmsdrfsDir}mmsdrfs.tmp            # uncommitted copy of the mmsdrfs file
198mmsdrfsPrev=${mmsdrfsDir}mmsdrfs.prev          # previous version of the mmsdrfs file
199uncommitted=${mmsdrfsDir}uncommitted           # empty file signifying commit in progress
200mmfsNodeData=${mmsdrfsDir}mmfsNodeData         # local node data (hostname, ipa, etc.)
201mmfsEnvLevel=${mmsdrfsDir}mmfsEnvLevel         # the suffix is equal to the gen number
202                                               # of the local mmsdrfs file
203mmfsVfsNumber=${mmsdrfsDir}mmfsVfsNumber       # the suffix is equal to the major number
204                                               # assigned to /dev entries on this node
205exclDiskFile=${mmsdrfsDir}exclDiskFile         # the suffix is equal to the file system
206                                               # device name to which the disks belong
207mmsdrfsGen=${tmpDir}mmsdrfsGen                 # the suffix is the file's gen number
208mmauthKeyGen=${sslStageDir}mmauthKeyGen        # mmauth genkey file (format 1)
209                                               #   the suffix is the key gen number
210genkeyData=${sslStageDir}genkeyData            # mmauth genkey file (format 2)
211                                               #   the suffix is the key gen number
212mmfsNewKeyLevel=${mmsdrfsDir}mmfsNewKeyLevel   # the suffix is equal to the gen number
213                                               # of the uncommitted private key file
214mmfsCommittedKeyLevel=${mmsdrfsDir}mmfsCommittedKeyLevel # the suffix is the gen number
215                                               # of the committed private key file
216newPrivateKey=${sslDir}id_rsa_new              # uncommitted private key file
217committedPrivateKey=${sslDir}id_rsa_committed  # committed private key file
218newPublicKey=${sslDir}id_rsa_new.pub           # uncommitted public key file
219committedPublicKey=${sslDir}id_rsa_committed.pub # committed public key file
220newCertificate=${sslDir}id_rsa_new.cert        # uncommitted self-signed certificate
221committedCertificate=${sslDir}id_rsa_committed.cert # committed self-signed certificate
222publicKey=${sslDir}id_rsa.pub                  # link to the current public key
223privateKey=${sslDir}id_rsa                     # private key file for the local cluster
224                                               #   the suffix is the key gen number
225
226mmSdrLockExp=${mmsdrfsDir}mmSdrLockExp         # contains gen number and exp. timestamp
227nsdmap=${mmsdrfsDir}nsdmap                     # local disk name to pvid hints file
228nsdpvol=${mmsdrfsDir}nsdpvol                   # local disk name to nsd name file
229mmDirectMap=${mmsdrfsDir}mmDirectMap           # list of automountable file systems
230startupMountFile=${mmsdrfsDir}automountFile    # fs to mount at startup time
231automountFile=${mmsdrfsDir}automountFile       # fs to mount at startup time
232authorizedKeys=${sslDir}authorized_keys        # list of autorized keys
233knownCluster=${sslDir}known_cluster            # public key file for a remote cluster;
234                                               #   the suffix is the cluster name.
235authorizedCertificates=${sslDir}authorized_certificates # list of autorized certificates
236knownCertificate=${sslDir}known_certificate    # certificate file for a remote cluster;
237                                               #   the suffix is the cluster name.
238certConfigFile=${sslDir}openssl.conf           # options for openssl certificate
239opensslConfFile=${mmdataDir}openssl.conf       # template for openssl certificate
240rerunmmfsFile=${mmsdrfsDir}rerunmmfsFile       # file telling runmmfs to respawn mmfsd
241respawnlog=${mmsdrfsDir}runmmfs.respawnlog     # controls the rate of mmfsd respawn
242respawnlog2=${mmsdrfsDir}runmmfs.respawnlog.$$ # controls the rate of mmfsd respawn
243mmpmonNamedSocketFile=${mmpmonDir}${mmpmonSocket} # mmpmon named socket
244mmsdrservPid=${mmsdrfsDir}mmsdrservPid         # contains pid of the mmsdrserv process
245
246# To get error messages from mmsdrserv, specify a file name in the mmsdrservLog
247# variable.  If this variable is not defined, all error msgs will be discarded.
248#mmsdrservLog=${tmpDir}mmsdrservLog            # log records from the mmsdrserv daemon
249[[ -z $mmsdrservLog ]] && mmsdrservLog="/dev/null"
250
251
252#-----------------------------------------------------------
253# Global working files
254#-----------------------------------------------------------
255adfile=${tmpDir}adapterFile.${mmcmd}.$$         # list of all node adapters
256rnfile=${tmpDir}relNamesFile.${mmcmd}.$$        # list of all reliable hostnames
257lslvOutput=${tmpDir}lslvOutput.${mmcmd}.$$      # lslv output
258sdrNodeFile=${tmpDir}sdrNodeFile.${mmcmd}.$$    # node-related information
259vsdNamesFile=${tmpDir}vsdNamesFile.${mmcmd}.$$  # list of all VSDs
260volGroupFile=${tmpDir}volGroupFile.${mmcmd}.$$  # list of all global volume groups
261allClusterNodes=${tmpDir}allClusterNodes.${mmcmd}.$$  # list of nodes in the cluster
262allQuorumNodes=${tmpDir}allQuorumNodes.${mmcmd}.$$    # list of all quorum nodes
263nodefile=${tmpDir}nodefile.${mmcmd}.$$          # list of nodes in the cluster
264diskfile=${tmpDir}diskfile.${mmcmd}.$$          # list of disks in the cluster
265newsdrfs=${tmpDir}newsdrfs.${mmcmd}.$$          # new version of mmsdrfs file
266tmpsdrfs=${tmpDir}tmpsdrfs.${mmcmd}.$$          # temp file for building the mmsdrfs
267mmsdrfsShadow=${mmsdrfsFile}.$$                 # temp copy of the sdr version of mmsdrfs
268sdrfs=${tmpDir}sdrfs.${mmcmd}.$$                # local copy of the mmsdrfs file
269oldsdrfs=${tmpDir}oldsdrfs.${mmcmd}.$$          # local copy of the mmsdrfs file
270stanza=${tmpDir}stanza.${mmcmd}.$$              # /etc/filesystems stanza
271oldstanza=${tmpDir}oldstanza.${mmcmd}.$$        # old version of /etc/filesystems stanza
272newstanza=${tmpDir}newstanza.${mmcmd}.$$        # new version of /etc/filesystems stanza
273newcfg=${tmpDir}newcfg.${mmcmd}.$$              # new version of mmfs.cfg file
274remainingFs=${tmpDir}remainingFs.${mmcmd}.$$    # remaining file systems info
275tmpfile=${tmpDir}tmpfile.${mmcmd}.$$            # temp file for misc use
276tmpfile2=${tmpDir}tmpfile2.${mmcmd}.$$          # second temp file for misc use
277tmpCfg=${tmpDir}tmpCfg.${mmcmd}.$$              # temp mmfs.cfg file
278tmpNodes=${tmpDir}tmpNodes.${mmcmd}.$$          # temp file with node names
279tmpDirectMap=${mmsdrfsDir}tmpDirectMap          # list of automountable file systems
280tmpPublicKey=${sslStageDir}tmpPublicKey.${mmcmd}.$$      # temp public key file
281tmpPrivateKey=${sslStageDir}tmpPrivateKey.${mmcmd}.$$    # temp private key file
282tmpCertificate=${sslStageDir}tmpCertificate.${mmcmd}.$$  # temp certificate file
283localAuthKeys=${tmpDir}localAuthKeys.${mmcmd}.$$         # local public keys
284localCertificates=${tmpDir}localCertificates.${mmcmd}.$$ # local certificates
285tmpAuthKeys=${tmpDir}tmpAuthKeys.${mmcmd}.$$             # temp authorized keys file
286tmpKnownCluster="${tmpDir}knownCluster.$$_"              # temp known cluster key file
287                                                         #  (suffix is the cluster name)
288tmpAuthCertificates=${tmpDir}tmpAuthCertificates.${mmcmd}.$$ # authorized certificates
289tmpKnownCertificate="${tmpDir}knownCertificate.$$_"      # temp known certificate file
290                                                         #  (suffix is the cluster name)
291unreachedNodes=${tmpDir}unreachedNodes.${mmcmd}.$$       # unreached nodes file
292sgDiskLines=${tmpDir}sgDiskLines.${mmcmd}.$$             # disk lines file
293diskNamesFile=${tmpDir}diskNamesFile.${mmcmd}.$$         # disk names file
294nsdDataFile=${tmpDir}nsdDataFile.${mmcmd}.$$             # NSD data file
295lqueryvgResult=${tmpDir}lqueryvgResult.${mmcmd}.$$       # lqueryvg output file
296lspvOutputFile=${tmpDir}lspvOutputFile.${mmcmd}.$$       # lspv output file
297tsOutputFile=${tmpDir}tsOutputFile.${mmcmd}.$$  # output file for a ts command
298errMsg=${tmpDir}errMsg.${mmcmd}.$$              # temp file for error messages
299                                                #  (erase as soon as not needed)
300errMsg2=${tmpDir}errMsg2.${mmcmd}.$$            # temp file for error messages
301                                                #  (erase as soon as not needed)
302
303
304GLOBAL_FILES=" $adfile $rnfile $sdrNodeFile $sdrfs $newsdrfs $volGroupFile  \
305               $tmpfile $tmpfile2 $tmpsdrfs $vsdNamesFile $diskfile  \
306               $oldstanza $stanza $newstanza $newcfg $tmpCfg $tmpNodes  \
307               $oldsdrfs $nodefile $sgDiskLines $diskNamesFile $nsdDataFile \
308               $errMsg $errMsg2 $mmsdrfsShadow $lslvOutput $unreachedNodes  \
309               $remainingFs $allClusterNodes $allQuorumNodes $lqueryvgResult  \
310               $tmpAuthKeys ${tmpKnownCluster}* $tmpDirectMap $tmpPrivateKey \
311               $tmpPublicKey $tsOutputFile $lspvOutputFile \
312               $tmpCertificate $localCertificates  \
313               $localAuthKeys $tmpAuthCertificates ${tmpKnownCertificate}* "
314
315
316#-----------------------------------------------------------
317# Full path names for GPFS commands
318#-----------------------------------------------------------
319daemonize=${mmcmdDir}/daemonize
320lxtrace=${mmcmdDir}/lxtrace
321mmchconfig=${mmcmdDir}/mmchconfig
322mmchecksubsys=${mmcmdDir}/mmchecksubsys
323mmclearfence=${mmcmdDir}/mmclearfence
324mmcommon=${mmcmdDir}/mmcommon
325mmcrclusterid=${mmcmdDir}/mmcrclusterid
326mmcrfsc=${mmcmdDir}/mmcrfsc
327mmdf=${mmcmdDir}/mmdf
328mmdsh=${mmcmdDir}/mmdsh
329mmdspmsg=${mmcmdDir}/mmdspmsg
330mmdynamicmap=${mmcmdDir}/mmdynamicmap
331mmexectsmcmd=${mmcmdDir}/mmexectsmcmd
332mmexportfs=${mmcmdDir}/mmexportfs
333mmfixcfg=${mmcmdDir}/mmfixcfg
334mmfsadm=${mmcmdDir}/mmfsadm
335mmfsenv=${mmcmdDir}/mmfsenv
336mmfskxgetwpid=${mmcmdDir}/mmfskxgetwpid
337mmfskxload=${mmcmdDir}/mmfskxload
338mmfskxunload=${mmcmdDir}/mmfskxunload
339mmfsmknod=${mmcmdDir}/mmfsmknod
340mmimportfs=${mmcmdDir}/mmimportfs
341mmkerninfo=${mmcmdDir}/mmkerninfo
342mmlsnsd=${mmcmdDir}/mmlsnsd
343mmmvfs=${mmcmdDir}/mmmvfs
344mmremote=${mmcmdDir}/mmremote
345mmsdrcli=${mmcmdDir}/mmsdrcli
346mmsdrserv=${mmcmdDir}/mmsdrserv
347mmsetrcmd=${mmcmdDir}/mmsetrcmd
348mmssaclearfence=${mmcmdDir}/mmssaclearfence
349mmstartup=${mmcmdDir}/mmstartup
350mmsync=${mmcmdDir}/mmsync
351mmtrace=${mmcmdDir}/mmtrace
352runmmfs=${mmcmdDir}/runmmfs
353tsadddisk=${tscmdDir}/tsadddisk
354tsauth=${tscmdDir}/tsauth
355tsaddrmap=${tscmdDir}/tsaddrmap
356tsbackup=${tscmdDir}/tsbackup
357tschfileset=${tscmdDir}/tschfileset
358tschfs=${tscmdDir}/tschfs
359tschmgr=${tscmdDir}/tschmgr
360tschpolicy=${tscmdDir}/tschpolicy
361tschpool=${tscmdDir}/tschpool
362tscrefresh=${tscmdDir}/tscrefresh
363tscrfileset=${tscmdDir}/tscrfileset
364tscrfs=${tscmdDir}/tscrfs
365tsctl=${tscmdDir}/tsctl
366tsctlfs=${tscmdDir}/tsctlfs
367tsdeldisk=${tscmdDir}/tsdeldisk
368tsdelfileset=${tscmdDir}/tsdelfileset
369tsdelfs=${tscmdDir}/tsdelfs
370tsdsh=${tscmdDir}/tsdsh
371tsfileid=${tscmdDir}/tsfileid
372tsfindinode=${tscmdDir}/tsfindinode
373tslinkfileset=${tscmdDir}/tslinkfileset
374tslsfs=${tscmdDir}/tslsfs
375tslsfileset=${tscmdDir}/tslsfileset
376tslspolicy=${tscmdDir}/tslspolicy
377tsmigrate=${tscmdDir}/tsmigrate
378tsnsdaccess=${tscmdDir}/tsnsdaccess
379tsremount=${tscmdDir}/tsremount
380tsrestripefs=${tscmdDir}/tsrestripefs
381tsstatus=${tscmdDir}/tsstatus
382tsprclear=${tscmdDir}/tsprclear
383tspreparedisk=${tscmdDir}/tspreparedisk
384tsunlinkfileset=${tscmdDir}/tsunlinkfileset
385nss_setmap=${tscmdDir}/nss_setmap
386
387
388#-----------------------------------------------------------
389# User exits
390#-----------------------------------------------------------
391mmsdrbackup=${mmfscfgDir}mmsdrbackup
392nsddevices=${mmfscfgDir}nsddevices
393remoteclusternodes=${mmfscfgDir}remoteclusternodes
394sslrandfile=${mmfscfgDir}sslrandfile
395syncfsconfig=${mmfscfgDir}syncfsconfig
396
397
398#-----------------------------------------------------------
399# RSCT peer domain commands
400#-----------------------------------------------------------
401export CT_MANAGEMENT_SCOPE=2
402lsclcfg=/usr/bin/lsclcfg
403lsnodeid=/usr/sbin/rsct/bin/lsnodeid
404lsrsrcapi=/usr/bin/lsrsrc-api
405
406
407#-----------------------------------------------------------
408# Full path names for the GPFS daemon and kernel extension.
409# The mmcmdSubdir and mmcmdSuffix components, if they are to
410# have non-null values, must be set by the invoking module.
411#-----------------------------------------------------------
412mmfs=${mmcmdDir}/${mmcmdSubdir}/mmfs${mmcmdSuffix}
413mmfsd=${mmcmdDir}/${mmcmdSubdir}/mmfsd${mmcmdSuffix}
414
415
416#-----------------------------------------------------------
417# Global declarations for parsing the mmsdrfs file
418#-----------------------------------------------------------
419# Line type identifiers and other constants.
420VERSION_LINE='00_VERSION_LINE'
421COMMENT_LINE='03_COMMENT'
422NODESET_HDR='10_NODESET_HDR'
423MEMBER_NODE='20_MEMBER_NODE'
424SG_HEADR='30_SG_HEADR'
425SG_ETCFS='40_SG_ETCFS'
426SG_MOUNT='50_SG_MOUNT'
427SG_DISKS='60_SG_DISKS'
428MMFSCFG='70_MMFSCFG'
429REM_CLUSTER='80_REM_CLUSTER'
430REM_CLUSTER_KEY='82_REM_CLUSTER_KEY'
431AUTHORIZED_CLUSTER='90_AUTHORIZED_CLUSTER'
432AUTHORIZED_KEY='92_AUTHORIZED_KEY'
433AUTHORIZED_FS='94_AUTHORIZED_FS'
434HSMDATA='910_HSMDATA'
435HSMVERSION='920_HSMVERSION'
436
437CURRENT_SDRFS_FORMAT=1
438CURRENT_SDRFS_VERSION=3
439CURRENT_KEYFILE_FORMAT=2
440COMPATIBLE_KEYFILE_FORMAT=2
441GLOBAL_ID='%%9999%%'
442FREE_DISK='~%BBBB%%'
443DSM_DATA='~%DSM%%'
444NO_DEVICE='~/~'
445CHANGE_NSD='~/changeNsd/~'
446HOME_CLUSTER="%%home%%"
447availableField=""
448obsoleteField=""
449FREE_NODE='~%AAAA%%'            # obsolete
450HA_SERVICES='~%HAS%%'           # obsolete
451HA_CLUSTER_NAME='gpfs'          # obsolete
452PRIMARY_NETWORK='gpfs'          # obsolete
453SECONDARY_NETWORK='gpfs2'       # obsolete
454
455# Global field definitions.
456NODESETID_Field=1
457LINE_TYPE_Field=2
458DEV_NAME_Field=3
459LINE_NUMBER_Field=4
460
461# Definitions for the VERSION_LINE.
462SDRFS_FORMAT_Field=4
463SDRFS_VERSION_Field=5
464SDRFS_GENNUM_Field=6
465RUNNING_CMD_Field=7
466CLUSTER_TYPE_Field=8
467PRIMARY_SERVER_Field=9
468BACKUP_SERVER_Field=10
469HIGHEST_GPFS_DISK_NBR_Field=11
470RSH_PATH_Field=12
471RCP_PATH_Field=13
472CLUSTERID_Field=14
473CLUSTER_SUBTYPE_Field=15
474GENNUM_TSTAMP_Field=16
475GETOBJECT_PORT_Field=17         # obsolete
476CLUSTER_NAME_Field=18
477NEW_KEY_Field=19
478SECLEVEL_Field=20
479COMMITTED_KEY_Field=21
480KEYFILE_FORMAT_Field=22
481initialDiskNumber=1000
482
483# Definitions for COMMENT lines.
484COMMENT_TEXT_Field=5
485warningText="   This is a machine generated file.  Do not edit!        "
486
487# Definitions for NODESET_HDR lines.
488NODE_COUNT_Field=5
489COMM_PROTOCOL_Field=6
490CIPHER_LIST_Field=7
491TCP_PORT_Field=8
492# obsolete_Field=9           # old CONVERSION_STATE_Field
493# obsolete_Field=10          # old EVENTS_PORT_Field
494# available_Field=11
495MIN_DAEMON_VERSION_Field=12  # same as the maxFeatureLevel
496MAX_DAEMON_VERSION_Field=13
497OS_ENVIRONMENT_Field=14
498# available_Field=15
499EVENTS_PORT_Field=16
500GETOBJECT_PORT_Field=17
501defaultTcpPort=1191
502
503# Definitions for MEMBER_NODE lines.
504NODE_NUMBER_Field=5
505NODE_NAME_Field=6
506IPA_Field=7
507REL_HOSTNAME_Field=8
508DESIGNATION_Field=9
509LAPI_ADAPTER_Field=10        # obsolete
510LAPI_WINDOW_Field=11         # obsolete
511SWITCH_NODE_NUMBER_Field=12  # obsolete
512ADDNODE_STATE_Field=13
513ADAPTER_TYPE_Field=14
514DAEMON_NODENAME_Field=15
515ADMIN_SHORTNAME_Field=16
516DAEMON_VERSION_Field=17
517PRODUCT_VERSION_Field=18
518OS_NAME_Field=19
519CORE_QUORUM_Field=20
520GS_NODE_NUMBER_Field=21      # obsolete
521noWindow="-1"
522noSwitch="-1"
523noNumber=0
524DELETED_NODE="deleted"       # obsolete
525QUORUM="quorum"
526NONQUORUM="nonquorum"
527MANAGER="manager"
528CLIENT="client"
529NEW_NODE="new"
530OLD_NODE=""
531quorumNode="Q"
532nonQuorumNode="N"
533maxQuorumNodes=128
534maxRecQuorumNodes=7
535
536# Definitions for SG_HEADR lines.
537DEV_MINOR_Field=5
538ODD_STATE_Field=6
539FS_TYPE_Field=7
540REMOTE_DEV_NAME_Field=8
541remotefs="R"
542localfs=""
543
544# Definitions for SG_ETCFS lines.
545ETCFS_TEXT_Field=5
546MOUNT_POINT_Line=1
547DEV_Line=2
548VFS_Line=3
549NODENAME_Line=4
550MOUNT_Line=5
551TYPE_Line=6
552ACCOUNT_Line=7
553OPTIONS_Line=8
554DEV_Line_Prefix=" dev   = "
555VFS_Line_Prefix=" vfs   = "
556NODENAME_Line_Prefix="  nodename  = "
557MOUNT_Line_Prefix=" mount   = "
558TYPE_Line_Prefix="  type    = "
559ACCOUNT_Line_Prefix=" account   = "
560OPTIONS_Line_Prefix=" options   = "
561
562# Definitions for SG_MOUNT lines.
563RW_OPT_Field=5
564MTIME_OPT_Field=6
565ATIME_OPT_Field=7
566QUOTA_OPT_Field=8
567OTHER_OPT_Field=9
568QUOTA_ACTIVATED="userquota;groupquota;filesetquota"
569QUOTA_DISACTIVATED=""
570
571# Definitions for SG_DISKS lines.
572DISK_NAME_Field=5
573DISK_SIZE_Field=6
574FAILURE_GROUP_Field=7
575DISK_USAGE_Field=8
576PVID_Field=9
577DISK_TYPE_Field=10         # disk type of the disk (e.g., vsd, lv, nsd-direct)
578NSD_PRIMARY_NODE_Field=11
579NSD_BACKUP_NODE_Field=12
580DISK_SUBTYPE_Field=13      # ssa, pr, other; used for fencing
581VPATH_FLAG_Field=14        # vpath or notvpath; used when deleting or importing
582                           #   disks; SDD utilities may or may not be needed
583NSD_SUBTYPE_Field=15       # disk type of the disk underlying the nsd
584                           #   (e.g., vsd, lv, hdisk, vpath, generic)
585NAME_SOURCE_Field=16       # disk name source (user-specified or cmd-generated)
586NSD_SUBTYPE_DISKNAME_Field=17  #  disk name of the disk underlying the nsd
587EXCLUDE_Field=18
588PAXOS_Field=19
589DISK_STATUS_Field=20
590AIX_PVID_Field=21          # PVID of the underlying AIX disk (if applicable).
591STORAGE_POOL_Field=22
592DAEMON_NSD_PRIMARY_Field=23
593DAEMON_NSD_BACKUP_Field=24
594userSpecified="user"
595cmdGenerated="cmd"
596excludedDisk="excl"
597includedDisk=""
598PaxosDisk="quorumDisk"
599
600# Definitions for MMFSCFG lines.
601#
602# Since mmfs.cfg values can contain the ':' character,
603# everything past the first four fields, except trailing
604# null fields, is considered to be mmfs.cfg text.
605
606# Definitions for REM_CLUSTER lines.
607CONTACT_NODES_Field=5
608
609# Definitions for REM_CLUSTER_KEY lines.
610# Definitions for AUTHORIZED_KEY lines.
611KEY_Field=5
612
613# Definitions for AUTHORIZED_CLUSTER lines.
614GRANT_Field=5
615# available_Field=6
616CIPHER_LIST_Field=7
617accessGranted="all"
618accessDenied=""
619
620# Definitions for AUTHORIZED_FS lines.
621ACCESS_TYPE_Field=5
622ROOTSQUASH_UID_Field=6
623ROOTSQUASH_GID_Field=7
624
625# Definitions for HSMDATA and HSMVERSION lines.
626HSM_NODESET_Field=3
627# Since these lines can contain the ':' character,
628# everything past the first four fields, except trailing
629# null fields, is considered to be free format text.
630
631
632#-----------------------------------------------------------------------
633#
634# Set up the internal mm trace facility.
635#
636# Tracing is controlled through the mmScriptTrace environment variable.
637#
638# - If the variable is not set, tracing is disabled.
639#
640# - If the variable is set, and its value starts with a slash,
641#   it is assumed to be the full path name for the file which
642#   is to contain the trace results.  Otherwise, the trace results
643#   are send to file /tmp/mmfs/mmScriptTrace.
644#
645# Examples:
646#
647#   $mmTRACE_ENTER "$*"
648#
649#   $mmTRACE "lock held by $lockHolderHostname $lockHolderPid"
650#
651#   $mmTRACE_EXIT "rc=$rc"
652#
653#-----------------------------------------------------------------------
654if [[ -z $mmScriptTrace || $mmScriptTrace = "/dev/null" ]]
655then
656  mmTRACE_ENTER=_mmTRACE_ENTER_disabled
657  mmTRACE_EXIT=_mmTRACE_EXIT_disabled
658  mmTRACE=_mmTRACE_disabled
659  mmScriptTrace="/dev/null"
660else
661  mmTRACE_ENTER=_mmTRACE_ENTER_enabled
662  mmTRACE_EXIT=_mmTRACE_EXIT_enabled
663  mmTRACE=_mmTRACE_enabled
664  [[ $mmScriptTrace != /* ]] && \
665    mmScriptTrace=/tmp/mmfs/mmScriptTrace
666fi
667
668
669#-----------------------------------------------------------
670# Set release information.
671#-----------------------------------------------------------
672. /usr/lpp/mmfs/bin/mmprodname
673sourceFile="mmglobfuncs.sh"
674
675
676#------------------------------------------------------------------
677#  Pull in operating system dependent declarations and functions.
678#------------------------------------------------------------------
679[[ -e ${mmcmdDir}/mmglobfuncs.$osName ]] && \
680  . ${mmcmdDir}/mmglobfuncs.$osName
681sourceFile="mmglobfuncs.sh"
682
683
684#------------------------------------------------------------------
685# Check whether site changed the mmfs.log location.
686#------------------------------------------------------------------
687if [[ -f $mmfscfg ]]
688then
689  logDir=$($awk '$1 == "logDir" {value = $2} END {print value}' $mmfscfg)
690  [[ -n $logDir ]] && rasDir="${logDir}/"
691fi
692
693
694#------------------------------------------------------------------
695# Make sure required directories exist.
696#------------------------------------------------------------------
697if [[ $ourUid -eq 0 ]]
698then
699  $mkdir -p $mmsdrfsDir $mmfscfgDir $tmpDir $rasDir $mmbackupDir
700  $mkdir -m 0700 -p $sslDir $sslStageDir $mmpmonDir
701fi
702
703
704#-----------------------------------------------------------
705# Frequently-used functions
706#-----------------------------------------------------------
707
708
709#######################################################################
710#
711# Internal tracing functions.  All of the functions interpret the
712# argument list with which they are invoked as being the trace record.
713#
714#######################################################################
715
716_mmTRACE_ENTER_enabled()
717{
718  typeset timestamp=$($perl -e 'print time')
719  printf  "%7s  %7s  %16s  %-14s  %-6s  %s\n" \
720           $$ $PPID $timestamp $mmcmd  "enter" "${0##*/}: $*" >> $mmScriptTrace
721}
722
723_mmTRACE_EXIT_enabled()
724{
725  typeset timestamp=$($perl -e 'print time')
726  printf  "%7s  %7s  %16s  %-14s  %-6s  %s\n" \
727           $$ $PPID $timestamp $mmcmd  "EXIT " "${0##*/}: $*" >> $mmScriptTrace
728}
729
730_mmTRACE_enabled()
731{
732  typeset timestamp=$($perl -e 'print time')
733  printf  "%7s  %7s  %16s  %-14s  %-6s  %s\n" \
734           $$ $PPID $timestamp $mmcmd  " " "${0##*/}: $*" >> $mmScriptTrace
735}
736
737_mmTRACE_ENTER_disabled()
738{
739   return 0
740}
741
742_mmTRACE_EXIT_disabled()
743{
744   return 0
745}
746
747_mmTRACE_disabled()
748{
749   return 0
750}
751
752
753####################################################################
754#
755# Function:  Prints the specified message to stdout
756#
757# Input:     $1 - number of the message to print
758#            $2, $3, ... - arguments to pass to dspmsg
759#
760####################################################################
761function printInfoMsg  # <msgNo> [ <arg> ... ]
762{
763  typeset sourceFile="mmglobfuncs.sh"
764  [[ -n $DEBUG || -n $DEBUGprintInfoMsg ]] && set -x
765  msgNo=$1
766  typeset msgSet
767  typeset printTimeStamp=no
768
769  # Based on the message number, find the message text.
770  case $msgNo in
771
772    12  ) msgTxt=\
773"%s: %s nodes added to the cluster out of %s nodes specified."
774    ;;
775
776    94  ) msgTxt=\
777"Deleting disks ..."
778    ;;
779
780    95  ) msgTxt=\
781"Restriping %s ..."
782    ;;
783
784    96  ) msgTxt=\
785"Replacing %s ..."
786    ;;
787
788    98  ) msgTxt=\
789"%s: Processing disks that do not belong to any file system ..."
790    ;;
791
792    99  ) msgTxt=\
793"Done"
794    ;;
795
796    143 ) msgTxt=\
797"%s: %s: Processing user configuration file %s"
798    ;;
799
800    179 ) msgTxt=\
801"flag value          description\n"\
802"---- -------------- -----------------------------------------------------"
803    ;;
804
805    180 ) msgTxt=\
806"root allowed"
807    ;;
808
809    181 ) msgTxt=\
810"root remapped to"
811    ;;
812
813    182 ) msgTxt=\
814"%s: Granting cluster %s access to file system %s:\n"\
815"        access type %s; root credentials will not be remapped."
816    ;;
817
818    183 ) msgTxt=\
819"%s: Granting cluster %s access to file system %s:\n"\
820"        access type %s; root credentials will be remapped to %s:%s."
821    ;;
822
823    231 ) msgTxt=\
824"%s: %s already belongs to volume group %s.\n"
825    ;;
826
827    241 ) msgTxt=\
828"%s: %s: Starting force unmount of GPFS file systems"
829    ;;
830
831    242 ) msgTxt=\
832"%s: %s: Unmount not finished after %s seconds.  Waiting %s more seconds"
833    ;;
834
835    243 ) msgTxt=\
836"%s: %s: Unmount not finished after %s seconds"
837    ;;
838
839    244 ) msgTxt=\
840"%s: %s: Shutting down GPFS daemons"
841    ;;
842
843    245 ) msgTxt=\
844"%s: %s: Finished"
845    ;;
846
847    250 ) msgTxt=\
848"%s: Processing file system %s ..."
849    ;;
850
851    251 ) msgTxt=\
852"%s: Processing disk %s"
853    ;;
854
855    272 ) msgTxt=\
856"%s: Command successfully completed"
857    ;;
858
859    331 ) msgTxt=\
860"Automatic mount option"
861    ;;
862
863    332 ) msgTxt=\
864"Exact mtime default mount option"
865    ;;
866
867    333 ) msgTxt=\
868"Suppress atime default mount option"
869    ;;
870
871    339 ) msgTxt=\
872"Verifying GPFS is stopped on all nodes ..."
873    ;;
874
875    373 ) msgTxt=\
876"%s: %s: Mounting file systems ..."
877    ;;
878
879    392 ) msgTxt=\
880"%s: %s: Starting GPFS ..."
881    ;;
882
883    400 ) msgTxt=\
884"GPFS cluster information"
885    ;;
886
887    401 ) msgTxt=\
888"GPFS cluster configuration servers:"
889    ;;
890
891    402 ) msgTxt=\
892"  Primary server:    %s"
893    ;;
894
895    403 ) msgTxt=\
896"  Secondary server:  %s"
897    ;;
898
899    404 ) msgTxt=\
900" Node  Daemon node name            IP address       Admin node name             Designation    "
901    ;;
902
903    405 ) msgTxt=\
904" Summary information "
905    ;;
906
907    406 ) msgTxt=\
908"File system attributes for %s:"
909    ;;
910
911    407 ) msgTxt=\
912"Configuration data for cluster %s:"
913    ;;
914
915    408 ) msgTxt=\
916"File systems in cluster %s:"
917    ;;
918
919    409 ) msgTxt=\
920"(none)"
921    ;;
922
923    414 ) msgTxt=\
924"quorum-manager"
925    ;;
926
927    416 ) msgTxt=\
928"%s: %s: Processing node %s"
929    ;;
930
931    426 ) msgTxt=\
932"%s: %s: Unmounting file systems ..."
933    ;;
934
935    427 ) msgTxt=\
936"SHA digest (new):"
937    ;;
938
939    430 ) msgTxt=\
940"  GPFS cluster name:         %s"
941    ;;
942
943    431 ) msgTxt=\
944"quorum node"
945    ;;
946
947    434 ) msgTxt=\
948"  GPFS cluster id:           %s"
949    ;;
950
951    435 ) msgTxt=\
952"  Remote shell command:      %s"
953    ;;
954
955    436 ) msgTxt=\
956"  Remote file copy command:  %s"
957    ;;
958
959    442 ) msgTxt=\
960"Cluster name:"
961    ;;
962
963    443 ) msgTxt=\
964"Cipher list:"
965    ;;
966
967    444 ) msgTxt=\
968"SHA digest:"
969    ;;
970
971    445 ) msgTxt=\
972"File system access:"
973    ;;
974
975    446 ) msgTxt=\
976"Contact nodes:"
977    ;;
978
979    447 ) msgTxt=\
980"File systems:"
981    ;;
982
983    451 ) msgTxt=\
984"  GPFS UID domain:           %s"
985    ;;
986
987    453 ) msgTxt=\
988"Verifying GPFS is stopped on all affected nodes ..."
989    ;;
990
991    473 ) msgTxt=\
992"Verifying file system configuration information ..."
993    ;;
994
995    475 ) msgTxt=\
996"quorum"
997    ;;
998
999    477 ) msgTxt=\
1000"File system %s %s is mounted on %s nodes in cluster %s:"
1001    ;;
1002
1003    478 ) msgTxt=\
1004"File system %s is mounted on %s nodes in cluster %s:"
1005    ;;
1006
1007    479 ) msgTxt=\
1008"File system %s %s is mounted on %s nodes in cluster %s."
1009    ;;
1010
1011    480 ) msgTxt=\
1012"File system %s is mounted on %s nodes in cluster %s."
1013    ;;
1014
1015    482 ) msgTxt=\
1016"manager"
1017    ;;
1018
1019    490 ) msgTxt=\
1020"Local Name  Remote Name  Cluster name           Mount Point          Mount Options    Automount"
1021    ;;
1022
1023    496 ) msgTxt=\
1024" Node number  Node name       Quorum  Nodes up  Total nodes  GPFS state  Remarks    "
1025    ;;
1026
1027    497 ) msgTxt=\
1028" Node number  Node name        GPFS state "
1029    ;;
1030
1031    501 ) msgTxt=\
1032" File system   Disk name    NSD volume ID      Primary node             Backup node          "
1033    ;;
1034
1035    502 ) msgTxt=\
1036" Disk name    NSD volume ID      Device         Node name                Remarks       "
1037    ;;
1038
1039    503 ) msgTxt=\
1040" File system   Disk name    Primary node             Backup node           "
1041    ;;
1042
1043    506 ) msgTxt=\
1044"Disk name     IO performed on node     Device             Availability"
1045    ;;
1046
1047    512 ) msgTxt=\
1048" Disk name    NSD volume ID      Device         Devtype  Node name                Remarks          "
1049    ;;
1050
1051    519 ) msgTxt=\
1052"Additional mount options"
1053    ;;
1054
1055    521 ) msgTxt=\
1056"File system %s %s is mounted on %s nodes:"
1057    ;;
1058
1059    522 ) msgTxt=\
1060"File system %s is mounted on %s nodes:"
1061    ;;
1062
1063    527 ) msgTxt=\
1064"%s still running . . .\n"
1065          printTimeStamp=yes
1066    ;;
1067
1068    541 ) msgTxt=\
1069"File system %s %s is not mounted."
1070    ;;
1071
1072    542 ) msgTxt=\
1073"File system %s %s is not mounted on any remote cluster nodes."
1074    ;;
1075
1076    543 ) msgTxt=\
1077"File system %s %s is not mounted on any node in cluster %s."
1078    ;;
1079
1080    544 ) msgTxt=\
1081"File system %s is not mounted."
1082    ;;
1083
1084    545 ) msgTxt=\
1085"File system %s is not mounted on any remote cluster nodes."
1086    ;;
1087
1088    546 ) msgTxt=\
1089"File system %s is not mounted on any node in cluster %s."
1090    ;;
1091
1092    553 ) msgTxt=\
1093"File system %s %s is mounted on %s nodes."
1094    ;;
1095
1096    554 ) msgTxt=\
1097"File system %s is mounted on %s nodes."
1098    ;;
1099
1100    559 ) msgTxt=\
1101"Default mount point"
1102    ;;
1103
1104    586 ) msgTxt=\
1105"The %s subsystem is already active."
1106    ;;
1107
1108    # Message numbers above 1000 are in message set 60 (ts/fencing/fencing.msg).
1109
1110    1018 ) msgTxt=\
1111"The disk specification must be in one of these formats:\n"\
1112"   -l logicalVolumeName        (e.g., '-l lv00')\n"\
1113"   -v volumeGroupName          (e.g., '-v vg00')\n"\
1114"   -h physicalDiskName         (e.g., '-h hdisk0')\n"\
1115"   -p physicalVolumeIdentifier (e.g., '-p 0003366423ba4d39')\n"
1116    ;;
1117
1118    1019 ) msgTxt=\
1119"Usage:  %s <disk specification>\n"
1120    ;;
1121
1122    1020 ) msgTxt=\
1123"Usage:  %s <disk specification> <node id list>"
1124    ;;
1125
1126    1021 ) msgTxt=\
1127"Usage:  %s <disk specification> <node id>"
1128    ;;
1129
1130    1022 ) msgTxt=\
1131"Usage:  %s <disk specification> <fence id>"
1132    ;;
1133
1134    1023 ) msgTxt=\
1135"The node id list is a blank-separated list of one or more node ids."
1136    ;;
1137
1138    *   )  # unknown message, ignore it.
1139      return 0
1140    ;;
1141
1142  esac
1143
1144  # Message numbers below 1000 are in message set 32 (ts/admin/admin.msg).
1145  # Message numbers above 1000 are in message set 60 (ts/fencing/fencing.msg).
1146  if [[ $msgNo -lt 1000 ]]
1147  then
1148    msgSet=32
1149  else
1150    msgSet=60
1151  fi
1152
1153  if [[ $osName = AIX ]]
1154  then
1155    # Print the message - extra arguments are ignored.
1156    if [[ $printTimeStamp = yes ]]
1157    then
1158      print -- "$(date) $($dspmsg -s $msgSet mmfs.cat \
1159        $msgNo "$msgTxt" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9")"
1160    else
1161      print -- "$($dspmsg -s $msgSet mmfs.cat \
1162        $msgNo "$msgTxt" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9")"
1163    fi
1164
1165  elif [[ $osName = Linux ]]
1166  then
1167    # Print the message - extra arguments are ignored.
1168    if [[ $printTimeStamp = yes ]]
1169    then
1170      print -- "$(date) $($mmdspmsg -s $msgSet mmfs.cat \
1171        $msgNo "$msgTxt" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9")"
1172    else
1173      print -- "$($mmdspmsg -s $msgSet mmfs.cat \
1174        $msgNo "$msgTxt" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9")"
1175    fi
1176  else
1177    checkForErrors "Unknown operating system $osName" 1
1178  fi
1179
1180}  #----- end of function printInfoMsg ---------------------------
1181
1182
1183####################################################################
1184#
1185# Function:  Prints the specified message to stderr
1186#
1187# Input:     $1 - number of the message to print
1188#            $2, $3, ... - arguments to pass to dspmsg
1189#
1190####################################################################
1191function printErrorMsg  # <msgNo> [ <arg> ... ]
1192{
1193  typeset sourceFile="mmglobfuncs.sh"
1194  [[ -n $DEBUG || -n $DEBUGprintErrorMsg ]] && set -x
1195  msgNo=$1
1196  typeset msgSet
1197  typeset printTimeStamp=no
1198
1199  # Based on the message number, find the message text
1200  case $msgNo in
1201
1202    13  ) msgTxt=\
1203"%s: Incorrect option: %s"
1204    ;;
1205
1206    19  ) msgTxt=\
1207"%s: Obsolete option: %s"
1208    ;;
1209
1210    20  ) msgTxt=\
1211"%s: Interrupt received: No changes made."
1212    ;;
1213
1214    23  ) msgTxt=\
1215"%s: Disk name must be specified in disk descriptor."
1216    ;;
1217
1218    24  ) msgTxt=\
1219"%s: Disk usage must be dataOnly, metadataOnly, descOnly, or dataAndMetadata."
1220    ;;
1221
1222    30  ) msgTxt=\
1223"%s: User specified failure group must be in the range from -1 to 4000."
1224    ;;
1225
1226    32  ) msgTxt=\
1227"%s: Interrupt received: changes not propagated."
1228    ;;
1229
1230    33  ) msgTxt=\
1231"%s: Interrupt received. Only -A, -Q, and -T were changed."
1232    ;;
1233
1234    34  ) msgTxt=\
1235"Usage:  %s Device"
1236    ;;
1237
1238    35  ) msgTxt=\
1239"%s: Restriping may not have finished."
1240    ;;
1241
1242    36  ) msgTxt=\
1243"%s: %s option specified twice."
1244    ;;
1245
1246    37  ) msgTxt=\
1247"%s: %s value must be yes or no."
1248    ;;
1249
1250    38  ) msgTxt=\
1251"%s: Incorrect extra argument: %s"
1252    ;;
1253
1254    39 ) msgTxt=\
1255"Usage: %s QueryType ItemList [Scope [norefresh]]"
1256    ;;
1257
1258    40  ) msgTxt=\
1259"%s: Incorrect integer for %s: %s"
1260    ;;
1261
1262    41  ) msgTxt=\
1263"%s: No disk descriptor file specified"
1264    ;;
1265
1266    42  ) msgTxt=\
1267"%s: File %s already exists."
1268    ;;
1269
1270    43  ) msgTxt=\
1271"%s: Cannot open %s"
1272    ;;
1273
1274    44  ) msgTxt=\
1275"%s: Incompatible cluster types.  You cannot move file systems that were\n"\
1276"created by GPFS cluster type %s into GPFS cluster type %s."
1277    ;;
1278
1279    45  ) msgTxt=\
1280"%s: %s must be greater than 0: %s"
1281    ;;
1282
1283    47  ) msgTxt=\
1284"%s: Error converting %s into an NSD."
1285    ;;
1286
1287    48  ) msgTxt=\
1288"%s: File system %s already exists in the cluster.\n"\
1289"    Use mmchfs -W to assign a new device name for the existing file system."
1290    ;;
1291
1292    49  ) msgTxt=\
1293"%s: %s is defined to have mount point %s.\n"\
1294"    There is already such a mount point in the cluster.\n"\
1295"    Use mmchfs -T to assign a new mount point to the existing file system."
1296    ;;
1297
1298    50  ) msgTxt=\
1299"%s: Error encountered while importing disk %s."
1300    ;;
1301
1302    51  ) msgTxt=\
1303"%s: Disk %s already exists in the cluster."
1304    ;;
1305
1306    53  ) msgTxt=\
1307"%s: At least one node in the cluster must be defined as a quorum node."
1308    ;;
1309
1310    54  ) msgTxt=\
1311"%s: Incorrect node %s specified for command."
1312    ;;
1313
1314    61  ) msgTxt=\
1315"%s: Use the dash character (-) to separate multiple node designations."
1316    ;;
1317
1318    62  ) msgTxt=\
1319"%s: Use the semi-colon character (;) to separate the disk names."
1320    ;;
1321
1322    63  ) msgTxt=\
1323"%s: GPFS is still active on %s"
1324    ;;
1325
1326    78  ) msgTxt=\
1327"%s: %s must be from %s to %s: %s"
1328    ;;
1329
1330    79  ) msgTxt=\
1331"%s: mmfixcfg failed while changing %s"
1332    ;;
1333
1334    88  ) msgTxt=\
1335"%s: Duplicate disk specified: %s"
1336    ;;
1337
1338    89  ) msgTxt=\
1339"%s: You cannot delete all disks"
1340    ;;
1341
1342    97  ) msgTxt=\
1343"%s: %s must be greater than %s: %s"
1344    ;;
1345
1346    100 ) msgTxt=\
1347"%s: tscrfs failed.  Cannot create %s"
1348    ;;
1349
1350    101 ) msgTxt=\
1351"%s: Disk %s does not belong to file system %s."
1352    ;;
1353
1354    102 ) msgTxt=\
1355"%s: Active disks are missing from the GPFS configuration data:"
1356    ;;
1357
1358    103 ) msgTxt=\
1359"%s: Attention: File system %s may have some disks\n"\
1360"that are in a non-ready state.  Issue the command:\n"\
1361"  mmcommon recoverfs %s"
1362    ;;
1363
1364    104 ) msgTxt=\
1365"%s: %s failed."
1366    ;;
1367
1368    105 ) msgTxt=\
1369"%s: Failed to connect to remote cluster %s"
1370    ;;
1371
1372    106 ) msgTxt=\
1373"%s: File system %s belongs to cluster %s.\n"\
1374"    Command is not allowed for remote file systems."
1375    ;;
1376
1377    107 ) msgTxt=\
1378"%s: There is already an existing file system using %s"
1379    ;;
1380
1381    108 ) msgTxt=\
1382"%s: File system %s not found in cluster %s"
1383    ;;
1384
1385    109 ) msgTxt=\
1386"%s: GPFS is down on this node."
1387    ;;
1388
1389    110 ) msgTxt=\
1390"%s: GPFS is not ready to handle commands yet."
1391    ;;
1392
1393    111 ) msgTxt=\
1394"%s: %s refers to file system %s in cluster %s"
1395    ;;
1396
1397    112 ) msgTxt=\
1398"%s: File system %s does not belong to cluster %s"
1399    ;;
1400
1401    113 ) msgTxt=\
1402"%s: %s failed. Error code %s."
1403    ;;
1404
1405    127 ) msgTxt=\
1406"%s: The main GPFS cluster configuration file is locked.  Retrying..."
1407    ;;
1408
1409    128 ) msgTxt=\
1410"%s: Lock creation successful."
1411    ;;
1412
1413    129 ) msgTxt=\
1414"%s: Timed out waiting for lock.  Try again later."
1415    ;;
1416
1417    130 ) msgTxt=\
1418"%s: Disk %s is a tiebreaker disk and cannot be deleted."
1419    ;;
1420
1421    131 ) msgTxt=\
1422"%s: GPFS detected more than eight quorum nodes while\n"\
1423"node quorum with tiebreaker disks is in use."
1424    ;;
1425
1426    132 ) msgTxt=\
1427"%s: GPFS failed to initialize the tiebreaker disks."
1428    ;;
1429
1430    133 ) msgTxt=\
1431"%s: Incorrect keyword: %s"
1432    ;;
1433
1434    134 ) msgTxt=\
1435"%s: Adding node %s to the cluster will exceed\n"\
1436"the quorum node limit."
1437    ;;
1438
1439    135 ) msgTxt=\
1440"%s: The %s kernel extension does not exist."
1441    ;;
1442
1443    136 ) msgTxt=\
1444"%s: Unable to verify kernel/module configuration."
1445    ;;
1446
1447    137 ) msgTxt=\
1448"%s: The GPFS daemon is still running; use the mmshutdown command."
1449    ;;
1450
1451    138 ) msgTxt=\
1452"%s: Module %s is still in use.\n"\
1453"Unmount all GPFS file systems and issue the command:\n"\
1454"  mmfsadm cleanup"
1455    ;;
1456
1457    139 ) msgTxt=\
1458"%s: Error unloading module %s."
1459    ;;
1460
1461    140 ) msgTxt=\
1462"%s: Module %s is already loaded."
1463    ;;
1464
1465    141 ) msgTxt=\
1466"%s: %s was not found in /proc/partitions."
1467    ;;
1468
1469    142 ) msgTxt=\
1470"%s: GPFS is waiting for %s"
1471          printTimeStamp=yes
1472    ;;
1473
1474    144 ) msgTxt=\
1475"%s: \"%s\" is set by the mmcrcluster processing.\n"\
1476"    Line in error: %s\n"\
1477"    The line is ignored; processing continues."
1478    ;;
1479
1480    145 ) msgTxt=\
1481"%s: \"%s\" must be set with the %s command.\n"\
1482"    Line in error: %s\n"\
1483"    The line is ignored; processing continues."
1484    ;;
1485
1486    146 ) msgTxt=\
1487"%s: \"%s\" is an obsolete parameter.\n"\
1488"    Line in error: %s\n"\
1489"    The line is ignored; processing continues."
1490    ;;
1491
1492    147 ) msgTxt=\
1493"%s: \"%s\" cannot appear in a node-override section.\n"\
1494"    Line in error: %s\n"\
1495"    The line is ignored; processing continues."
1496    ;;
1497
1498    148 ) msgTxt=\
1499"%s: Mount point can not be a relative path name: %s"
1500    ;;
1501
1502    149 ) msgTxt=\
1503"%s: %s can not be a relative path name: %s"
1504    ;;
1505
1506    150 ) msgTxt=\
1507"%s: Key file is not valid."
1508    ;;
1509
1510    151 ) msgTxt=\
1511"%s: Key file mismatch."
1512    ;;
1513
1514    152 ) msgTxt=\
1515"%s: Node %s already belongs to the GPFS cluster."
1516    ;;
1517
1518    153 ) msgTxt=\
1519"%s: Incorrect value for %s option"
1520    ;;
1521
1522    154 ) msgTxt=\
1523"%s: Adapter port name %s is not known on node %s."
1524    ;;
1525
1526    155 ) msgTxt=\
1527"%s: There is nothing to commit.  You must first run:\n    %s"
1528    ;;
1529
1530    156 ) msgTxt=\
1531"%s: The current authentication files are already committed."
1532    ;;
1533
1534    157 ) msgTxt=\
1535"%s: There are uncommitted authentication files.  You must first run:\n    %s"
1536    ;;
1537
1538    158 ) msgTxt=\
1539"%s: You must establish a cipher list first.  Run:\n    %s"
1540    ;;
1541
1542    159 ) msgTxt=\
1543"%s: %s not found.  Ensure the OpenSSL code is properly installed."
1544    ;;
1545
1546    160 ) msgTxt=\
1547"%s: For the logical volume specification \"-l %s\" to be valid\n"\
1548"%s must be the only logical volume in the volume group.\n"\
1549"However, volume group %s contains the following logical volumes:"
1550    ;;
1551
1552    161 ) msgTxt=\
1553"%s: %s is not a valid logical volume."
1554    ;;
1555
1556    162 ) msgTxt=\
1557"%s: %s is not a valid volume group name."
1558    ;;
1559
1560    163 ) msgTxt=\
1561"%s: For the hdisk specification \"-h %s\" to be valid\n"\
1562"%s must be the only disk in the volume group.\n"\
1563"However, volume group %s contains the following disks:"
1564    ;;
1565
1566    164 ) msgTxt=\
1567"%s: %s is not a valid physical volume name."
1568    ;;
1569
1570    165 ) msgTxt=\
1571"%s: %s is not a valid physical volume id."
1572    ;;
1573
1574    166 ) msgTxt=\
1575"Usage:  %s <disk specification>\n"
1576    ;;
1577
1578    167 ) msgTxt=\
1579"The disk specification must be in one of these formats:\n"\
1580"   -l logicalVolumeName        (e.g., '-l lv00')\n"\
1581"   -v volumeGroupName          (e.g., '-v vg00')\n"\
1582"   -h physicalDiskName         (e.g., '-h hdisk0')\n"\
1583"   -p physicalVolumeIdentifier (e.g., '-p 0003366423ba4d39')\n"
1584    ;;
1585
1586    168 ) msgTxt=\
1587"%s: Missing arguments"
1588    ;;
1589
1590    169 ) msgTxt=\
1591"%s: The device name %s starts with a slash, but not /dev/."
1592    ;;
1593
1594    170 ) msgTxt=\
1595"%s: The device name %s contains a slash, but not as its first character."
1596    ;;
1597
1598    171 ) msgTxt=\
1599"%s: Unexpected error from %s.  Return code: %s"
1600    ;;
1601
1602    172 ) msgTxt=\
1603"%s: Unknown user name %s"
1604    ;;
1605
1606    173 ) msgTxt=\
1607"%s: Unknown group name %s"
1608    ;;
1609
1610    174 ) msgTxt=\
1611"%s: The administrative adapter port name was not defined\n"\
1612"for nodes:\n\t %s\n"\
1613"Correct the problems and run mmchcluster -N again."
1614    ;;
1615
1616    175 ) msgTxt=\
1617"%s: Daemon node adapter %s was not found on admin node %s."
1618    ;;
1619
1620    176 ) msgTxt=\
1621"%s: Command failed for disks: %s"
1622    ;;
1623
1624    177 ) msgTxt=\
1625"%s: No contact nodes were provided for cluster %s"
1626    ;;
1627
1628    178 ) msgTxt=\
1629"%s: None of the contact nodes in cluster %s can be reached."
1630    ;;
1631
1632    184 ) msgTxt=\
1633"Usage: %s [-a | -n NodeName]"
1634    ;;
1635
1636    185 ) msgTxt=\
1637"Usage: %s Device [-W NewDeviceName]"
1638    ;;
1639
1640    186 ) msgTxt=\
1641"Usage: %s [-d IntegerDelayValue] [-i CommandFile] [-p]\n"\
1642"        [-r IntegerRepeatValue] [-s] [-t IntegerTimeoutValue]"
1643    ;;
1644
1645    187 ) msgTxt=\
1646"%s: Node %s returned ENODEV for disk %s."
1647    ;;
1648
1649    188 ) msgTxt=\
1650"%s: Remote cluster %s was not found."
1651    ;;
1652
1653    189 ) msgTxt=\
1654"%s: Name %s is not allowed.\n"\
1655"It contains the following invalid special character:  %s"
1656    ;;
1657
1658    190 ) msgTxt=\
1659"%s: GPFS configuration data for file system %s\n"\
1660"may not be in agreement with the on-disk data for the file system.\n"\
1661"Issue the command:\n"\
1662"  mmcommon recoverfs %s"
1663    ;;
1664
1665    191 ) msgTxt=\
1666"%s: Options %s and %s cannot be specified at the same time."
1667    ;;
1668
1669    192 ) msgTxt=\
1670"%s: <nodelist> cannot be used with attribute %s"
1671    ;;
1672
1673    193 ) msgTxt=\
1674"%s: There are no remote file systems."
1675    ;;
1676
1677    194 ) msgTxt=\
1678"%s: Remote file system %s is not defined."
1679    ;;
1680
1681    195 ) msgTxt=\
1682"%s: The GPFS configuration information is incorrect or not available."
1683    ;;
1684
1685    196 ) msgTxt=\
1686"%s: Device name cannot be 'all'."
1687    ;;
1688
1689    197 ) msgTxt=\
1690"%s: Each device specifies metadataOnly for disk usage.\n"\
1691"This file system could not store data."
1692    ;;
1693
1694    198 ) msgTxt=\
1695"%s: Each device specifies dataOnly for disk usage.\n"\
1696"This file system could not store metadata."
1697    ;;
1698
1699    199 ) msgTxt=\
1700"%s: Incorrect integer %s specified for failure group."
1701    ;;
1702
1703    200 ) msgTxt=\
1704"%s: No file systems were found."
1705    ;;
1706
1707    201 ) msgTxt=\
1708"%s: Incorrect server node %s in disk descriptor."
1709    ;;
1710
1711    202 ) msgTxt=\
1712"%s: %s is the name of the local cluster."
1713    ;;
1714
1715    204 ) msgTxt=\
1716"%s: Missing argument after %s option"
1717    ;;
1718
1719    229 ) msgTxt=\
1720"Usage: %s [-CIVOSPDH] [-c] [-u] [-d disk] [-g volumeGroup]\n"\
1721"        [-l logicalVolume] [-G globalVolumeGroup] [-L globalLogicalVolume]\n"\
1722"        [-p physicalVolumeID ]\n"
1723    ;;
1724
1725    230 ) msgTxt=\
1726"%s: %s is already in volume group %s and cannot be added to %s.\n"
1727    ;;
1728
1729    232 ) msgTxt=\
1730"%s: Cannot find %s with %s.\n"
1731    ;;
1732
1733    233 ) msgTxt=\
1734"%s: %s requires a value.\n"
1735    ;;
1736
1737    234 ) msgTxt=\
1738"%s: Incorrect option: %s\n"
1739    ;;
1740
1741    235 ) msgTxt=\
1742"%s: Interrupt received.\n"
1743    ;;
1744
1745    236 ) msgTxt=\
1746"%s: Volume group %s cannot be imported on node\n"\
1747"%s because the disk with physical volume ID %s\n"\
1748"cannot be found."
1749    ;;
1750
1751    237 ) msgTxt=\
1752"%s: Failed to obtain DCE credentials; dsrvtgt %s command rc=%s. Continuing."
1753    ;;
1754
1755    238 ) msgTxt=\
1756"%s: Command is not allowed for remote file systems."
1757    ;;
1758
1759    239 ) msgTxt=\
1760"%s: Disk usage %s is incompatible with storage pool %s."
1761    ;;
1762
1763    240 ) msgTxt=\
1764"%s: File %s not found.  Recover the file or run mmauth genkey."
1765    ;;
1766
1767    246 ) msgTxt=\
1768"Usage:\n"\
1769"  %s [-t UnmountTimeout]\n"\
1770"             [-a | -N {Node[,Node...] | NodeFile | NodeClass}]"
1771    ;;
1772
1773    247 ) msgTxt=\
1774"%s: Disk with NSD volume id %s no longer\n"\
1775"          exists in the GPFS cluster configuration data but the NSD volume id\n"\
1776"          was not erased from the disk.  To remove the NSD volume id, issue\n"\
1777"             mmdelnsd -p %s"
1778    ;;
1779
1780    248 ) msgTxt=\
1781"%s: Disk with NSD volume id %s no longer\n"\
1782"          exists in the GPFS cluster configuration data but the NSD volume id\n"\
1783"          was not erased from the disk.  To remove the NSD volume id, issue\n"\
1784"             mmdelnsd -p %s -N %s"
1785    ;;
1786
1787    249 ) msgTxt=\
1788"Usage:\n"\
1789"   %s genkey {new | commit}\n"\
1790"      or\n"\
1791"   %s add    RemoteClusterName -k KeyFile [-l CipherList]\n"\
1792"      or\n"\
1793"   %s update RemoteClusterName {[-C NewClusterName] [-k KeyFile] [-l CipherList]}\n"\
1794"      or\n"\
1795"   %s delete {RemoteClusterName | all}\n"\
1796"      or\n"\
1797"   %s grant  {RemoteClusterName | all} -f {Device | all} [-a {rw | ro}] [-r {uid:gid | no}]\n"\
1798"      or\n"\
1799"   %s deny   {RemoteClusterName | all} -f {Device | all}\n"\
1800"      or\n"\
1801"   %s show   [RemoteClusterName | all]\n"
1802    ;;
1803
1804    252 ) msgTxt=\
1805"%s: %s is not a remote file system known to GPFS."
1806    ;;
1807
1808    257 ) msgTxt=\
1809"%s: An internode connection between GPFS nodes was disrupted."
1810    ;;
1811
1812    258 ) msgTxt=\
1813"%s: No clusters are authorized to access this cluster."
1814    ;;
1815
1816    259 ) msgTxt=\
1817"%s: Cluster %s is not authorized to access this cluster."
1818    ;;
1819
1820    260 ) msgTxt=\
1821"Usage: %s %s %s"
1822    ;;
1823
1824    261 ) msgTxt=\
1825"%s: Attention: There are no available valid VFS type values for mmfs in /etc/vfs."
1826    ;;
1827
1828    262 ) msgTxt=\
1829"%s: There are no remote cluster definitions."
1830    ;;
1831
1832    263 ) msgTxt=\
1833"%s: Remote cluster %s is not defined."
1834    ;;
1835
1836    264 ) msgTxt=\
1837"%s: No disks specified"
1838    ;;
1839
1840    265 ) msgTxt=\
1841"%s: Disk %s already belongs to file system %s."
1842    ;;
1843
1844    266 ) msgTxt=\
1845"%s: File system %s has some disks that are in a non-ready state."
1846    ;;
1847
1848    267 ) msgTxt=\
1849"%s: Attention: Not all disks were marked as available."
1850    ;;
1851
1852    268 ) msgTxt=\
1853"%s: This GPFS cluster contains declarations for remote file systems and clusters.\n"\
1854"    You cannot delete the last node."
1855    ;;
1856
1857    270 ) msgTxt=\
1858"%s: The following nodes could not be reached:\n"
1859    ;;
1860
1861    271 ) msgTxt=\
1862"%s: Propagating the cluster configuration data to all\n"\
1863"  affected nodes.  This is an asynchronous process."
1864    ;;
1865
1866    272 ) msgTxt=\
1867"%s: Command successfully completed"
1868    ;;
1869
1870    273 ) msgTxt=\
1871"%s: There is no file system information in input file %s."
1872    ;;
1873
1874    274 ) msgTxt=\
1875"%s: File system %s was not found in input file %s."
1876    ;;
1877
1878    275 ) msgTxt=\
1879"%s: The following file systems were not imported:%s"
1880    ;;
1881
1882    277 ) msgTxt=\
1883"%s: Attention: Unknown attribute specified: %s.  Press the ENTER key to continue."
1884    ;;
1885
1886    278 ) msgTxt=\
1887"%s: Incorrect record found in the mmsdrfs file (code %s):"
1888    ;;
1889
1890    279 ) msgTxt=\
1891"%s: There is no file system with mount point %s."
1892    ;;
1893
1894    280 ) msgTxt=\
1895"%s: File system %s is already mounted at %s."
1896    ;;
1897
1898    281 ) msgTxt=\
1899"%s: Mount point cannot be specified when mounting all file systems."
1900    ;;
1901
1902    282 ) msgTxt=\
1903"%s: This node does not belong to a GPFS cluster."
1904    ;;
1905
1906    283 ) msgTxt=\
1907"%s:  There is no record for this node in file %s.\n"\
1908"  Either the node is not part of the cluster, or the file is for a different cluster,\n"\
1909"  or not all of the node's adapter interfaces have been activated yet."
1910    ;;
1911
1912    284 ) msgTxt=\
1913"Usage:\n"\
1914"  %s [-p NodeName] [-F mmsdrfsFile] [-R RemoteFileCopyCommand]"
1915    ;;
1916
1917    285 ) msgTxt=\
1918"%s:  Node %s successfully restored."
1919    ;;
1920
1921    286 ) msgTxt=\
1922"%s: Unexpected value for Gpfs object: %s"
1923    ;;
1924
1925    287 ) msgTxt=\
1926"Usage:\n"\
1927"  %s Device {resume | start} -a\n"\
1928"             [-N {Node[,Node...] | NodeFile | NodeClass}]\n"\
1929"    or\n"\
1930"  %s Device {suspend | resume | stop | start | change}\n"\
1931"             -d \"DiskDesc[;DiskDesc...]\"\n"\
1932"             [-N {Node[,Node...] | NodeFile | NodeClass}]"
1933    ;;
1934
1935    288 ) msgTxt=\
1936"%s: File system %s is not known to the GPFS cluster."
1937    ;;
1938
1939    289 ) msgTxt=\
1940"Usage:\n"\
1941"  %s Attribute=value[,Attribute=value...] [-i | -I]\n"\
1942"               [-N {Node[,Node...] | NodeFile | NodeClass}]"
1943    ;;
1944
1945    290 ) msgTxt=\
1946"%s: Node %s does not belong to the GPFS cluster,\n"\
1947"  or is represented multiple times on the command line."
1948    ;;
1949
1950    291 ) msgTxt=\
1951"Usage:\n"\
1952"  %s Device {\"DiskDesc[;DiskDesc...]\" | -F DescFile} [-a] [-c]\n"\
1953"            [-r] [-N {Node[,Node...] | NodeFile | NodeClass}]"
1954    ;;
1955
1956    292 ) msgTxt=\
1957"Usage: %s Device [-p]"
1958    ;;
1959
1960    293 ) msgTxt=\
1961"%s: Invalid node designation specified: %s"
1962    ;;
1963
1964    294 ) msgTxt=\
1965"%s: Operation not allowed for the local cluster."
1966    ;;
1967
1968    295 ) msgTxt=\
1969"Usage:\n"\
1970"  %s Device DiskName {DiskDesc | -F DescFile} [-v {yes | no}]\n"\
1971"                   [-N {Node[,Node...] | NodeFile | NodeClass}]"
1972    ;;
1973
1974    296 ) msgTxt=\
1975"Usage:\n"\
1976"  %s Device {\"DiskDesc[;DiskDesc...]\" | -F DescFile} [-a] [-r]\n"\
1977"    [-v {yes | no}] [-N {Node[,Node...] | NodeFile | NodeClass}]"
1978    ;;
1979
1980    298 ) msgTxt=\
1981"Usage: %s Device [-d | -F | -m] [-P PoolName] [-q]"
1982    ;;
1983
1984    299 ) msgTxt=\
1985"Usage: %s Device [-i] [-u BlkUtilPct] [-v]"
1986    ;;
1987
1988    300 ) msgTxt=\
1989"Usage:\n"\
1990"  %s Device [-n | -y] [-v | -V] [-c | -o] [-t Directory]\n"\
1991"    [-N {Node[,Node...] | NodeFile | NodeClass}]"
1992    ;;
1993
1994    301 ) msgTxt=\
1995"Usage:\n"\
1996"   %s Device [-d \"DiskName[;DiskName...]\"] [-e] [-L]\n"\
1997"      or\n"\
1998"   %s Device [-d \"DiskName[;DiskName...]\"] {-m | -M}"
1999    ;;
2000
2001    302 ) msgTxt=\
2002"Usage:\n"\
2003"  %s Device {-m | -r | -b | -p | -R} [-P PoolName]\n"\
2004"    [-N {Node[,Node...] | NodeFile | NodeClass}]"
2005    ;;
2006
2007    303 ) msgTxt=\
2008"Usage: %s [Device[ Device...]] | [-C ClusterName]"
2009    ;;
2010
2011    304 ) msgTxt=\
2012"Usage: %s Device [Node]"
2013    ;;
2014
2015    305 ) msgTxt=\
2016"%s: Mount point and device name cannot be equal: %s"
2017    ;;
2018
2019    306 ) msgTxt=\
2020"%s: Interrupt received."
2021    ;;
2022
2023    307 ) msgTxt=\
2024"%s: You must first generate an authentication key file. Run:\n"\
2025"   mmauth genkey new"
2026    ;;
2027
2028    309 ) msgTxt=\
2029"%s: The -i option failed. Changes will take effect after GPFS is restarted."
2030    ;;
2031
2032    310 ) msgTxt=\
2033"%s: This GPFS cluster contains file systems. You cannot delete the last node."
2034    ;;
2035
2036    311 ) msgTxt=\
2037"%s: Attention: Failed to remove node-specific changes."
2038    ;;
2039
2040    312 ) msgTxt=\
2041"%s: %s command cannot be executed.  Either none of the\n"\
2042"  nodes in the cluster are reachable, or GPFS is down on all of the nodes."
2043    ;;
2044
2045    313 ) msgTxt=\
2046"%s: Attention: The file system may no longer be properly balanced"
2047    ;;
2048
2049    314 ) msgTxt=\
2050"%s: To change the authentication key for the local cluster, run:\n"\
2051"   mmauth genkey"
2052    ;;
2053
2054    315 ) msgTxt=\
2055"%s: %s not found in file system %s"
2056    ;;
2057
2058    316 ) msgTxt=\
2059"%s: Remote cluster %s is already defined."
2060    ;;
2061
2062    317 ) msgTxt=\
2063"%s: File system %s from cluster %s is already defined."
2064    ;;
2065
2066    318 ) msgTxt=\
2067"%s: %s command failed.  Only %s changed."
2068    ;;
2069
2070    319 ) msgTxt=\
2071" The volume group %s exists, but partition\n"\
2072"information cannot be determined.  Perhaps it needs to be varied on?\n"
2073    ;;
2074
2075    321 ) msgTxt=\
2076"%s: %s does not exist or failed; automount mounting may not work."
2077    ;;
2078
2079    322 ) msgTxt=\
2080"%s: The command must run on a node that is part of the cluster."
2081    ;;
2082
2083    323 ) msgTxt=\
2084"%s: Command completed: No changes made"
2085    ;;
2086
2087    324 ) msgTxt=\
2088"%s: Permission failure.  The command requires root authority to execute."
2089    ;;
2090
2091    328 ) msgTxt=\
2092"%s: File %s does not contain node names."
2093    ;;
2094
2095    329 ) msgTxt=\
2096"%s: File %s does not contain data."
2097    ;;
2098
2099    330 ) msgTxt=\
2100"%s: Failed to obtain Kerberos credentials; ksrvtgt %s command rc=%s. Continuing."
2101    ;;
2102
2103    334 ) msgTxt=\
2104"Usage:\n"\
2105"   %s {Device | all} [-a] [-A] [-B] [-d] [-D] [-E] [-f] [-F] [-i]\n"\
2106"                         [-I] [-j] [-k] [-K] [-m] [-M] [-n] [-o] [-P]\n"\
2107"                         [-Q] [-r] [-R] [-s] [-S] [-T] [-u] [-V] [-z]\n"
2108    ;;
2109
2110    337 ) msgTxt=\
2111"%s:  Unable to determine the local device name for disk %s on node %s."
2112    ;;
2113
2114    338 ) msgTxt=\
2115"%s:  Unknown GPFS execution environment %s"
2116    ;;
2117
2118    340 ) msgTxt=\
2119"%s:  %s cannot be reached."
2120    ;;
2121
2122    341 ) msgTxt=\
2123"%s:  Attention:  Unable to retrieve GPFS cluster files from node %s"
2124    ;;
2125
2126    342 ) msgTxt=\
2127"%s:  Unable to retrieve GPFS cluster files from node %s"
2128    ;;
2129
2130    343 ) msgTxt=\
2131"Usage:\n"\
2132"  %s -N {NodeDesc[,NodeDesc...] | NodeFile}\n"\
2133"              -p PrimaryServer [-s SecondaryServer]\n"\
2134"              [-r RemoteShellCommand] [-R RemoteFileCopyCommand]\n"\
2135"              [-C ClusterName] [-U DomainName] [-A] [-c ConfigFile]"
2136    ;;
2137
2138    344 ) msgTxt=\
2139"%s:  Run the %s command until successful."
2140    ;;
2141
2142    345 ) msgTxt=\
2143"%s: No nodes were found that matched the input specification."
2144    ;;
2145
2146    346 ) msgTxt=\
2147"%s:  The same node was specified for both the primary and the secondary server."
2148    ;;
2149
2150    347 ) msgTxt=\
2151"%s:  Node %s is specified more than once."
2152    ;;
2153
2154    348 ) msgTxt=\
2155"%s:  Node %s was not added to the cluster.\n"\
2156"   The node appears to already belong to a GPFS cluster."
2157    ;;
2158
2159    349 ) msgTxt=\
2160"%s:  The level of GPFS on node %s does not support the requested action."
2161    ;;
2162
2163    350 ) msgTxt=\
2164"%s:  Make sure that the following nodes are available: %s"
2165    ;;
2166
2167    351 ) msgTxt=\
2168"%s:  Removing GPFS cluster files from the nodes in the cluster . . . "
2169    ;;
2170
2171    352 ) msgTxt=\
2172"%s:  %s is not a member of this cluster."
2173    ;;
2174
2175    353 ) msgTxt=\
2176"%s:  The following nodes could not be added to the GPFS cluster:%s\n"\
2177"   Correct the problems and use the mmaddnode command to add these nodes\n"\
2178"   to the cluster."
2179    ;;
2180
2181    354 ) msgTxt=\
2182"%s:  Information cannot be displayed.  Either none of the\n"\
2183"  nodes in the cluster are reachable, or GPFS is down on all of the nodes."
2184    ;;
2185
2186    355 ) msgTxt=\
2187"Usage:\n"\
2188"  %s -N {NodeDesc[,NodeDesc...] | NodeFile}"
2189    ;;
2190
2191    356 ) msgTxt=\
2192"Usage:\n"\
2193"  %s {-a | -N {Node[,Node...] | NodeFile | NodeClass}}"
2194    ;;
2195
2196    357 ) msgTxt=\
2197"Usage:  %s "
2198    ;;
2199
2200    358 ) msgTxt=\
2201"Usage:  %s Device [-L]"
2202    ;;
2203
2204    359 ) msgTxt=\
2205"Usage:  %s {[-p PrimaryServer] [-s SecondaryServer]}\n"\
2206"           or\n"\
2207"         %s -p LATEST\n"\
2208"           or\n"\
2209"         %s {[-r RemoteShellCommand] [-R RemoteFileCopyCommand]}\n"\
2210"           or\n"\
2211"         %s -C ClusterName\n"\
2212"           or\n"\
2213"         %s -N {NodeDesc[,NodeDesc...] | NodeFile}"
2214    ;;
2215
2216    360 ) msgTxt=\
2217"%s: Disk %s is the only disk in file system %s.\n"\
2218"You cannot replace a disk when it is the only remaining disk in the file system."
2219    ;;
2220
2221    361 ) msgTxt=\
2222"Usage:  %s Device PolicyFilename [-t DescriptiveName] [-I {yes|test}]"
2223    ;;
2224
2225    367 ) msgTxt=\
2226"%s: There are no available nodes on which to run the command."
2227    ;;
2228
2229    370 ) msgTxt=\
2230"Usage:  %s"
2231    ;;
2232
2233    371 ) msgTxt=\
2234"Usage:  %s Device Directory"
2235    ;;
2236
2237    372 ) msgTxt=\
2238"Usage:  %s Device Directory"
2239    ;;
2240
2241    374 ) msgTxt=\
2242"Usage:\n"\
2243"  %s [-f] [-a | -N {Node[,Node...] | NodeFile | NodeClass}]"
2244    ;;
2245
2246    375 ) msgTxt=\
2247"%s:  %s cannot be used with attribute %s"
2248    ;;
2249
2250    376 ) msgTxt=\
2251"%s:  Command is not supported in the %s environment."
2252    ;;
2253
2254    377 ) msgTxt=\
2255"%s:  Command failed on nodes: %s"
2256    ;;
2257
2258    378 ) msgTxt=\
2259"%s:  Cannot determine basic environment information.\n"\
2260"   Not enough nodes are available."
2261    ;;
2262
2263    379 ) msgTxt=\
2264"%s:  Error retrieving data from %s to %s."
2265    ;;
2266
2267    380 ) msgTxt=\
2268"%s:  The GPFS cluster data on %s is back level."
2269    ;;
2270
2271    381 ) msgTxt=\
2272"%s:  The commit process failed."
2273    ;;
2274
2275    382 ) msgTxt=\
2276"%s:  The GPFS cluster configuration data on %s\n"\
2277"is different from the data on %s."
2278    ;;
2279
2280    383 ) msgTxt=\
2281"%s:  Failed to create a backup copy of the GPFS cluster data on %s."
2282    ;;
2283
2284    384 ) msgTxt=\
2285"%s: GPFS cluster configuration server node %s cannot be removed."
2286    ;;
2287
2288    385 ) msgTxt=\
2289"Usage:\n"\
2290"   %s add Device -f RemoteDevice -C RemoteClusterName\n"\
2291"                 -T Mountpoint [-o MountOptions] [-A {yes | no | automount}]\n"\
2292"      or\n"\
2293"   %s update Device [-f RemoteDevice] [-C RemoteClusterName]\n"\
2294"                [-T Mountpoint] [-o MountOptions] [-A {yes | no | automount}]\n"\
2295"      or\n"\
2296"   %s delete {Device | all | -C RemoteClusterName}\n"\
2297"      or\n"\
2298"   %s show   [Device | all | -C RemoteClusterName]\n"
2299    ;;
2300
2301    386 ) msgTxt=\
2302"%s:  Error found while checking disk descriptor %s"
2303    ;;
2304
2305    387 ) msgTxt=\
2306"%s: %s quitting.  None of the specified nodes are valid."
2307    ;;
2308
2309    388 ) msgTxt=\
2310"Usage:\n"\
2311"   %s add RemoteClusterName -k KeyFile -n ContactNodes\n"\
2312"      or\n"\
2313"   %s update RemoteClusterName {[-C NewClusterName] [-k KeyFile] [-n ContactNodes]}\n"\
2314"      or\n"\
2315"   %s delete {RemoteClusterName | all}\n"\
2316"      or\n"\
2317"   %s show [RemoteClusterName | all]\n"
2318    ;;
2319
2320    389 ) msgTxt=\
2321"%s: Command failed.  Examine previous error messages to determine cause."
2322    ;;
2323
2324    390 ) msgTxt=\
2325"Usage:\n"\
2326"  %s {Device | DefaultMountPoint | all | all_local | all_remote} [-o MountOptions]\n"\
2327"          [-a | -N {Node[,Node...] | NodeFile | NodeClass}]\n"\
2328"      or\n"\
2329"  %s Device MountPoint [-o MountOptions]\n"\
2330"          [-a | -N {Node[,Node...] | NodeFile | NodeClass}]"
2331    ;;
2332
2333    391 ) msgTxt=\
2334"Usage:\n"\
2335"  %s [-a | -N {Node[,Node...] | NodeFile | NodeClass}]\n"\
2336"            [-E EnvVar=value...]"
2337    ;;
2338
2339    393 ) msgTxt=\
2340"%s: The number of quorum nodes exceeds the maximum (%s) allowed."
2341    ;;
2342
2343    394 ) msgTxt=\
2344"%s: Warning: The number of quorum nodes exceeds the suggested maximum (%s)."
2345    ;;
2346
2347    395 ) msgTxt=\
2348"%s: Node %s is fenced out from disk %s."
2349    ;;
2350
2351    396 ) msgTxt=\
2352"Usage:\n"\
2353"  %s {Device | MountPoint | all | all_local | all_remote} [-f]\n"\
2354"           [-a | -N {Node[,Node...] | NodeFile | NodeClass}]\n"\
2355"      or\n"\
2356"  %s Device -f -C {all_remote | ClusterName} [-N Node[,Node...]]"
2357    ;;
2358
2359    397 ) msgTxt=\
2360"%s: Unable to find disk with NSD volume id %s."
2361    ;;
2362
2363    398 ) msgTxt=\
2364"%s: GPFS was unable to obtain a lock from node %s."
2365    ;;
2366
2367    399 ) msgTxt=\
2368"%s: Remount failed for file system %s. Error code %s."
2369    ;;
2370
2371    410 ) msgTxt=\
2372"Usage:  %s -F DescFile [-v {yes | no}]\n"
2373    ;;
2374
2375    411 ) msgTxt=\
2376"%s:  Failed while processing disk descriptor %s on node %s."
2377    ;;
2378
2379    412 ) msgTxt=\
2380"%s:  Disk descriptor %s refers to an existing NSD %s"
2381    ;;
2382
2383    413 ) msgTxt=\
2384"Usage:\n"\
2385"   %s {\"DiskName[;DiskName...]\" | -F DiskFile}\n"\
2386"      or\n"\
2387"   %s -p NSDId [-N Node[,Node]]"
2388    ;;
2389
2390    415 ) msgTxt=\
2391"%s:  Disk descriptor %s should refer to an existing NSD.\n"\
2392"Use mmcrnsd to create the NSD."
2393    ;;
2394
2395    417 ) msgTxt=\
2396"%s: Issue the command from a node that remains in the cluster."
2397    ;;
2398
2399    418 ) msgTxt=\
2400"%s: No disks were found."
2401    ;;
2402
2403    419 ) msgTxt=\
2404"Usage:  %s Device Directory [-c]"
2405    ;;
2406
2407    420 ) msgTxt=\
2408"Usage:\n"\
2409"   %s Mountpoint Device {\"DiskDesc[;DiskDesc...]\" | -F DescFile}\n"\
2410"          [-A {yes | no | automount}] [-B BlockSize] [-D {posix | nfs4}]\n"\
2411"          [-E {yes | no}] [-j {cluster | scatter}]\n"\
2412"          [-k {posix | nfs4 | all}] [-K {no | whenpossible | always}]\n"\
2413"          [-m DefaultMetadataReplicas] [-M MaxMetadataReplicas]\n"\
2414"          [-n NumNodes] [-N NumInodes[:NumInodesToPreallocate]] [-Q {yes | no}]\n"\
2415"          [-r DefaultDataReplicas] [-R MaxDataReplicas]\n"\
2416"          [-S {yes | no}] [-v {yes | no}] [-z {yes | no}]\n"
2417    ;;
2418
2419    421 ) msgTxt=\
2420"Usage:\n"\
2421"   %s Device [-A {yes | no | automount}] [-D {posix | nfs4}] [-E {yes | no}]\n"\
2422"                 [-F MaxNumInodes[:NumInodesToPreallocate]]\n"\
2423"                 [-k {posix | nfs4 | all}] [-K {no | whenpossible | always}]\n"\
2424"                 [-m DefaultMetadataReplicas] [-o MountOptions]\n"\
2425"                 [-Q {yes | no}] [-r DefaultDataReplicas] [-S {yes | no}]\n"\
2426"                 [-T Mountpoint] [-V] [-z {yes | no}]\n"\
2427"      or\n"\
2428"   %s Device [-W NewDeviceName]"
2429    ;;
2430
2431    422 ) msgTxt=\
2432"%s:  Incorrect or missing remote shell command:  %s"
2433    ;;
2434
2435    423 ) msgTxt=\
2436"%s:  Incorrect or missing remote file copy command:  %s"
2437    ;;
2438
2439    424 ) msgTxt=\
2440"%s:  %s %s parameter must be an absolute pathname."
2441    ;;
2442
2443    425 ) msgTxt=\
2444"Usage:\n"\
2445"   %s {[-r RemoteShellCommand] [-R RemoteFileCopyCommand]} [-f]\n"\
2446"      or\n"\
2447"   %s -C ClusterName"
2448    ;;
2449
2450    428 ) msgTxt=\
2451"Usage:\n"\
2452"   %s [-a | -F | -f Device | -d \"DiskName[;DiskName...]\"]\n"\
2453"           [-L | -m | -M | -X] [-v]"
2454    ;;
2455
2456    429 ) msgTxt=\
2457"%s: Disk %s is of an unknown type."
2458    ;;
2459
2460    432 ) msgTxt=\
2461"%s: Disk name %s is already registered for use by GPFS."
2462    ;;
2463
2464    433 ) msgTxt=\
2465"%s:  Node %s is being used as a primary or backup NSD server."
2466    ;;
2467
2468    437 ) msgTxt=\
2469"%s:  Processing continues without lock protection."
2470    ;;
2471
2472    438 ) msgTxt=\
2473"Usage:  %s {\"DiskDesc[;DiskDesc...]\" | -F DescFile}\n"
2474    ;;
2475
2476    439 ) msgTxt=\
2477"Usage: %s Device [-d] [-Q]"
2478    ;;
2479
2480    440 ) msgTxt=\
2481"%s: Command was unable to obtain the lock for the GPFS system data.\n"\
2482"    Unable to reach the holder of the lock %s.\n"\
2483"    Check the preceding messages, if any.  Follow the procedure outlined\n"\
2484"    in the GPFS Problem Determination Guide."
2485    ;;
2486
2487    441 ) msgTxt=\
2488"vpath disk %s is not recognized as an IBM SDD device.\n"
2489    ;;
2490
2491    448 ) msgTxt=\
2492"Usage:  %s "
2493    ;;
2494
2495    449 ) msgTxt=\
2496"Usage:\n"\
2497"  %s [-L] [-s] [-v] [-a | -N {Node[,Node...] | NodeFile | NodeClass}]"
2498    ;;
2499
2500    450 ) msgTxt=\
2501"%s: Disk %s belongs to vpath %s.\n"
2502    ;;
2503
2504    452 ) msgTxt=\
2505"Usage:\n"\
2506"  %s [-u User | -g Group | -j Fileset] [-v | -q] [-e]\n"\
2507"              [-C ClusterName] [Device1 Device2 ...]\n"\
2508"    or\n"\
2509"  %s -d {-u | -g | -j} [-C ClusterName] [Device1 Device2 ...]\n"
2510    ;;
2511
2512    454 ) msgTxt=\
2513"%s: Failed to stat %s."
2514    ;;
2515
2516    455 ) msgTxt=\
2517"%s: %s is not a GPFS file system object."
2518    ;;
2519
2520    456 ) msgTxt=\
2521"%s: The policy file cannot be determined."
2522    ;;
2523
2524    457 ) msgTxt=\
2525"Usage:\n"\
2526"   %s {Device|Directory} [-P PolicyFile] [-I {yes|defer|test}]\n"\
2527"                 [-L n] [-D yyyy-mm-dd[@hh:mm[:ss]]] [-s WorkDirectory]\n"
2528    ;;
2529
2530    458 ) msgTxt=\
2531"Usage:\n"\
2532"   %s Device -n ControlFile [-t {full | incremental}] [-s SortDir]\n"\
2533"      or\n"\
2534"   %s Device -R [-s SortDir]\n"
2535    ;;
2536
2537    459 ) msgTxt=\
2538"Usage:  %s Device {\"FileName[,FileName...]\" | -f FileNameFile}\n"
2539    ;;
2540
2541    460 ) msgTxt=\
2542"%s:  \"%s\" must be a absolute path name."
2543    ;;
2544
2545    461 ) msgTxt=\
2546"%s: Device with major/minor numbers %s and %s already exists."
2547    ;;
2548
2549    462 ) msgTxt=\
2550"%s:  %s was not created by GPFS or could not be refreshed."
2551    ;;
2552
2553    469 ) msgTxt=\
2554"%s:  The %s option is not allowed for remote file systems."
2555    ;;
2556
2557    470 ) msgTxt=\
2558"%s:  There are no available free disks.\n"\
2559"Disks must be prepared prior to invoking %s.\n"\
2560"Define the disks using the %s command."
2561    ;;
2562
2563    472 ) msgTxt=\
2564"%s:  File system %s belongs to cluster %s.\n"\
2565"    The %s option is not allowed for remote file systems."
2566    ;;
2567
2568    474 ) msgTxt=\
2569"%s:  %s not active on nodes: %s"
2570    ;;
2571
2572    476 ) msgTxt=\
2573"%s: IP aliasing is not supported (%s).  Specify the main device."
2574    ;;
2575
2576    481 ) msgTxt=\
2577"%s: The requested disks are not known to GPFS."
2578    ;;
2579
2580    483 ) msgTxt=\
2581"%s:  %s is not a valid cipher list."
2582    ;;
2583
2584    484 ) msgTxt=\
2585"Usage:\n"\
2586"   %s Device {suspend | resume}\n"\
2587"      or\n"\
2588"   %s Device {exclude | include}\n"\
2589"                  {-d \"DiskName[;DiskName...]\" | -F DiskFile | -G FailureGroup}\n"\
2590"      or\n"\
2591"   %s Device syncFSconfig\n"\
2592"                  {-n RemoteNodesFile | -C RemoteCluster} [-S SpecFile]\n"
2593    ;;
2594
2595    485 ) msgTxt=\
2596"%s: Disk %s belongs to file system %s."
2597    ;;
2598
2599    486 ) msgTxt=\
2600"%s: The following disks are not known to GPFS:\n%s"
2601    ;;
2602
2603    487 ) msgTxt=\
2604"%s: No disks were specified that could be deleted."
2605    ;;
2606
2607    488 ) msgTxt=\
2608"%s: Disk %s has been removed from the GPFS cluster\n"\
2609"          configuration data but the NSD volume id was not erased from\n"\
2610"          the disk.  To remove the NSD volume id, issue\n"\
2611"             mmdelnsd -p %s"
2612    ;;
2613
2614    489 ) msgTxt=\
2615"%s:  Disk %s has been removed from the GPFS cluster data\n"\
2616"          configuration data but the NSD volume id was not erased from\n"\
2617"          the disk.  To remove the NSD volume id, issue\n"\
2618"             mmdelnsd -p %s -N %s"
2619    ;;
2620
2621    491 ) msgTxt=\
2622"%s: Disk %s is not assigned a primary NSD server node."
2623    ;;
2624
2625    492 ) msgTxt=\
2626"%s: The primary and backup NSD servers must be different nodes."
2627    ;;
2628
2629    498 ) msgTxt=\
2630"%s: Cannot handle multiple interfaces for host %s."
2631    ;;
2632
2633    499 ) msgTxt=\
2634"%s: Unexpected output from the 'host -t a %s' command:"
2635    ;;
2636
2637    500 ) msgTxt=\
2638"%s: Host %s not found."
2639    ;;
2640
2641    505 ) msgTxt=\
2642"%s: Disk name %s is not allowed.\n"\
2643"Names beginning with gpfs are reserved for use by GPFS."
2644    ;;
2645
2646    507 ) msgTxt=\
2647"%s: File %s not found.\n"\
2648"   Recover the file, or generate and commit a new key using mmauth genkey."
2649    ;;
2650
2651    508 ) msgTxt=\
2652"%s: Disk %s is too large."
2653    ;;
2654
2655    509 ) msgTxt=\
2656"%s: Unexpected error obtaining the local environment update lock."
2657    ;;
2658
2659    510 ) msgTxt=\
2660"%s: Local update lock is busy."
2661    ;;
2662
2663    511 ) msgTxt=\
2664"%s: Failed to obtain the local environment update lock."
2665    ;;
2666
2667    513 ) msgTxt=\
2668"Usage:\n"\
2669"   %s Device FilesetName [-t Comment]\n"
2670    ;;
2671
2672    514 ) msgTxt=\
2673"Usage:\n"\
2674"   %s Device {FilesetName | -J JunctionPath}\n"\
2675"                      {[-j NewFileSetName] [-t Comment]}\n"
2676    ;;
2677
2678    515 ) msgTxt=\
2679"Usage:\n"\
2680"   %s Device FilesetName [-J JunctionPath]\n"
2681    ;;
2682
2683    516 ) msgTxt=\
2684"Usage:\n"\
2685"   %s Device {FilesetName | -J JunctionPath} [-f]\n"
2686    ;;
2687
2688    517 ) msgTxt=\
2689"Usage:\n"\
2690"   %s Device FilesetName [-f]\n"
2691    ;;
2692
2693    518 ) msgTxt=\
2694"Usage:\n"\
2695"   %s Device\n"\
2696"         [[Fileset[,Fileset...]] [-J Junction[,Junction...]] | -F FileName]\n"\
2697"         [-L] [-d] [-i]\n"
2698    ;;
2699
2700    520 ) msgTxt=\
2701"%s: %s: Volume group %s has been varied on."
2702    ;;
2703
2704    523 ) msgTxt=\
2705"%s: Permission denied for disk %s"
2706    ;;
2707
2708    524 ) msgTxt=\
2709"%s: Disk %s was not found."
2710    ;;
2711
2712    525 ) msgTxt=\
2713"%s: I/O error on %s"
2714    ;;
2715
2716    526 ) msgTxt=\
2717"%s: %s is not a valid logical volume."
2718    ;;
2719
2720    528 ) msgTxt=\
2721"%s: Disk %s belongs to back-level file system %s\n"\
2722"    or the state of the disk is not ready.\n"\
2723"    Use mmchfs -V to convert the file system to the latest format.\n"\
2724"    Use mmchdisk to change the state of a disk."
2725    ;;
2726
2727    529 ) msgTxt=\
2728"%s: Failed while processing disk %s"
2729    ;;
2730
2731    530 ) msgTxt=\
2732"%s: Device %s already exists on node %s"
2733    ;;
2734
2735    531 ) msgTxt=\
2736"%s: Disk %s has no space for the quorum data structures.\n"\
2737"    Specify a different disk as tiebreaker disk."
2738    ;;
2739
2740    532 ) msgTxt=\
2741"%s: Disk %s (pvid %s) is not known on node %s"
2742    ;;
2743
2744    533 ) msgTxt=\
2745"%s: Import of volume group %s on node %s failed."
2746    ;;
2747
2748    534 ) msgTxt=\
2749"%s: Volume group %s is not known on node %s."
2750    ;;
2751
2752    535 ) msgTxt=\
2753"%s: %s: Unable to varyon volume group %s."
2754    ;;
2755
2756    536 ) msgTxt=\
2757"%s: None of the quorum nodes can be reached."
2758    ;;
2759
2760    537 ) msgTxt=\
2761"%s: The descriptor file contains more than one descriptor."
2762    ;;
2763
2764    538 ) msgTxt=\
2765"%s: The descriptor file contains no descriptor."
2766    ;;
2767
2768    539 ) msgTxt=\
2769"%s: Failed validating disk %s. Error code %s."
2770    ;;
2771
2772    540 ) msgTxt=\
2773"Usage:\n"\
2774"   %s {Device | all | all_local | all_remote} [-L]\n"\
2775"                [-C {all | all_remote | ClusterName[,ClusterName...]}]"
2776    ;;
2777
2778    547 ) msgTxt=\
2779"%s: Skipping disk %s on node %s."
2780    ;;
2781
2782    548 ) msgTxt=\
2783"%s: Name %s is not allowed.\n"\
2784"It is longer than the maximum allowable length (%s)."
2785    ;;
2786
2787    549 ) msgTxt=\
2788"%s: mmfskxload:  The format of the GPFS kernel extension\n"\
2789"is not correct for this version of AIX."
2790    ;;
2791
2792    550 ) msgTxt=\
2793"%s: %s does not resolve to a directory in %s.\n"\
2794"    The junction must be within the specified file system."
2795    ;;
2796
2797    551 ) msgTxt=\
2798"%s: Name %s is not allowed."
2799    ;;
2800
2801    552 ) msgTxt=\
2802"%s: File system %s is not mounted."
2803    ;;
2804
2805    555 ) msgTxt=\
2806"Usage: %s Device [-q | -d | -s SnapLatestName]"
2807    ;;
2808
2809    556 ) msgTxt=\
2810"Usage: %s Device [-n | -f]"
2811    ;;
2812
2813    558 ) msgTxt=\
2814"%s: Vpath disk %s has an underlying hdisk that already belongs to a volume group."
2815    ;;
2816
2817    560 ) msgTxt=\
2818"Usage:\n"\
2819"  %s Device\n"\
2820"   {-d [NodeName]:{DiskName|DiskNum|BROKEN}:[PhysAddr1[PhysAddr2]] | -F DescFile}\n"\
2821"   [-o OutputFile] [-f NumThreads] [-t Directory]"
2822    ;;
2823
2824    561 ) msgTxt=\
2825"%s: File %s either does not exist or has an incorrect format."
2826    ;;
2827
2828    562 ) msgTxt=\
2829"%s: did not find any match with the input disk address."
2830    ;;
2831
2832    563 ) msgTxt=\
2833"%s: Device %s is not mounted on node %s."
2834    ;;
2835
2836    564 ) msgTxt=\
2837"%s: Command was unable to determine whether file system %s is mounted."
2838    ;;
2839
2840    565 ) msgTxt=\
2841"%s: Backup control file %s from a previous backup does not exist."
2842    ;;
2843
2844    566 ) msgTxt=\
2845"Usage:\n"\
2846"   %s Device {[-r | -a] [-s SnapDirName]} \n"\
2847"      or\n"\
2848"   %s Device [-q]"
2849    ;;
2850
2851    567 ) msgTxt=\
2852"%s: Line %d of file %s is incorrect:"
2853    ;;
2854
2855    568 ) msgTxt=\
2856"%s: Syntax error. The correct syntax is:\n  %s"
2857    ;;
2858
2859    569 ) msgTxt=\
2860"%s: Incorrect range %s-%s specified."
2861    ;;
2862
2863    570 ) msgTxt=\
2864"Usage:  %s {Device | all} -o ExportfsFile"
2865    ;;
2866
2867    571 ) msgTxt=\
2868"Usage:\n"\
2869"   %s {Device | all} -i ImportfsFile [-S ChangeSpecFile]"
2870    ;;
2871
2872    572 ) msgTxt=\
2873"%s: Insufficient free space in %s (%s minimum required)."
2874    ;;
2875
2876    574 ) msgTxt=\
2877"%s: Directory %s does not exist."
2878    ;;
2879
2880    575 ) msgTxt=\
2881"%s: The GPFS release level could not be determined on nodes:\n%s"
2882    ;;
2883
2884    576 ) msgTxt=\
2885"%s: The GPFS release level could not be determined on any of the nodes."
2886    ;;
2887
2888    577 ) msgTxt=\
2889"%s: Ensure the nodes are available and run:\n%s"
2890    ;;
2891
2892    578 ) msgTxt=\
2893"%s: Upgrade the lower release level nodes and run:\n%s"
2894    ;;
2895
2896    579 ) msgTxt=\
2897"%s: The GPFS release level in effect for the cluster remains unchanged.\n"\
2898"     Old level: %s (Release %s)"
2899    ;;
2900
2901    580 ) msgTxt=\
2902"%s: The GPFS release level in effect for the cluster cannot be determined.\n"\
2903"     Assumed: %s (Release %s)"
2904    ;;
2905
2906    581 ) msgTxt=\
2907"%s: The GPFS release level in effect for the cluster will be changed.\n"\
2908"     Old level: %s (Release %s)   New level: %s (Release %s)"
2909    ;;
2910
2911    582 ) msgTxt=\
2912"%s: The cluster contains nodes that are at different GPFS release levels.\n"\
2913"     Lowest level: %s (Release %s)  Highest level: %s (Release %s)"
2914    ;;
2915
2916    583 ) msgTxt=\
2917"%s: -V option requires all nodes in the cluster to be at the same GPFS release level."
2918    ;;
2919
2920    585 ) msgTxt=\
2921"%s: Not able to associate %s on node %s with any known GPFS disk."
2922    ;;
2923
2924    587 ) msgTxt=\
2925"%s: Unable to resolve address range for disk %s on node %s."
2926    ;;
2927
2928
2929    # Message numbers above 1000 are in message set 60 (ts/fencing/fencing.msg).
2930
2931    1000 ) msgTxt=\
2932"%s: Could not clear fencing for disk %s."
2933    ;;
2934
2935    1001 ) msgTxt=\
2936"%s: tspreemptabort of disk %s for nodes %s failed."
2937    ;;
2938
2939    1002 ) msgTxt=\
2940"%s: Disk %s of type %s is not supported for fencing."
2941    ;;
2942
2943    1003 ) msgTxt=\
2944"%s: Unable to fence in node %s for disk %s."
2945    ;;
2946
2947    1004 ) msgTxt=\
2948"%s: None of the specified nodes belong to this GPFS cluster."
2949    ;;
2950
2951    1005 ) msgTxt=\
2952"%s: A node cannot fence itself in."
2953    ;;
2954
2955    1006 ) msgTxt=\
2956"%s: varyonLocalVolume:  tsprregister was unable to unfence disk %s."
2957    ;;
2958
2959    1007 ) msgTxt=\
2960"%s: Unable to display fencing for disk %s."
2961    ;;
2962
2963    1008 ) msgTxt=\
2964"%s: For the logical volume specification \"-l %s\" to be valid\n"\
2965"%s must be the only logical volume in the volume group.\n"\
2966"However, volume group %s contains logical volumes."
2967    ;;
2968
2969    1009 ) msgTxt=\
2970"%s: %s is not a valid logical volume."
2971    ;;
2972
2973    1010 ) msgTxt=\
2974"%s: %s is not a valid volume group name."
2975    ;;
2976
2977    1011 ) msgTxt=\
2978"%s: For the hdisk specification \"-h %s\" to be valid\n"\
2979"%s must be the only disk in the volume group.\n"\
2980"However, volume group %s contains disks"
2981    ;;
2982
2983    1012 ) msgTxt=\
2984"%s: %s is not a valid physical volume name."
2985    ;;
2986
2987    1013 ) msgTxt=\
2988"%s: %s is not a valid physical volume id."
2989    ;;
2990
2991    1014 ) msgTxt=\
2992"%s: Node %s does not have access to disk %s."
2993    ;;
2994
2995    1015 ) msgTxt=\
2996"%s: Node %s does not hold a reservation for disk %s."
2997    ;;
2998
2999    1016 ) msgTxt=\
3000"%s: SSA fencing support is not present on this node."
3001    ;;
3002
3003    1017 ) msgTxt=\
3004"%s: Node ID %s is not a valid SSA node ID.\n"\
3005"SSA node IDs must be a number in the range of 1 to 128."
3006    ;;
3007
3008    1024 ) msgTxt=\
3009"%s: The SSA node id is not set."
3010    ;;
3011
3012    1025 ) msgTxt=\
3013"%s: Unable to retrieve the SSA node id."
3014    ;;
3015
3016    1026 ) msgTxt=\
3017"%s: Unable to set fencing for disk %s."
3018    ;;
3019
3020    1027 ) msgTxt=\
3021"%s: Unable to clear PR reservations for disk %s."
3022    ;;
3023
3024    *   )  # unknown message, ignore it.
3025      return 0
3026    ;;
3027
3028  esac
3029
3030  # Message numbers below 1000 are in message set 32 (ts/admin/admin.msg).
3031  # Message numbers above 1000 are in message set 60 (ts/fencing/fencing.msg).
3032  if [[ $msgNo -lt 1000 ]]
3033  then
3034    msgSet=32
3035  else
3036    msgSet=60
3037  fi
3038
3039  if [[ $osName = AIX ]]
3040  then
3041    # Print the message - extra arguments are ignored.
3042    if [[ $printTimeStamp = yes ]]
3043    then
3044      print -u2 -- "$(date) $($dspmsg -s $msgSet mmfs.cat \
3045        $msgNo "$msgTxt" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9")"
3046    else
3047      print -u2 -- "$($dspmsg -s $msgSet mmfs.cat \
3048        $msgNo "$msgTxt" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9")"
3049    fi
3050
3051  elif [[ $osName = Linux ]]
3052  then
3053    # Print the message - extra arguments are ignored.
3054    if [[ $printTimeStamp = yes ]]
3055    then
3056      print -u2 -- "$(date) $($mmdspmsg -s $msgSet mmfs.cat \
3057        $msgNo "$msgTxt" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9")"
3058    else
3059      print -u2 -- "$($mmdspmsg -s $msgSet mmfs.cat \
3060        $msgNo "$msgTxt" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9")"
3061    fi
3062  else
3063    checkForErrors "Unknown operating system $osName" 1
3064  fi
3065
3066}  #----- end of function printErrorMsg --------------------------
3067
3068
3069##########################################################################
3070#
3071# Function:  Prints a syntax-related message, optionally followed
3072#            by usage message, and terminates the command
3073#
3074# Input:     $1 - indicator for the type of error
3075#            $2 - number of the usage message to issue;
3076#                 if 0, usage message is not printed
3077#            $3, $4, etc. - substitute parameters for the message
3078#
3079# Output:    Syntax-related message
3080#
3081# Returns:   No return.  The function invokes the cleanupAndExit routine.
3082#
3083# Note:      The usage message is assumed to have only one substitute
3084#            parameter, the command name.  The command name is allowed
3085#            to appear more than once in the usage statement.
3086#
3087##########################################################################
3088function syntaxError  # <reason> <usageMsg> [<sub1> [<sub2>...]]
3089{
3090  typeset sourceFile="mmglobfuncs.sh"
3091  [[ -n $DEBUG || -n $DEBUGsyntaxError ]] && set -x
3092  $mmTRACE_ENTER "$*"
3093  typeset reason=$1
3094  typeset usageMsg=$2
3095  typeset sub1="$3"
3096  typeset sub2="$4"
3097  typeset sub3="$5"
3098  typeset sub4="$6"
3099  typeset sub5="$7"
3100
3101  # Print the appropriate message.
3102  case "$reason"
3103  in
3104    "multiple")        # Parameter specified more than once.
3105       printErrorMsg 36 "$mmcmd" "$sub1"
3106       ;;
3107
3108    "missingArgs")     # Missing arguments.
3109       printErrorMsg 168 "$mmcmd"
3110       ;;
3111
3112    "missingValue")    # Missing required value after flag.
3113       printErrorMsg 204 "$mmcmd" "$sub1"
3114       ;;
3115
3116    "missingFile")     # Missing disk descriptor file.
3117       printErrorMsg 41 "$mmcmd"
3118       ;;
3119
3120    "extraArg")        # Unexpected extra argument.
3121       printErrorMsg 38 "$mmcmd" "$sub1"
3122       ;;
3123
3124    "invalidOption")   # Incorrect option.
3125       printErrorMsg 13 "$mmcmd" "$sub1"
3126       ;;
3127
3128    "invalidCombination")  # Invalid combination of options.
3129       printErrorMsg 191 "$mmcmd" "$sub1" "$sub2"
3130       ;;
3131
3132    "YesNoValue")      # Invalid yes|no parameter.
3133       printErrorMsg 37 "$mmcmd" "$sub1"
3134       ;;
3135
3136    "keyword")         # Invalid keyword specified.
3137       printErrorMsg 133 "$mmcmd" "$sub1"
3138       ;;
3139
3140    "invalidInt")      # Invalid parameter - must be an integer.
3141       printErrorMsg 40 "$mmcmd" "$sub1" "$sub2"
3142       ;;
3143
3144    "cannotOpenFile")  # unable to open file.
3145       printErrorMsg 43 "$mmcmd" "$sub1"
3146       ;;
3147
3148    "negativeInt" )    # Invalid parameter - must be positive integer.
3149       printErrorMsg 45 "$mmcmd" "$sub1" "$sub2"
3150       ;;
3151
3152    "invalidRange")    # Invalid range.
3153       printErrorMsg 78 "$mmcmd" "$sub1" "$sub2" "$sub3" "$sub4"
3154       ;;
3155
3156    "absolutePath")    # Parameter must be an absolute path name.
3157       printErrorMsg 148 "$mmcmd" "$sub1"
3158       ;;
3159
3160    "absolutePath_2")  # Parameter must be an absolute path name.
3161       printErrorMsg 424 "$mmcmd" "$sub1" "$sub2"
3162       ;;
3163
3164    "device1")         # Device name starts with a slash, but not /dev/.
3165       printErrorMsg 169 "$mmcmd" "$sub1"
3166       ;;
3167
3168    "device2")         # Device name contains a slash, but not in column 1.
3169       printErrorMsg 170 "$mmcmd" "$sub1"
3170       ;;
3171
3172    "invalidAttrValuePair")  # Invalid attribute on mmchconfig.
3173       : # No special message, usage will be printed shortly.
3174       ;;
3175
3176    "incorrectSyntax")  # Incorrect syntax.
3177       printErrorMsg 568 "$mmcmd" "$sub1"
3178       ;;
3179
3180    "incorrectRange")  # Incorrect range.
3181       printErrorMsg 569 "$mmcmd" "$sub1" "$sub2"
3182       ;;
3183
3184    "obsoleteOption")  # Invalid (old) option specified.
3185       printErrorMsg 19 "$mmcmd" "$sub1"
3186       ;;
3187
3188    "badSeparator_notSemicolon")  # Must use semi-colon as a separator.
3189       printErrorMsg 62 "$mmcmd"
3190       ;;
3191
3192    "badSeparator_notDash")       # Must use dash as a separator.
3193       printErrorMsg 61 "$mmcmd"
3194       ;;
3195
3196    "help")            # Show the usage message only.
3197       : # Usage will be printed shortly.
3198       ;;
3199
3200    *)                 # unexpected code
3201       : # do nothing
3202       ;;
3203
3204  esac  # end of case "$reason"
3205
3206  # If necessary, print the usage statement.
3207  if [[ $usageMsg -ne 0 ]]
3208  then
3209    # Some usage messages put out the command name more than once.
3210    if [[ $usageMsg = 287 || $usageMsg = 301 || $usageMsg = 374 ||
3211          $usageMsg = 390 || $usageMsg = 413 || $usageMsg = 421 ||
3212          $usageMsg = 425 || $usageMsg = 452 || $usageMsg = 458 ||
3213          $usageMsg = 566 ]]
3214    then
3215      printErrorMsg $usageMsg "$mmcmd" "$mmcmd"
3216
3217    elif [[ $usageMsg = 484 ]]
3218    then
3219      printErrorMsg $usageMsg "$mmcmd" "$mmcmd" "$mmcmd"
3220
3221    elif [[ $usageMsg = 385 || $usageMsg = 388 ]]
3222    then
3223      printErrorMsg $usageMsg "$mmcmd" "$mmcmd" "$mmcmd" "$mmcmd"
3224
3225    elif [[ $usageMsg = 359 ]]
3226    then
3227      printErrorMsg $usageMsg "$mmcmd" "$mmcmd" "$mmcmd" "$mmcmd" "$mmcmd"
3228
3229    elif [[ $usageMsg = 249 ]]
3230    then
3231      printErrorMsg $usageMsg "$mmcmd" "$mmcmd" "$mmcmd" "$mmcmd" "$mmcmd" "$mmcmd" "$mmcmd"
3232
3233    else
3234      printErrorMsg $usageMsg "$mmcmd"
3235    fi  # end of if [[ $usageMsg = 287 || ...
3236  fi  # end of if [[ $usageMsg -ne 0 ]]
3237
3238  cleanupAndExit
3239
3240}  #----- end of function syntaxError ----------------------------
3241
3242
3243###########################################################################
3244#
3245# Function:  Called if there is an interrupt before changes are committed.
3246#            Removes temporary files and unlocks the sdr if necessary.
3247#
3248# Input:     None
3249#
3250# Output:    None
3251#
3252# Returns:   Exits with code 2
3253#
3254###########################################################################
3255function pretrap
3256{
3257  typeset sourceFile="mmglobfuncs.sh"
3258  [[ -n $DEBUG || -n $DEBUGpretrap ]] && set -x
3259  $mmTRACE_ENTER "$*"
3260  typeset ec=0
3261
3262  trap "" HUP INT QUIT KILL    # Disable traps so we won't get interrupted.
3263
3264  [[ -z $MMMODE ]] && determineMode
3265
3266  # We come here if an interrupt was received and
3267  # no changes have been made to the sdrfs file.
3268  # Display any buffered error messages that might be there.
3269  [[ -s $errMsg ]] && $cat $errMsg 1>&2
3270  printErrorMsg 20 $mmcmd
3271  $rm -f $GLOBAL_FILES $LOCAL_FILES
3272
3273  if [[ $gpfsLocked = yes ]]
3274  then
3275    setRunningCommand null $primaryServer
3276    ec=$?
3277    if [[ $ec -ne 0 ]]
3278    then
3279      printErrorMsg 171 $mmcmd "function setRunningCommand" $ec
3280    fi
3281  fi
3282
3283  [[ $envLocked = yes ]] && \
3284    freeEnvLock >/dev/null
3285  envLocked=no
3286
3287  [[ $sdrLocked = yes ]] && \
3288    freeLockOnServer $primaryServer $ourNodeNumber >/dev/null
3289  sdrLocked=no
3290
3291  trap - HUP INT QUIT KILL     # Restore interrupts.
3292  exit 2
3293
3294}  #----- end of function pretrap --------------------------------
3295
3296
3297####################################################################
3298#
3299# Function:  Called if there is an interrupt to a command that
3300#            does not change system files.  Removes temporary files
3301#            and unlocks the sdr if necessary.
3302#
3303# Input:     None
3304#
3305# Output:    None
3306#
3307# Returns:   Exits with code 2
3308#
3309####################################################################
3310function pretrap2
3311{
3312  typeset sourceFile="mmglobfuncs.sh"
3313  [[ -n $DEBUG || -n $DEBUGpretrap2 ]] && set -x
3314  $mmTRACE_ENTER "$*"
3315
3316  trap "" HUP INT QUIT KILL    # Disable traps so we can finish this.
3317
3318  [[ -z $MMMODE ]] && determineMode
3319
3320  # Interrupt received.
3321  # Display any buffered error messages that might be there.
3322  [[ -s $errMsg ]] && $cat $errMsg 1>&2
3323  printErrorMsg 306 $mmcmd
3324  $rm -f $GLOBAL_FILES $LOCAL_FILES
3325
3326  [[ $envLocked = yes ]] && \
3327    freeEnvLock >/dev/null
3328  envLocked=no
3329
3330  [[ $sdrLocked = yes ]] && \
3331    freeLockOnServer $primaryServer $ourNodeNumber >/dev/null
3332  sdrLocked=no
3333
3334  trap - HUP INT QUIT KILL     # Restore interrupts.
3335  exit 2
3336
3337}  #----- end of function pretrap2 -------------------------------
3338
3339
3340########################################################################
3341#
3342# Function:  Called if there is an interrupt to a command that
3343#            does not change system files.  Removes temporary files
3344#            and unlocks the sdr if necessary.
3345#
3346#            This silent trap routine is used by mmcommon and mmremote.
3347#
3348# Input:     None
3349#
3350# Output:    None
3351#
3352# Returns:   Exits with code 2
3353#
3354########################################################################
3355function pretrap3
3356{
3357  typeset sourceFile="mmglobfuncs.sh"
3358  [[ -n $DEBUG || -n $DEBUGpretrap3 ]] && set -x
3359  $mmTRACE_ENTER "$*"
3360
3361  trap "" HUP INT QUIT KILL    # Disable traps so we can finish this.
3362
3363  [[ -z $MMMODE ]] && determineMode
3364
3365  # Interrupt received.
3366  $rm -f $GLOBAL_FILES $LOCAL_FILES
3367
3368  [[ $envLocked = yes ]] && \
3369    freeEnvLock >/dev/null
3370  envLocked=no
3371
3372  [[ $sdrLocked = yes ]] && \
3373    freeLockOnServer $primaryServer $ourNodeNumber >/dev/null
3374  sdrLocked=no
3375
3376  trap - HUP INT QUIT KILL     # Restore interrupts.
3377  exit 2
3378
3379}  #----- end of function pretrap3 -------------------------------
3380
3381
3382###########################################################################
3383#
3384# Function:  Called if there is an interrupt after changes were committed.
3385#            Removes temporary files and unlocks the sdr if necessary.
3386#
3387# Input:     None
3388#
3389# Output:    None
3390#
3391# Returns:   Exits with code 2
3392#
3393###########################################################################
3394function posttrap
3395{
3396  typeset sourceFile="mmglobfuncs.sh"
3397  [[ -n $DEBUG || -n $DEBUGposttrap ]] && set -x
3398  $mmTRACE_ENTER "$*"
3399  typeset ec=0
3400
3401  trap "" HUP INT QUIT KILL    # Disable traps so we can finish this.
3402
3403  [[ -z $MMMODE ]] && determineMode
3404
3405  # Interrupt received: changes not propagated.
3406  # Display any buffered error messages that might be there.
3407  [[ -s $errMsg ]] && $cat $errMsg 1>&2
3408  printErrorMsg 32 $mmcmd
3409  $rm -f $GLOBAL_FILES $LOCAL_FILES
3410
3411  if [[ $gpfsLocked = yes ]]
3412  then
3413    setRunningCommand null $primaryServer
3414    ec=$?
3415    if [[ $ec -ne 0 ]]
3416    then
3417      printErrorMsg 171 $mmcmd "function setRunningCommand" $ec
3418    fi
3419  fi
3420
3421  [[ $envLocked = yes ]] && \
3422    freeEnvLock >/dev/null
3423  envLocked=no
3424
3425  [[ $sdrLocked = yes ]] && \
3426    freeLockOnServer $primaryServer $ourNodeNumber >/dev/null
3427  sdrLocked=no
3428
3429  trap - HUP INT QUIT KILL     # Restore interrupts.
3430  exit 2
3431
3432}  #----- end of function posttrap -------------------------------
3433
3434
3435####################################################################
3436#
3437# Function:  This function must be called before a command exits,
3438#            either because of an unrecoverable error, or because
3439#            processing is completed.  The caller must issue all
3440#            error messages prior to calling this function.
3441#
3442#            This function does not return to its caller.
3443#
3444# Input:     $1 (optional) return code value to be used
3445#            $2 (optional) indicator not to unlock the sdr
3446#
3447# Output:    None
3448#
3449# Returns:   Default exit code is 1 unless a different value
3450#            is passed as a first parameter.
3451#
3452####################################################################
3453function cleanupAndExit  #  [ <rc> ]  [ doNotUnlock ]
3454{
3455  typeset sourceFile="mmglobfuncs.sh"
3456  [[ -n $DEBUG || -n $DEBUGcleanupAndExit ]] && set -x
3457  $mmTRACE_ENTER "$*"
3458  typeset doNotUnlock=$2
3459  typeset rc=1
3460  typeset ec=0
3461
3462  [[ -n $1 ]] && rc=$1
3463
3464  trap "" HUP INT QUIT KILL    # Disable traps so we can finish this.
3465
3466  if [[ $gpfsLocked = yes && -z $doNotUnlock ]]
3467  then
3468    setRunningCommand null $primaryServer
3469    ec=$?
3470    if [[ $ec -ne 0 ]]
3471    then
3472      printErrorMsg 171 $mmcmd "function setRunningCommand" $ec
3473    fi
3474  fi
3475
3476  if [[ $envLocked = yes && -z $doNotUnlock ]]
3477  then
3478    freeEnvLock > /dev/null
3479    envLocked=no
3480  fi
3481
3482  if [[ $sdrLocked = yes && -z $doNotUnlock ]]
3483  then
3484    freeLockOnServer $primaryServer $ourNodeNumber >/dev/null
3485    sdrLocked=no
3486  fi
3487
3488  [[ $getCredCalled = yes ]] &&  \
3489    freeCred
3490
3491  $rm -f $GLOBAL_FILES $LOCAL_FILES >/dev/null 2>&1
3492
3493  $mmTRACE_EXIT "rc=$rc"
3494  exit $rc
3495
3496}  #----- end of function cleanupAndExit -------------------------
3497
3498
3499####################################################################
3500#
3501# Function:  Verifies that a command executed successfully.
3502#            If the return code from the command is not zero,
3503#            the function issues a message, performs cleanup,
3504#            and stops processing.
3505#
3506# Input:     $1 - name of the command to check
3507#            $2 - return code from the execution of the command
3508#
3509# Output:    None
3510#
3511# Returns:   0 - command finished successfully
3512#            If error, no return; processing is stopped.
3513#
3514####################################################################
3515function checkForErrors  # <command> <rc>
3516{
3517  if [ $2 != "0" ]
3518  then
3519    # Unexpected error
3520    printErrorMsg 171 "$mmcmd" "$1" $2
3521    cleanupAndExit
3522  fi
3523
3524}  #----- end of function checkForErrors -------------------------
3525
3526
3527####################################################################
3528#
3529# Function:  Issue message 278 (corrupted mmsdrfs file).
3530#            Invoke cleanupAndExit to terminate the command.
3531#
3532# Input:     $1 - point of failure code
3533#            $2 - (optional) mmsdrfs line in error
3534#
3535# Output:    Message 278, followed by the line in error.
3536#
3537# Returns:   No return
3538#
3539####################################################################
3540function corruptedSdrFileExit  # <errCode> [ <lineInError> ]
3541{
3542  typeset errCode=$1
3543  typeset lineInError=$2
3544
3545  printErrorMsg 278 $mmcmd  $errCode
3546  [[ -n $lineInError ]] && \
3547    print -u2 "$lineInError"
3548  cleanupAndExit $errCode
3549
3550}  #----- end of function corruptedSdrFileExit -------------------
3551
3552
3553#####################################################################
3554#
3555# Function:  Verifies that the value of an attribute is an integer.
3556#            If the value ends with a suffix k, K, m, M, g or G, it is
3557#            converted to a simple integer.  If min and max values
3558#            are specified, the function verifies that the attribute
3559#            value is within that range.
3560#
3561# Input:     $1 - attribute name (needed for messages)
3562#            $2 - attribute value
3563#            $3 - minimum allowed value (optional)
3564#            $4 - maximum allowed value (optional)
3565#
3566# Output:    The converted attribute value
3567#
3568# Returns:   0 - Attribute value is legitimate
3569#            1 - (via cleanupAndExit) Attribute value is not valid
3570#
3571#####################################################################
3572function checkIntRange  # <attr> <value> [<min> <max>]
3573{
3574  typeset sourceFile="mmglobfuncs.sh"
3575  [[ -n $DEBUG || -n $DEBUGcheckIntRange ]] && set -x
3576  $mmTRACE_ENTER "$*"
3577  typeset attribute=$1
3578  typeset attrValue=$2
3579  typeset minValue=$3
3580  typeset maxValue=$4
3581
3582  typeset -l value=$attrValue
3583  typeset -l low=$minValue
3584  typeset -l high=$maxValue
3585  typeset rc=0
3586  typeset -i result min max
3587
3588  # Verify that the input value is an integer.
3589  # Convert if value has a k, K, m, M, g or G suffix.
3590  if [[ $value = k || $value = m || $value = g ]]
3591  then
3592    rc=1
3593  elif [[ $value != ${value%g} ]]
3594  then
3595    [[ -z ${value%%*([0-9])g} ]] && result=${value%g}*1073741824 || rc=1
3596  elif [[ $value != ${value%m} ]]
3597  then
3598    [[ -z ${value%%*([0-9])m} ]] && result=${value%m}*1048576 || rc=1
3599  elif [[ $value != ${value%k} ]]
3600  then
3601    [[ -z ${value%%*([0-9])k} ]] && result=${value%k}*1024 || rc=1
3602  else
3603    [[ -z ${value%%*([0-9])} ]] && result=$value || rc=1
3604  fi
3605
3606  if [[ $rc -ne 0 ]]
3607  then
3608    # Invalid integer
3609    printErrorMsg 40 $mmcmd "$attribute" "$attrValue"
3610    cleanupAndExit
3611  fi
3612
3613  # If range checking required, account for any k, K, m, or M suffixes.
3614  if [[ -n $minValue ]]
3615  then
3616    # Account for any k, K, m, or M suffixes in minValue or maxValue.
3617    # Since these are not user input, there should be no errors.
3618    if [[ $low != ${low%m} ]]
3619    then
3620      [[ -z ${low%%*([0-9])m} ]] && min=${low%m}*1048576 || rc=1
3621    elif [[ $low != ${low%k} ]]
3622    then
3623      [[ -z ${low%%*([0-9])k} ]] && min=${low%k}*1024 || rc=1
3624    else
3625      [[ -z ${low%%*([0-9])} ]] && min=$low || rc=1
3626    fi
3627    checkForErrors checkIntRange_min $rc
3628  fi  # end if [[ -n $minValue ]]
3629
3630  if [[ -n $maxValue ]]
3631  then
3632    if [[ $high != ${high%m} ]]
3633    then
3634      [[ -z ${high%%*([0-9])m} ]] && max=${high%m}*1048576 || rc=1
3635    elif [[ $high != ${high%k} ]]
3636    then
3637      [[ -z ${high%%*([0-9])k} ]] && max=${high%k}*1024 || rc=1
3638    else
3639      [[ -z ${high%%*([0-9])} ]] && max=$high || rc=1
3640    fi
3641    checkForErrors checkIntRange_max $rc
3642  fi  # end if [[ -n $maxValue ]]
3643
3644  # Ensure that value is within the specified range.
3645  if [[ -n $maxValue ]]
3646  then
3647    # Make sure that value is within the specified range.
3648    if [[ $result -lt $min || $result -gt $max ]]
3649    then
3650      # Value is out of range.
3651      printErrorMsg 78 $mmcmd "$attribute" "$minValue" "$maxValue" "$attrValue"
3652      cleanupAndExit
3653    fi
3654  elif [[ -n $minValue ]]
3655  then
3656    # Make sure that value is greater than the minimum required.
3657    if [[ $result -lt $min ]]
3658    then
3659      # Value is out of range.
3660      printErrorMsg 97 $mmcmd "$attribute" "$minValue" "$attrValue"
3661      cleanupAndExit
3662    fi
3663  else
3664    : # nothing to do.
3665  fi  # end if [[ -n $maxValue ]]
3666
3667  # Everything looks OK, return the result.
3668  print -- "$result"
3669  return 0
3670
3671}  #----- end of function checkIntRange --------------------------
3672
3673
3674###############################################################################
3675#
3676# Function:  Check that a name does not violate any of the naming rules
3677#            about length or prohibited characters.
3678#
3679# Input:     nameType   - type of name being checked
3680#            maxLength  - maximum length of the name
3681#            name       - name to be checked
3682#
3683# Output:    none
3684#
3685# Returns:   0 if the name is ok; non-zero otherwise
3686#
3687###############################################################################
3688function checkName  # <nameType> <maxLength> <name>
3689{
3690  typeset sourceFile="mmglobfuncs.sh"
3691  [[ -n $DEBUG || -n $DEBUGcheckName ]] && set -x
3692  $mmTRACE_ENTER "$*"
3693
3694  typeset nameType=$1
3695  typeset maxLength=$2
3696  typeset name="$3"
3697
3698  typeset length
3699  typeset bannedFromAllNames=',:;   "'  # includes blank and a tab char
3700  typeset bannedFromDeviceNames=']/?$&*()'
3701  typeset bannedFromDiskNames='].<>{}/\?`~!@#$%^&*()+=\\-'
3702  typeset rc=0
3703
3704  # Return with success if the passed name is null.
3705  [[ -z $name ]] && return 0
3706
3707  # Return with a non-zero return code if the name is too long.
3708  length=${#name}
3709  if [[ length -gt maxLength ]]
3710  then
3711    # The name is too long.
3712    printErrorMsg 548 $mmcmd '"'"$name"'"' $maxLength
3713    return 1
3714  fi
3715
3716  # If only checking the length of the string, we are done.
3717  [[ $nameType = lengthCheckOnly ]] && return 0
3718
3719  # Check if any of the common banned characters are present in the name;
3720  # the single-quote character must be tested for explicitly.
3721  [[ "$name" = *+([${bannedFromAllNames}])* || "$name" = *"'"* ]] && rc=1
3722
3723  # Additional, name-specific checking.
3724  case $nameType in
3725    poolName | junctionName | filesetName )
3726        [[ "$name" = *+([${bannedFromDeviceNames}])* || "$name" = *"["* ]] &&  \
3727          rc=1
3728        ;;
3729
3730    deviceName )
3731        [[ "${name##+(/)dev+(/)}" = *+([${bannedFromDeviceNames}])* || "$name" = *"["* ]] &&  \
3732          rc=1
3733        ;;
3734
3735    diskName )
3736        [[ "$name" = *+([${bannedFromDiskNames}])* || "$name" = *"["* ]] &&  \
3737          rc=1
3738        ;;
3739
3740    * )  : # The name must be OK.
3741        ;;
3742  esac  # end of case $nameType in
3743
3744  # If a banned character was found, issue an appropriate message.
3745  if [[ $rc -ne 0 ]]
3746  then
3747    case $name in
3748      *\[* )  printErrorMsg 189 $mmcmd '"'"$name"'"' '['  ;;
3749      *\]* )  printErrorMsg 189 $mmcmd '"'"$name"'"' ']'  ;;
3750      *\.* )  printErrorMsg 189 $mmcmd '"'"$name"'"' '.'  ;;
3751      *\<* )  printErrorMsg 189 $mmcmd '"'"$name"'"' '<'  ;;
3752      *\>* )  printErrorMsg 189 $mmcmd '"'"$name"'"' '>'  ;;
3753      *\{* )  printErrorMsg 189 $mmcmd '"'"$name"'"' '{'  ;;
3754      *\}* )  printErrorMsg 189 $mmcmd '"'"$name"'"' '}'  ;;
3755      *\/* )  printErrorMsg 189 $mmcmd '"'"$name"'"' '/'  ;;
3756      *\?* )  printErrorMsg 189 $mmcmd '"'"$name"'"' '?'  ;;
3757      *\`* )  printErrorMsg 189 $mmcmd '"'"$name"'"' '`'  ;;
3758      *\~* )  printErrorMsg 189 $mmcmd '"'"$name"'"' '~'  ;;
3759      *\!* )  printErrorMsg 189 $mmcmd '"'"$name"'"' '!'  ;;
3760      *\@* )  printErrorMsg 189 $mmcmd '"'"$name"'"' '@'  ;;
3761      *\#* )  printErrorMsg 189 $mmcmd '"'"$name"'"' '#'  ;;
3762      *\$* )  printErrorMsg 189 $mmcmd '"'"$name"'"' '$'  ;;
3763      *\%* )  printErrorMsg 189 $mmcmd '"'"$name"'"' '%'  ;;
3764      *\^* )  printErrorMsg 189 $mmcmd '"'"$name"'"' '^'  ;;
3765      *\&* )  printErrorMsg 189 $mmcmd '"'"$name"'"' '&'  ;;
3766      *\** )  printErrorMsg 189 $mmcmd '"'"$name"'"' '*'  ;;
3767      *\(* )  printErrorMsg 189 $mmcmd '"'"$name"'"' '('  ;;
3768      *\)* )  printErrorMsg 189 $mmcmd '"'"$name"'"' ')'  ;;
3769      *\+* )  printErrorMsg 189 $mmcmd '"'"$name"'"' '+'  ;;
3770      *\-* )  printErrorMsg 189 $mmcmd '"'"$name"'"' '-'  ;;
3771      *\=* )  printErrorMsg 189 $mmcmd '"'"$name"'"' '='  ;;
3772      *\,* )  printErrorMsg 189 $mmcmd '"'"$name"'"' ','  ;;
3773      *\:* )  printErrorMsg 189 $mmcmd '"'"$name"'"' ':'  ;;
3774      *\;* )  printErrorMsg 189 $mmcmd '"'"$name"'"' ';'  ;;
3775      *\"* )  printErrorMsg 189 $mmcmd '"'"$name"'"' "\"" ;;
3776      *\'* )  printErrorMsg 189 $mmcmd '"'"$name"'"' "'"  ;;
3777      *\\* )  printErrorMsg 189 $mmcmd '"'"$name"'"' '\'  ;;
3778      *\ * )  printErrorMsg 189 $mmcmd '"'"$name"'"' 'blank character' ;;
3779      *\  * )  printErrorMsg 189 $mmcmd '"'"$name"'"' 'tab character' ;;
3780    esac  # end of case $name in
3781  fi  # end of if [[ $rc -ne 0 ]]
3782
3783  return $rc
3784
3785}  #----- end of function checkName ------------------------------
3786
3787
3788#########################################################################
3789#
3790# Function:  Verify that the user-supplied input file exists and
3791#            is not empty.  Rewrite the file to ensure there are
3792#            no carriage-return characters and that it contains
3793#            a newline character at the end of the file.
3794#
3795# Input:     $1 - name of the user-supplied input file
3796#            $2 - name of the file to create
3797#
3798# Output:    None explicit.
3799#
3800# Returns:   0  - file is ok and successfully rewritten
3801#            non-zero - file does not exist, empty or unexpected error
3802#
3803#########################################################################
3804function checkUserFile  # <inputFilename> <newFile>
3805{
3806  typeset sourceFile="mmglobfuncs.sh"
3807  [[ -n $DEBUG || -n $DEBUGcheckUserFile ]] && set -x
3808  typeset inputFile=$1
3809  typeset newFile=$2
3810
3811  typeset operands
3812
3813  # Verify input parameters.
3814  if [[ $# -lt 2 ]]
3815  then
3816    operands="<inputFilename> <newFile>"
3817    printErrorMsg 260 checkIntRange "$operands"
3818    cleanupAndExit
3819  fi
3820
3821  # Ensure the file exists and is not empty.
3822  if [[ ! -r $inputFile ]]
3823  then
3824    # We cannot open the file.
3825    printErrorMsg 43 $mmcmd $inputFile
3826    return 1
3827  fi
3828  if [[ ! -s $inputFile ]]
3829  then
3830    # File is empty.
3831    printErrorMsg 329 $mmcmd $inputFile
3832    return 1
3833  fi
3834
3835  # Remove any carriage-return chareacters.
3836  # If the source and target file names are identical,
3837  # create a local working copy first.
3838  if [[ $inputFile = $newFile ]]
3839  then
3840    $cp $inputFile $tmpfile
3841    checkForErrors "checkUserFile: cp $inputFile $tmpfile" $?
3842    LC_ALL=C $tr -d "\r" < $tmpfile > $newFile
3843    checkForErrors "checkUserFile: tr -d <$tmpfile >$newFile" $?
3844    $rm -f $tmpfile
3845  else
3846    LC_ALL=C $tr -d "\r" < $inputFile > $newFile
3847    checkForErrors "checkUserFile: tr -d <$inputFile >$newFile" $?
3848  fi
3849
3850  # If necessary, add a newline character at the end of the file.
3851  if [[ $(LC_ALL=C $tail -c 1 $newFile) != $(printf "\n") ]]
3852  then
3853    printf "\n" >> $newFile
3854    checkForErrors "writing to file $newFile" $?
3855  fi
3856
3857  return 0
3858
3859}  #----- end of function checkUserFile ------------------
3860
3861
3862#############################################################################
3863#
3864# Function:  Determine what mode we are in (lc, single, ... ) and initialize
3865#            some global variables (primaryServer, backupServer, ... ).
3866#
3867# Input:     none
3868#
3869# Output:    The MMMODE environment variable is set to reflect mode.
3870#            The primaryServer and backupServer global variables are set.
3871#            The remote shell and file copy commands are reset to the user
3872#            specified path names.
3873#
3874# Returns:   0 in all cases
3875#
3876#############################################################################
3877function determineMode
3878{
3879  typeset sourceFile="mmglobfuncs.sh"
3880  [[ -n $DEBUG || -n $DEBUGdetermineMode ]] && set -x
3881  $mmTRACE_ENTER "$*"
3882  typeset versionLine=""
3883  typeset mmmode rshPath rcpPath
3884
3885  if [[ -f $mmsdrfsFile ]]
3886  then
3887    # If the mmsdrfs file exists, parse the file's version line.
3888    versionLine=$($head -1 $mmsdrfsFile)
3889    IFS=':'
3890    set -f ; set -- $versionLine ; set +f
3891    IFS="$IFS_sv"
3892
3893    # Perform a quick sanity check.
3894    [[ $2 != 00_VERSION_LINE ]] &&  \
3895      corruptedSdrFileExit 127 "$versionLine"
3896
3897    # Retrieve the cluster type and other values.
3898    mmmode=$8
3899    primaryServer=$9
3900    backupServer=${10}
3901    rshPath=${12}
3902    rcpPath=${13}
3903    if [[ -n $rshPath && $rshPath != "_DEFAULT_" ]]
3904    then
3905      rsh="$rshPath"
3906      export GPFS_rshPath="$rshPath"
3907    fi
3908    if [[ -n $rcpPath && $rcpPath != "_DEFAULT_" ]]
3909    then
3910      rcp="$rcpPath"
3911      export GPFS_rcpPath="$rcpPath"
3912    fi
3913    environmentType=${15}
3914    [[ -z $environmentType ]] && environmentType=$mmmode
3915    [[ $mmmode != $environmentType && $environmentType != lc2 ]] && \
3916      environmentType="rpd"
3917
3918  else
3919    # Otherwise, we have no idea what to do.
3920    mmmode=""
3921    environmentType=""
3922    # Unknown GPFS execution environment
3923    printErrorMsg 338 $mmcmd $mmmode
3924    cleanupAndExit
3925
3926  fi  #  end if [[ -f $mmsdrfsFile ]]
3927
3928  # Make the environment variables globally available.
3929  export MMMODE=$mmmode
3930  export environmentType=$environmentType
3931
3932  return 0
3933
3934}  #----- end of function determineMode --------------------------
3935
3936
3937#############################################################################
3938#
3939# Function:  Determine the value of the specified mmfs.cfg parameter.
3940#
3941# Input:     $1 - mmfs.cfg parameter name.
3942#            The rest of the parameters are optional.
3943#            $2 - check daemon indicator.  If the value is "yes" or
3944#                 "checkDaemon", the function will first make a tsctl
3945#                 call to determine the value from the running daemon.
3946#                 The default is not to check the daemon.
3947#            $3 - short node name. Default is $ourShortName.
3948#            $4 - mmfs.cfg file to use. Default is /var/mmfs/etc/mmfs.cfg.
3949#
3950# Output:    The value of the mmfs.cfg parameter or null.
3951#
3952# Returns:   0 - worked
3953#            1 - unexpected error
3954#
3955# Examples:  autoload=$(showCfgValue autoload)
3956#            pagepool=$(showCfgValue pagepool checkDaemon $shortName $mmfscfg)
3957#
3958#############################################################################
3959function showCfgValue  # <parmName> [<checkDaemon> [<nodeName> [<cfgFile>]]]
3960{
3961  typeset sourceFile="mmglobfuncs.sh"
3962  [[ -n $DEBUG || -n $DEBUGshowCfgValue ]] && set -x
3963  $mmTRACE_ENTER "$*"
3964
3965  typeset parm=$1
3966  typeset checkDaemon=$2
3967  typeset node=$3
3968  typeset cfgFile=$4
3969
3970  typeset parmValue rc
3971
3972  # Set default values.
3973  [[ $checkDaemon != yes && $checkDaemon != checkDaemon ]] && checkDaemon=""
3974  [[ -z $node ]] && node=$ourShortName
3975  [[ -z $cfgFile ]] && cfgFile=$mmfscfgFile
3976  [[ ! -f $cfgFile ]] && return 1
3977
3978  # If we need to determine the value of the parameter from the currently
3979  # running GPFS daemon, use the tsctl showCfgValue command.  If this fails,
3980  # for whatever reason, determine the value from the specified config file.
3981  # Note that boolean type parameters have different representation in the
3982  # daemon than in the mmfs.cfg file.  It is the callers responsibility to
3983  # do the necessary translation.
3984  if [[ -n $checkDaemon && $node = $ourShortName ]]
3985  then
3986    parmValue=$($tsctl showCfgValue $parm 2>/dev/null)
3987    rc=$?
3988    if [[ -n $parmValue && $rc -eq 0 ]]
3989    then
3990      print -- "$parmValue"
3991      return 0
3992    fi
3993  fi  # end of if [[ -n $checkDaemon ]]
3994
3995  # Find the setting of the parameter from the specified config file.
3996  parmValue=$($awk '                                     \
3997    BEGIN { doNotIgnoreValue = 1 }                       \
3998    # If this is the end of a node-override section,     \
3999    # set the flag to accept parameter values.           \
4000    $1 == "[common]" {                                   \
4001      { doNotIgnoreValue = 1 }                           \
4002      { next }                                           \
4003    }                                                    \
4004    # If this is the start of a node-override section,   \
4005    # see if this section applies to our node.           \
4006    # If yes, we will not ignore subsequent parameters.  \
4007    # If not, subsequent parameters will be ignored.     \
4008    /^\[.*]/ || /^[       ]*\[.*]/ {                     \
4009      if ($1 == "['$node']" || $1 ~ /\['$node',/ ||      \
4010          $1 ~  /,'$node']/ || $1 ~ /,'$node',/)  {      \
4011        { doNotIgnoreValue = 1 }                         \
4012      } else {                                           \
4013        { doNotIgnoreValue = 0 }                         \
4014      }                                                  \
4015      { next }                                           \
4016    }                                                    \
4017    # If this line contains our parameter, save its      \
4018    # value, provided it is applicable to our node.      \
4019    $1 == "'$parm'" && doNotIgnoreValue {                \
4020      { parmValue = $2 }                                 \
4021    }                                                    \
4022    END { print parmValue }                              \
4023  ' $cfgFile)
4024  checkForErrors awk $?
4025
4026  print -- "$parmValue"
4027  return 0
4028
4029}  #----- end of function showCfgValue ---------------------------
4030
4031
4032##############################################################################
4033#
4034# Function:  Given a device name or a mount point, this routine
4035#            returns information about the file system.
4036#
4037# Input:     $1 - file system device name or mount point.
4038#            $2 - name of mmsdrfs file
4039#            $3 - (optional) keyword indicating whether device or
4040#                 mount point is used.  The default is deviceName.
4041#            $4 - (optional) suppress messages flag
4042#
4043# Output:    $1 - fully-qualified device name (/dev/...)
4044#            $2 - short device name (no /dev/ prefix)
4045#            $3 - cluster where the file system is defined
4046#            $4 - name of the remote device (no /dev/ prefix)
4047#            $5 - "odd state" flag indicating whether disks may be in
4048#                   an odd state (this can happen when a disk command
4049#                   did not complete normally); "yes" indicates there
4050#                   may be disks in an odd state, "no" indicates no
4051#            $6 - default mount point for the file system
4052#            $7 - default options string for the mount command
4053#
4054# Returns:   0 - file system found
4055#           19 - file system not found (ENODEV)
4056#           nn - some other unexpected error
4057#
4058##############################################################################
4059function findFS  # <device> <sdrfs> [{deviceName|mountPoint} [<suppressMsg>]]
4060{
4061  typeset sourceFile="mmglobfuncs.sh"
4062  [[ -n $DEBUG || -n $DEBUGfindFS ]] && set -x
4063  $mmTRACE_ENTER "$*"
4064  typeset inputValue=$1
4065  typeset sdrfs=$2
4066  typeset inputType=$3
4067  typeset suppressMsg=$4
4068
4069  typeset rc=0
4070  typeset device deviceName fqDeviceName cluster result remoteDevice
4071  typeset oddState defaultOptions defaultMountPoint
4072
4073  # Determine what type of search this is going to be:
4074  # by device name or by mount point.
4075  if [[ $inputType != mountPoint ]]
4076  then
4077    # Find the file system using its device name.
4078    inputType=deviceName
4079    device=$inputValue
4080    deviceName=${device##+(/)dev+(/)}
4081
4082    # Verify the device name.
4083    if [[ $deviceName = /* ]]
4084    then
4085      # Name starts with a slash, but not /dev/.
4086      [[ -z $suppressMsg ]] && printErrorMsg 169 $mmcmd "$device"
4087      return 1
4088    elif [[ $deviceName = */* ]]
4089    then
4090      # Name contains a slash.
4091      [[ -z $suppressMsg ]] && printErrorMsg 170 $mmcmd "$device"
4092      return 1
4093    else
4094      : # The device name seems to be OK.
4095    fi
4096  else
4097    # Find the file system using its mount point.
4098    mountPoint=$inputValue
4099
4100    # Verify the mount point.
4101    if [[ $mountPoint != /* ]]
4102    then
4103      # Mount point can not be a relative path name.
4104      [[ -z $suppressMsg ]] && printErrorMsg 148 $mmcmd "$mountPoint"
4105      return 1
4106    fi
4107  fi  # end of if [[ $inputType != mountpoint ]]
4108
4109  # Retrieve the needed information for the file system.
4110  result=$($awk -F: '                                                         \
4111    BEGIN {                                                                   \
4112      # Assume the file system does not exist.                                \
4113      { fsFound = 0 }                                                         \
4114    }                                                                         \
4115                                                                              \
4116    $'$LINE_TYPE_Field' == "'$SG_HEADR'" {                                    \
4117      # Starting a new file system.  Save some values in case                 \
4118      # this turns out to be the fs that we are looking for.                  \
4119      if ( $'$REMOTE_DEV_NAME_Field' != "" ) {                                \
4120        { remoteDevName = $'$REMOTE_DEV_NAME_Field' }                         \
4121      } else {                                                                \
4122        { remoteDevName = $'$DEV_NAME_Field' }                                \
4123      }                                                                       \
4124      if ( $'$ODD_STATE_Field' == "" || $'$ODD_STATE_Field' == "no" ) {       \
4125        { oddStateField = "no" }                                              \
4126      } else {                                                                \
4127        { oddStateField = "yes" }                                             \
4128      }                                                                       \
4129      { fsType        = $'$FS_TYPE_Field' }                                   \
4130      { deviceName    = "" }                                                  \
4131      { next }                                                                \
4132    }                                                                         \
4133                                                                              \
4134    $'$LINE_TYPE_Field'   == "'$SG_ETCFS'"         &&                         \
4135    $'$LINE_NUMBER_Field' == "'$MOUNT_POINT_Line'"  {                         \
4136      # This line contains both the device name and the mount point.          \
4137      # Match one of the two fields based on the type of search.              \
4138      if ( search == "deviceName" && $'$DEV_NAME_Field'   == "'$deviceName'" ||   \
4139           search == "mountPoint" && $'$ETCFS_TEXT_Field' == "'$mountPoint'" ) {  \
4140        { homeCluster = $'$NODESETID_Field' }                                 \
4141        { deviceName  = $'$DEV_NAME_Field' }                                  \
4142        { mountPoint  = $'$ETCFS_TEXT_Field' }                                \
4143        { fsFound     = 1 }                                                   \
4144      }                                                                       \
4145      { next }                                                                \
4146    }                                                                         \
4147                                                                              \
4148    $'$LINE_TYPE_Field' == "'$SG_MOUNT'"  &&                                  \
4149    $'$DEV_NAME_Field'  == deviceName      {                                  \
4150      { options = $'$RW_OPT_Field' }                                          \
4151      if ( $'$MTIME_OPT_Field' != "" ) {                                      \
4152        { options = options ","$'$MTIME_OPT_Field' }                          \
4153      }                                                                       \
4154      if ( $'$ATIME_OPT_Field' != "" ) {                                      \
4155        { options = options ","$'$ATIME_OPT_Field' }                          \
4156      }                                                                       \
4157      if ( $'$OTHER_OPT_Field' != "" ) {                                      \
4158        { options = options ","$'$OTHER_OPT_Field' }                          \
4159      }                                                                       \
4160      if ( $'$QUOTA_OPT_Field' != "" ) {                                      \
4161        { options = options ",quota="$'$QUOTA_OPT_Field' }                    \
4162      }                                                                       \
4163      if ( fsType == "'$remotefs'" ) {                                        \
4164        { options = options ",dev="homeCluster":"remoteDevName }              \
4165        { options = options ",ldev="deviceName }                              \
4166      } else {                                                                \
4167        { options = options ",dev="deviceName }                               \
4168      }                                                                       \
4169      { exit }                                                                \
4170    }                                                                         \
4171                                                                              \
4172    END {                                                                     \
4173      # If the file system was found, print the result.                       \
4174      if ( fsFound ) {                                                        \
4175        { print homeCluster   " "                                             \
4176                deviceName    " "                                             \
4177                remoteDevName " "                                             \
4178                oddStateField " "                                             \
4179                mountPoint    " "                                             \
4180                options         }                                             \
4181      }                                                                       \
4182    }                                                                         \
4183  ' search=$inputType $sdrfs)
4184  checkForErrors awk $?
4185
4186  # If nothing was found, print "not found" message (if not suppressed)
4187  # and return.
4188  if [[ -z $result ]]
4189  then
4190    if [[ -z $suppressMsg ]]
4191    then
4192      if [[ $inputType = mountPoint ]]
4193      then
4194        # There is no file system with the specified mount point.
4195        printErrorMsg 279 $mmcmd "$mountPoint"
4196      else
4197        # There is no file system with the specified device name.
4198        printErrorMsg 288 $mmcmd "$device"
4199      fi
4200    fi
4201    return $MM_FsNotFound
4202  fi  # end of if [[ -z $result ]]
4203
4204  # If we are here, the file system exists;
4205  # parse the results of the awk.
4206  set -f ; set -- $result ; set +f
4207  cluster=$1
4208  deviceName=$2
4209  remoteDevice=$3
4210  oddState=$4
4211  defaultMountPoint=$5
4212  defaultOptions=$6
4213
4214  fqDeviceName="/dev/$deviceName"
4215
4216  # Output the data.
4217  print -- $fqDeviceName $deviceName $cluster $remoteDevice \
4218           $oddState $defaultMountPoint $defaultOptions
4219  return 0
4220
4221}  #----- end of function findFS ---------------------------------
4222
4223
4224############################################################################
4225#
4226# Function:  Determine which nodes have the specified file systems mounted.
4227#
4228# Input:     $1 - file system to check or:  all, all_local, or all_remote
4229#            $2 - scope of mount checking (list of cluster names)
4230#            $3 - show output for individual nodes: yes, no, unformatted
4231#            $4 - (optional) assume cached data is current
4232#
4233# Output:    lists of nodes that have the specified file systems mounted
4234#
4235# Returns:   0 - command completed successfully
4236#            non-zero - error encountered
4237#
4238############################################################################
4239function lsmount   # <fsToShow> <scope> <showNodes> [norefresh]
4240{
4241  typeset sourceFile="mmglobfuncs.sh"
4242  [[ -n $DEBUG || -n $DEBUGlsmount ]] && set -x
4243  $mmTRACE_ENTER "$*"
4244  typeset fsToShow="$1"
4245  typeset scope="$2"
4246  typeset showNodes="$3"
4247  typeset -l refreshArg=$4
4248
4249  typeset rc=0
4250  typeset oneCluster=false
4251  typeset hdrlineStripClusterName=no
4252  typeset nodelineStripClusterName=yes
4253  typeset fsToCheck fqDeviceName localDevName deviceName
4254  typeset fsList homeCluster headerMsg clusterName Coption
4255  typeset hdrLine linePrefix localCluster
4256  integer numNodes
4257
4258  # If more than one file system is requested or the file system name
4259  # is not fully-qualified, ensure the local environment is up-to-date
4260  # and generate a list of the file systems.
4261
4262  # Process the file system parameter.
4263  if [[ $fsToShow = all  ||  $fsToShow = all_local ||
4264        $fsToShow = all_remote || $fsToShow != *:* ]]
4265  then
4266    # Either more than one file system is requested,
4267    # or the file system name is not fully-qualified.
4268
4269    # Ensure the local environment is up-to-date.
4270    if [[ $refreshArg != "norefresh" ]]
4271    then
4272      gpfsInitOutput=$(gpfsInit nolock)
4273      setGlobalVar $? $gpfsInitOutput
4274    fi
4275
4276    # Generate a list of the fully-qualified file system names.
4277    fsList=$($awk -F: '                                  \
4278      $'$LINE_TYPE_Field' == "'$SG_HEADR'" {             \
4279        if ( $'$DEV_NAME_Field' == "'$fsToShow'" ) {     \
4280          # This is the file system that we want.        \
4281          # See if the fs is local or remote.            \
4282          if ( $'$FS_TYPE_Field' == "'$remotefs'" ) {    \
4283            { printf $'$NODESETID_Field' ":"             \
4284                     $'$REMOTE_DEV_NAME_Field' ":"       \
4285                     $'$DEV_NAME_Field' }                \
4286          } else {                                       \
4287            { printf ":" $'$DEV_NAME_Field' ":" }        \
4288          }                                              \
4289          # Nothing else to do.                          \
4290          { exit  0 }                                    \
4291        } else if ( "'$fsToShow'" == "all" ) {           \
4292          # We want all file systems, local and remote.  \
4293          if ( $'$FS_TYPE_Field' == "'$remotefs'" ) {    \
4294            { printf $'$NODESETID_Field' ":"             \
4295                     $'$REMOTE_DEV_NAME_Field' ":"       \
4296                     $'$DEV_NAME_Field' "," }            \
4297          } else {                                       \
4298            { printf ":" $'$DEV_NAME_Field' ":," }       \
4299          }                                              \
4300                                                         \
4301        } else if ( "'$fsToShow'" == "all_local" ) {     \
4302          # We want all local file systems.              \
4303          if ( $'$FS_TYPE_Field' == "'$remotefs'" ) {    \
4304            { next }                                     \
4305          } else {                                       \
4306            { printf ":" $'$DEV_NAME_Field' ":," }       \
4307          }                                              \
4308                                                         \
4309        } else if ( "'$fsToShow'" == "all_remote" ) {    \
4310          # We want all remote file systems.             \
4311          if ( $'$FS_TYPE_Field' == "'$remotefs'" ) {    \
4312            { printf $'$NODESETID_Field' ":"             \
4313                     $'$REMOTE_DEV_NAME_Field' ":"       \
4314                     $'$DEV_NAME_Field' "," }            \
4315          } else {                                       \
4316            { next }                                     \
4317          }                                              \
4318        } else {                                         \
4319          { next }                                       \
4320        }                                                \
4321      }                                                  \
4322      END { printf "\n" }                                \
4323    ' $mmsdrfsFile)
4324    checkForErrors awk $?
4325
4326    # Strip trailing commas, if any.
4327    fsList=${fsList%%,}
4328
4329  else
4330    # Only one file system was specified using its fully-qualified name.
4331    fsList=$fsToShow
4332  fi  # end of if [[ $fsToShow = all || $fsToShow = all_local ...
4333
4334  # Return if no file systems were found.
4335  if [[ -z $fsList ]]
4336  then
4337    if [[ $fsToShow = all || $fsToShow = all_local ]]
4338    then
4339      # No file systems were found in the cluster.
4340      printErrorMsg 200 $mmcmd
4341    elif [[ $fsToShow = all_remote ]]
4342    then
4343      # There are no remote file systems.
4344      printErrorMsg 193 $mmcmd
4345    else
4346      # The specified file system was not found.
4347      printErrorMsg 288 $mmcmd "$fsToShow"
4348    fi  # end of if [[ $fsToShow = all || $fsToShow = all_local ]]
4349
4350    # Give up.
4351    return $MM_FsNotFound
4352  fi # #end of if [[ -z $fsList ]]
4353
4354  # If the user did not specify the -C parameter on mmlsmount,
4355  # see if this cluster has knowledge of other clusters or if it
4356  # has granted access to its file systems to remote clusters.
4357  # If neither is true, suppress the cluster name in the output.
4358  if [[ $scope = NULL ]]
4359  then
4360    oneCluster=$($awk -F: '                               \
4361      $'$LINE_TYPE_Field' == "'$AUTHORIZED_CLUSTER'" ||   \
4362      $'$LINE_TYPE_Field' == "'$REM_CLUSTER'"         {   \
4363        { print "false" }                                 \
4364        { exit }                                          \
4365      }                                                   \
4366      END { print "true" }                                \
4367    ' $mmsdrfsFile)
4368    checkForErrors awk $?
4369  fi  # end of if [[ $scope = NULL ]]
4370
4371  if [[ $showNodes = unformatted ]]
4372  then
4373    # Generate and print the header line.
4374    hdrLine="mmlsmount::HEADER:version:reserved:reserved"
4375    hdrLine="${hdrLine}:localDevName:realDevName:owningCluster"
4376    hdrLine="${hdrLine}:totalNodes:nodeIP:nodeName:clusterName"
4377    print -- "${hdrLine}:"
4378
4379    # Generate the prefix for the data lines.
4380    linePrefix="mmlsmount::0:1::"
4381
4382    # Find our cluster name (needed for the unformatted output).
4383    localCluster=$($head -1 $mmsdrfsFile | $GETVALUE $CLUSTER_NAME_Field)
4384  fi  # end of if [[ $showNodes = yes ]]
4385
4386  # Process the list of file systems.
4387  IFS=','
4388  for fsToCheck in $fsList
4389  do
4390    # Parse the information for the file system to be checked.
4391    IFS=':'
4392    set -f ; set -- $fsToCheck ; set +f
4393    homeCluster=$1
4394    deviceName=$2
4395    localDevName=$3
4396
4397    if [[ -z $homeCluster || $homeCluster = $HOME_CLUSTER ]]
4398    then
4399      fqDeviceName="$deviceName"
4400    else
4401      fqDeviceName="${homeCluster}:${deviceName}"
4402    fi
4403
4404    # Process the mount check scope parameter.
4405    IFS=','
4406    for clusterName in $scope
4407    do
4408      IFS="$IFS_sv"
4409
4410      # Determine the value for the -C option on tsstatus.
4411      if [[ $clusterName = all || $clusterName = NULL || $clusterName = $CHECK_ALL ]]
4412      then
4413        Coption=""
4414      else
4415        [[ $clusterName = "."  || $clusterName = all_local ]] &&  \
4416          clusterName=$($head -1 $mmsdrfsFile | $GETVALUE $CLUSTER_NAME_Field)
4417        Coption="-C $clusterName"
4418      fi
4419
4420      # Determine whether to strip the cluster name from the header line
4421      # or from the node lines for each of the possible scenarios.
4422      # The normal case is to have the cluster name on the header line
4423      # and not on the node lines, but the behavior is different if the
4424      # -C was not specified or if a value of all or all_remote was given.
4425      # If -C was not specified and there is only one cluster, we will not
4426      # output cluster names.  If all or all_remote was specified for -C,
4427      # we will not output cluster names on the header line, but we will
4428      # show cluster names on the node lines.
4429      if [[ $clusterName = NULL && $oneCluster = true ]]
4430      then
4431        hdrlineStripClusterName=yes
4432        nodelineStripClusterName=yes
4433      elif [[ $clusterName = NULL       ||
4434              $clusterName = all        ||
4435              $clusterName = all_remote ]]
4436      then
4437        hdrlineStripClusterName=yes
4438        nodelineStripClusterName=no
4439      else
4440        hdrlineStripClusterName=no
4441        nodelineStripClusterName=yes
4442      fi
4443
4444      # Determine whether anybody has the file system mounted.
4445      LC_ALL=C $tsstatus -m $fqDeviceName $Coption >$tmpfile 2>$errMsg
4446      rc=$(remapRC $?)
4447      if [[ $rc -eq 0 ]]
4448      then
4449        # The file system is mounted on at least one of the nodes that
4450        # we care about.  The list of node names is returned by tsstatus.
4451        #
4452        #   Note that the tsstatus output comes from the stripe group
4453        #   manager node which always resides in the cluster that owns
4454        #   the file system.  In the case of remote file systems, the
4455        #   manager node has no knowledge about the local name for the
4456        #   file system.  Therefore, we have to intercept the tsstatus
4457        #   output and replace the header line with one that is more
4458        #   meaningful for the local cluster.  To keep the code simple,
4459        #   we do this for both local and remote file systems.
4460        #
4461        if [[ -s $tmpfile ]]
4462        then
4463          # Determine the number of nodes that have the file system mounted.
4464          # We subtract 2 because tsstatus produces a blank line and a header.
4465          numNodes=$($awk 'END { print NR - 2 }' $tmpfile)
4466
4467          # Generate the output for this file system.
4468          if [[ $showNodes = yes ]]
4469          then
4470            # We come here if a list of the nodes should be shown.
4471            # Construct a message to be used in place of the first line
4472            # in the tsstatus output.  If checking a remote file system,
4473            # the local device name can be passed as a command argument.
4474            if [[ $hdrlineStripClusterName = yes ]]
4475            then
4476              if [[ -n $localDevName ]]
4477              then
4478                headerMsg=$(printInfoMsg 521  \
4479                  "$localDevName" "($fqDeviceName)" "$numNodes")
4480              else
4481                headerMsg=$(printInfoMsg 522 "$fqDeviceName" "$numNodes")
4482              fi
4483            else
4484              if [[ -n $localDevName ]]
4485              then
4486                headerMsg=$(printInfoMsg 477  \
4487                  "$localDevName" "($fqDeviceName)" "$numNodes" "$clusterName")
4488              else
4489                headerMsg=$(printInfoMsg 478  \
4490                  "$fqDeviceName" "$numNodes" "$clusterName")
4491              fi
4492            fi
4493
4494            # Filter the result from the tsstatus command and replace
4495            # the header line with our own version.
4496            $awk '                                                          \
4497              /File system/ && /is managed by node/ && /and mounted on:/ {  \
4498                { print "'"$headerMsg"'" }                                  \
4499                { next }                                                    \
4500              }                                                             \
4501              { if (stripClusterName == "yes") {                            \
4502                  { printf ("  %-15s %s \n", $1, $2) }                      \
4503                } else {                                                    \
4504                  { print $0 }                                              \
4505                }                                                           \
4506              }                                                             \
4507            ' stripClusterName="$nodelineStripClusterName" $tmpfile
4508
4509          elif [[ $showNodes = unformatted ]]
4510          then
4511            # We come here if the information should be presented in
4512            # colon separated fields (mmlsmount -Y).
4513            [[ -z $localDevName ]] && localDevName="$deviceName"
4514            [[ -z $homeCluster  ]] && homeCluster="$localCluster"
4515            $awk '                                                           \
4516              NR > 2 { print "'$linePrefix':'$localDevName':'$deviceName':"  \
4517                             "'$homeCluster':'$numNodes':"$1":"$2":"$3":" }  \
4518            ' $tmpfile
4519
4520          else
4521            # We come here if a list of the nodes is not desired.
4522            # Construct the summary message to be used in place of
4523            # the tsstatus output.  If checking a remote file system,
4524            # the local device name can be passed as a command argument.
4525            if [[ $hdrlineStripClusterName = yes ]]
4526            then
4527              if [[ -n $localDevName ]]
4528              then
4529                printInfoMsg 553 "$localDevName" "($fqDeviceName)" "$numNodes"
4530              else
4531                printInfoMsg 554 "$fqDeviceName" "$numNodes"
4532              fi
4533            else
4534              if [[ -n $localDevName ]]
4535              then
4536                printInfoMsg 479  \
4537                  "$localDevName" "($fqDeviceName)" "$numNodes" "$clusterName"
4538              else
4539                printInfoMsg 480 "$fqDeviceName" "$numNodes" "$clusterName"
4540              fi
4541            fi
4542          fi
4543        else
4544          # tstatus -m returned no data.  This should not be the case here.
4545          # Show error output, if any, and return.
4546          [[ -s $errMsg ]] && $cat $errMsg 1>&2
4547          $rm -f $errMsg
4548
4549          # Unexpected error.
4550          printErrorMsg 171 $mmcmd "function lsmount - no tsstatus output" 1
4551          return 1
4552        fi  # end of if [[ -s $tmpfile ]]
4553
4554      elif [[ $rc -eq 2 ]]
4555      then
4556        # The file system is not mounted on any of the nodes that
4557        # we are interested in.  That's OK, just put out a message.
4558        rc=0
4559        if [[ $showNodes = unformatted ]]
4560        then
4561          # We come here if the information should be presented in
4562          # colon separated fields (mmlsmount -Y).
4563          [[ -z $localDevName ]] && localDevName="$deviceName"
4564          [[ -z $homeCluster  ]] && homeCluster="$localCluster"
4565          print -- "${linePrefix}:${localDevName}:${deviceName}:${homeCluster}:0::::"
4566        elif [[ -n $localDevName ]]
4567        then
4568          if [[ -z $Coption ]]
4569          then
4570            # The file system is not mounted.
4571            printInfoMsg 541 "$localDevName" "($fqDeviceName)"
4572          else
4573            if [[ $clusterName = all_remote ]]
4574            then
4575              # The file system is not mounted in any remote cluster.
4576              printInfoMsg 542 "$localDevName" "($fqDeviceName)"
4577            else
4578              # The file system is not mounted in the specified cluster.
4579              printInfoMsg 543 "$localDevName" "($fqDeviceName)" "$clusterName"
4580            fi
4581          fi
4582        else
4583          if [[ -z $Coption ]]
4584          then
4585            # The file system is not mounted.
4586            printInfoMsg 544 "$fqDeviceName"
4587          else
4588            if [[ $clusterName = all_remote ]]
4589            then
4590              # The file system is not mounted in any remote cluster.
4591              printInfoMsg 545 "$fqDeviceName"
4592            else
4593              # The file system is not mounted in the specified cluster.
4594              printInfoMsg 546 "$fqDeviceName" "$clusterName"
4595            fi
4596          fi
4597        fi  # end of if [[ -n $localDevName ]]
4598
4599      elif [[ $rc -ne $MM_DaemonDown && $rc -ne $MM_QuorumWait ]]
4600      then
4601        # Unexpected error.  Show error output, if any, and continue looping.
4602        if [[ -s $errMsg ]]
4603        then
4604          $cat $errMsg 1>&2
4605        else
4606          [[ $rc -ne 0 ]] &&  \
4607            printErrorMsg 113 "$mmcmd" "tsstatus -m $fqDeviceName $Coption" $rc
4608        fi
4609        $rm -f $errMsg
4610        # Command was unable to determine whether the file system is mounted.
4611        if [[ -n $localDevName ]]
4612        then
4613    printErrorMsg 564 $mmcmd "$localDevName"
4614  else
4615    printErrorMsg 564 $mmcmd "$fqDeviceName"
4616  fi
4617
4618      else
4619        # GPFS is not ready on this node (rc is MM_DaemonDown or MM_QuorumWait).
4620        # Return quietly.
4621        $rm -f $errMsg
4622        return $rc
4623      fi  # end of if [[ $rc -eq 0 ]]
4624
4625      # We were able to successfully determine whether the file
4626      # system is mounted on any node in the current cluster.
4627      # Move to the next cluster in the list.
4628      $rm -f $errMsg
4629      IFS=','
4630    done  # end of for clusterName in $scope
4631
4632    # Move to the next file system.
4633    IFS=','
4634  done  # end of for fsTocheck in $fsList
4635  IFS="$IFS_sv"
4636
4637
4638  # Return to the caller.
4639  return $rc
4640
4641}  #----- end of function lsmount --------------------------------
4642
4643
4644#############################################################################
4645#
4646# Function:  Determine if a remote node can be reached.
4647#
4648# Input:     $1 - node name (may be null)
4649#            Note:  Do not add more input parameters.
4650#                   This function can be called w/o input.
4651#
4652# Output:    None
4653#
4654# Returns:   0 - node can be reached
4655#            1 - node can not be reached
4656#
4657#############################################################################
4658function isNodeReachable  # <nodeName>
4659{
4660  typeset sourceFile="mmglobfuncs.sh"
4661  [[ -n $DEBUG || -n $DEBUGisNodeReachable ]] && set -x
4662  $mmTRACE_ENTER "$*"
4663  typeset nodeName=$1
4664
4665  typeset maxPingCount=3
4666  typeset -i pingTimeout=4
4667  typeset -i pingCount=0
4668  typeset pingRc=1
4669
4670  while [[ $pingRc -ne 0 && $pingCount -lt $maxPingCount ]]
4671  do
4672    (( pingCount += 1 ))
4673    (( pingTimeout += 1 ))
4674    $ping -w $pingTimeout -c 1 $nodeName >/dev/null 2>/dev/null
4675    pingRc=$?
4676#   [[ $pingRc -ne 0 ]] && \
4677#     print -u2 "$mmcmd: ping $nodeName failed ($pingCount); pingRc=$pingRc"
4678  done
4679
4680  return $pingRc
4681
4682}  #----- end of function isNodeReachable ------------------------
4683
4684
4685####################################################################
4686#
4687# Function:  Exec the specified command with the given argv[0]
4688#
4689# Input:     $1 - command path
4690#            $2 - argv[0]
4691#            $3, $4, ... - arguments to pass to the command
4692#
4693# Output:    depends on the executed command
4694#
4695# Returns:   No return if the exec call succeded.
4696#
4697####################################################################
4698function mmexecl  # <cmdpath> <argv0> [ <arg> ... ]
4699{
4700  # First, we attempt to execute the given command with naked exec,
4701  # without involving the shell.  A successful exec never returns.
4702  # If it does return, it means it failed, in which case we attempt
4703  # to execute the program again, this time using sh, to produce an
4704  # error message and an appropriate return code.
4705  $perl -e "{\
4706    \$arg0=\$ARGV[0]; \
4707    shift; \
4708    exec \$arg0 @ARGV; \
4709    exec \"sh -c \$arg0\"; \
4710  }" "$@"
4711
4712  return $?
4713
4714}  #----- end of function mmexecl --------------------------------
4715
Note: See TracBrowser for help on using the repository browser.