source: gpfs_3.1_ker2.6.20/lpp/mmfs/bin/mmchconfig @ 16

Last change on this file since 16 was 16, checked in by rock, 16 years ago
  • Property svn:executable set to *
File size: 180.9 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. 1997,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# @(#)17 1.231.2.15 src/avs/fs/mmfs/ts/admin/mmchconfig.sh, mmfs, avs_rgpfs24, rgpfs24s012a 4/2/07 12:58:05
17################################################################################
18#
19# Usage:  mmchconfig Attribute=value[,Attribute=value...] [-i | -I]
20#                    [-N {Node[,Node...] | NodeFile | NodeClass}]
21#
22# where
23#   -i        specifies immediate.  The change takes place immediately, not
24#             just on the next restart.  This is currently only valid with
25#             a subset of config attributes.
26#
27#   -I        specifies immediate ONLY.  The change takes place immediately
28#             and does not have any effect on the next restart.
29#             This is currently only valid with a subset of config attributes.
30#
31#   -N Node,Node,...  Specify the nodes whose states are to be changed.
32#   -N NodeFile       NodeClass may be one of several possible node classes
33#   -N NodeClass      (e.g., quorumnodes, managernodes, nsdnodes, etc.)
34#                     If none of -N, -n, or nodelist is specified, the entire
35#                     cluster is changed; otherwise, the changes are made to
36#                     the specified nodes.
37#                     Do not use -N to do an update to an omitted node as the
38#                     output is not the same as running without nodefile.
39#                     -N cannot be specified with the obsolete -n or nodelist
40#                     options.
41#
42# Obsolete but still supported options:
43#
44#    -n NodeFile  is a file containing a list of nodes.
45#                 If none of -N, -n, or nodelist is not specified,
46#                 the entire cluster is changed; otherwise, the changes
47#                 are made to the specified nodes.
48#                 Do not use -n NodeFile to do an update to an omitted node
49#                 as the output is not the same as running without -n NodeFile.
50#                 -n cannot be specified with -N or nodelist.
51#
52#    nodelist     is a list of nodes separated by commas.
53#                 If none of -N, -n, or nodelist is not specified,
54#                 the entire cluster is changed; otherwise, the changes
55#                 are made to the specified nodes.
56#                 Do not use nodelist to do an update to an omitted node
57#                 as the output is not the same as running without nodelist.
58#                 nodelist cannot be specified with -N or -n.
59#
60# Notes on attributes:
61#
62#   The attributes that can be changed are divided into two main categories:
63#     - externally-documented attributes
64#     - internal configuration parameters to be used only under the
65#       direction of IBM service
66#
67#   The externally-documented attributes are:
68#
69#     pagepool           specifies the size of the area in the shared memory
70#                        segment from which buffers are allocated for data
71#                        that is read/written from/to disk.
72#
73#     maxFilesToCache    specifies the number of recently used but closed
74#                        files which will have their inodes cached.
75#
76#     maxStatCache       number of entries to keep in the stat cache
77#                        files which will have their inodes cached.
78#
79#     dataStructureDump  specifies a directory to store dumps.  Specify
80#                        'no' to turn off the feature altogether (no dumps).
81#                        Specify 'yes' to send the dumps to /tmp/mmfs.
82#
83#     unmountOnDiskFail  controls how the daemon will respond when
84#                        a disk failure is detected.
85#
86#     dmapiEventTimeout  controls the blocking of NFS and DFS threads
87#
88#     dmapiSessionFailureTimeout  controls the blocking of file operation
89#                                 threads when there is a failure
90#
91#     dmapiMountTimeout  controls the blocking of mount operations
92#
93#     autoload           controls whether the daemon will start up
94#                        automatically when nodes boot
95#
96#     designation        dash-separated list of node roles:
97#                          client, manager, quorum.
98#
99#     uidDomain          specifies the UID/GID domain to be used.
100#
101#     automountDir       specifies the directory to be used by the Linux
102#                        automounter for GPFS file systems that have the
103#                        automount option specified.  The default directory
104#                        is /gpfs/autmountdir.  This parameter does not
105#                        apply to AIX environments.
106#
107#     tiebreakerDisks    controls whether GPFS will use a node quorum plus
108#                        tiebreaker disks algorithm in place of the regular
109#                        node-based quorum algorithm.  The tiebreaker disks
110#                        do not have to belong to any particular file system.
111#                        The disks are specified as a disk list.  If there
112#                        are more than one disk, delimit each name with a
113#                        semicolon and enclose the list in quotation marks.
114#                        If "no" is specified, GPFS reverts to the traditional
115#                        node-based quorum algorithm.  The disks must be
116#                        directly accessible from the quorum nodes.
117#
118#     maxblocksize       max data block size the file system supports
119#
120#     release            bring the configuration information for the
121#                        cluster to the latest format version.  Set the
122#                        maxFeatureLevel config parameter to the latest
123#                        release level or to the specified level.
124#
125#     allowRemoteConnections  controls whether outside nodes can connect
126#                             to nodes in this GPFS cluster.  This is a
127#                             global switch in addition to any other security
128#                             mechanism that may be established.
129#
130#     cipherList         controls whether GPFS network communication
131#                        between local nodes and remote nodes is secured.
132#                        If cipherList is not specified, or if the value
133#                        DEFAULT is specified, then GPFS will not authenticate
134#                        or check authorization for network connections.
135#                        If cipherList is specified, then it should be a valid
136#                        cipher list as documented by man ciphers(1).
137#
138#     updateDiskType     causes the disk subtype information to be reevaluated.
139#
140################################################################################
141
142# Include global declarations and service routines.
143. /usr/lpp/mmfs/bin/mmglobfuncs
144. /usr/lpp/mmfs/bin/mmsdrfsdef
145. /usr/lpp/mmfs/bin/mmfsfuncs
146
147sourceFile="mmchconfig.sh"
148[[ -n $DEBUG || -n $DEBUGmmchconfig ]] && set -x
149$mmTRACE_ENTER "$*"
150
151# Local work files.  Names should be of the form:
152#   fn=${tmpDir}fn.${mmcmd}.$$
153chnodes=${tmpDir}chnodes.${mmcmd}.$$
154diskLines=${tmpDir}diskLines.${mmcmd}.$$
155oldcfgFile=${tmpDir}oldcfgFile.${mmcmd}.$$
156tmpcfgFile=${tmpDir}tmpcfgFile.${mmcmd}.$$
157inputNodes=${tmpDir}inputNodes.${mmcmd}.$$
158allnodes=${tmpDir}allnodes.${mmcmd}.$$
159undeterminedNodes=${tmpDir}undeterminedNodes.${mmcmd}.$$
160
161LOCAL_FILES=" $chnodes $diskLines $undeterminedNodes $tmpcfgFile  \
162              $inputNodes $allnodes $oldcfgFile "
163
164
165# Local variables
166
167usageMsg=289
168noUsageMsg=0
169integer intValue
170integer nodeCount
171integer n
172integer requiredSize
173integer keyGenNumber
174mmsdrfsModified=no
175mmfscfgModified=no
176mmfscfgChange=no
177synchronousNotify=no
178typeset -l attr_lc
179rc=0
180
181
182# Local routines
183
184
185################################################################################
186#
187# The mmchconfigCommonProcessing function extracts the mmfs.cfg information
188# into a work file, checks the command line node list, increments the mmsdrfs
189# gen number and creates needed node lists.  If any error is encountered,
190# the mmchconfig command is terminated.
191#
192# Note:  This function uses only global variables.  Watch out for side effects.
193#
194################################################################################
195function mmchconfigCommonProcessing
196{
197  typeset sourceFile="mmchconfig.sh"
198  [[ -n $DEBUG || -n $DEBUGmmchconfigCommonProcessing ]] && set -x
199  $mmTRACE_ENTER "$*"
200
201  # Execute this function only once.
202  [[ $mmchconfigInitialized = yes ]] &&  \
203    return 0
204
205  # Determine the lookup order for resolving host names.
206  [[ $osName != AIX ]] && resolveOrder=$(setHostResolveOrder)
207
208  # Go through the current mmsdrfs file.  Increment the generation
209  # number and build the node name lists that will be needed later.
210  # Cross check the node list provided on the command line, if any.
211  $rm -f $newsdrfs $tmpfile $nodefile $oldcfgFile $allnodes
212  argcust=""
213  coreQuorumDefined=""
214  nodeCount=0
215  IFS=":"            # Change the field separator to ':'.
216  exec 3<&-
217  exec 3< $mmsdrfsFile
218  while read -u3 sdrfsLine
219  do
220    # Parse the line.
221    set -f ; set -A v -- - $sdrfsLine ; set +f
222
223    IFS="$IFS_sv"      # Restore the default IFS settings.
224    changeThisNode=no
225    printLine=true
226
227    case ${v[$LINE_TYPE_Field]} in
228
229      $VERSION_LINE )
230        # Increment the generation number.
231        newGenNumber=${v[$SDRFS_GENNUM_Field]}+1
232        v[$SDRFS_GENNUM_Field]=$newGenNumber
233
234        ourClusterName=${v[$CLUSTER_NAME_Field]}
235        ;;
236
237      $NODESET_HDR )
238        daemonVersionInEffect=${v[$MIN_DAEMON_VERSION_Field]}
239        currentCipherList=${v[$CIPHER_LIST_Field]}
240        [[ -z $currentCipherList ]] && currentCipherList=DEFAULT
241        ;;
242
243      $MEMBER_NODE )
244        # This line represents a currently-active node.
245        nodeCount=$nodeCount+1
246
247        # Find out if any of the nodes are designated as core quorum nodes.
248        [[ ${v[$CORE_QUORUM_Field]} = $quorumNode ]] &&  \
249          coreQuorumDefined=yes
250
251        # Create a file with all nodes in the cluster.
252        # Note that this is in addition to $nodefile below.
253        print -- "${v[$REL_HOSTNAME_Field]}" >> $allnodes
254        checkForErrors "writing to file $allnodes" $?
255
256        if [[ -z $arglist ]]
257        then
258          # If no node list or node file was provided, collect the
259          # reliable node names of all the nodes in the cluster.
260          print -- "${v[$REL_HOSTNAME_Field]}" >> $nodefile
261          checkForErrors "writing to file $nodefile" $?
262
263        else
264          # See if this node is one of the nodes in the command line list.
265          # The awk script checks whether the IP address in the chnodes file
266          # matches the IP address in the current MEMBER_NODE line.
267          # If yes, the changeThisNode flag will be set to 'yes'.
268          # All other lines are passed unchanged and written to a tmpfile.
269          $touch $tmpfile
270          changeThisNode=$($awk '            \
271            BEGIN { found = "false" }        \
272            $1 == "'${v[$IPA_Field]}'" {     \
273              if ( found == "false" ) {      \
274                { found = "true" }           \
275                { print "yes" }              \
276                { next }                     \
277              }                              \
278            }                                \
279            { print $0 >> "'$tmpfile'"}      \
280          ' $chnodes)
281
282          if [[ $changeThisNode = yes ]]
283          then
284            print -- "${v[$REL_HOSTNAME_Field]}" >> $nodefile
285            checkForErrors "writing to file $nodefile" $?
286            # Add the short name to a list of node names to be used
287            # with the mmfixcfg command.
288            [[ -z $argcust ]]  \
289               && argcust=${v[$NODE_NAME_Field]}  \
290               || argcust="$argcust,${v[$NODE_NAME_Field]}"
291          fi
292
293          # At this point, tmpfile contains all of the original lines in
294          # file chnodes, except the line that matches the current node,
295          # if there was such a line in the first place.  Make tmpfile
296          # the chnodes file for the next iteration.  In this way,
297          # if everything is OK with the user's input, the chnodes file
298          # should be empty after we are finished.
299          $mv $tmpfile $chnodes
300          checkForErrors "mv $tmpfile $chnodes" $?
301
302        fi  # end of if [[ -z $arglist ]]
303
304        # Designate this node as a "preferred node".
305        [[ ${v[$NODE_NUMBER_Field]} = $ourNodeNumber ]] &&  \
306          preferredNode=${v[$REL_HOSTNAME_Field]}
307        ;;
308
309      $MMFSCFG )
310        # Remove the line from the mmsdrfs file for now.  The mmfs.cfg
311        # information will be added back before committing the changes.
312        printLine=false
313
314        # Extract the mmfs.cfg information.
315        # It is everything past the first 4 fields.
316        cfgLine="${v[5]}:${v[6]}:${v[7]}:${v[8]}:${v[9]}:${v[10]}:${v[11]}"
317        cfgLine="$cfgLine:${v[12]}:${v[13]}:${v[14]}:${v[15]}:${v[16]}"
318        cfgLine="$cfgLine:${v[17]}:${v[18]}:${v[19]}:${v[20]}:${v[21]}:${v[22]}"
319
320        # To preserve tabs, temporarily set IFS to new line only.
321        IFS="
322"
323        # Strip trailing colons and write the line to the file.
324        print -- "${cfgLine%%+(:)}" >> $oldcfgFile
325        checkForErrors "writing to file $oldcfgFile" $?
326        IFS="$IFS_sv"  # Restore the default IFS settings.
327        ;;
328
329      * )  # We are not interested in any other lines.
330        ;;
331
332    esac  # end Change some of the fields
333
334    # Build and write the line to the new mmsdrfs file.
335    if [[ $printLine = true ]]
336    then
337      print_newLine >> $newsdrfs
338      checkForErrors "writing to file $newsdrfs" $?
339    fi
340
341    IFS=":"  # Change the separator back to ":" for the next iteration.
342
343  done  # end while read -u3 sdrfsLine
344
345  IFS="$IFS_sv"  # Restore the default IFS settings.
346
347  # If a node list or node file was specified on the command line
348  # and the chnodes file is not empty, either some node names
349  # were specified more than once or not all of the node names
350  # belong to the GPFS cluster.
351  if [[ -n $nodeNames && -s $chnodes ]]
352  then
353    # Get the name of the first offending node.
354    tmpLine=$($head -1 $chnodes)
355    set -f ; set -- $tmpLine ; set +f
356    nodeName=$2
357    printErrorMsg 290 $mmcmd $nodeName
358    cleanupAndExit
359  fi
360
361  # Make working copies of the mmfs.cfg file.
362  $cp $oldcfgFile $newcfg
363  checkForErrors "cp $oldcfgFile $newcfg" $?
364  $cp $oldcfgFile $tmpcfgFile
365  checkForErrors "cp $oldcfgFile $tmpcfgFile" $?
366
367  mmchconfigInitialized=yes
368
369  return 0
370
371}  #--------- end of mmchconfigCommonProcessing ----------------
372
373
374###################################################################
375#
376# Function:  Ensures that the data in the mmsdrfs file is brought
377#            up to date.  The things that take place here change
378#            from release to release.
379#
380# Input:     $1 - mmsdrfs file to update.
381#
382# Output:    An updated mmsdrfs file.
383#
384# Returns:   0 - Success.
385#            1 - Error detected; appropriate messages issued.
386#
387####################################################################
388function convertMmsdrfsFile  #  <sdrfsFile>
389{
390  typeset sourceFile="mmchconfig.sh"
391  [[ -n $DEBUG || -n $DEBUGconvertMmsdrfsFile ]] && set -x
392  $mmTRACE_ENTER "$*"
393  typeset sdrfs=$1
394
395  typeset firstChoice secondChoice getLocalDiskNameOutput magicWord
396  typeset localDiskName rc rc1 nodeName failedDisks
397  typeset secLevel
398
399
400  # Go through the mmsdrfs file and make the needed changes.
401  $rm -f $tmpsdrfs
402  IFS=":"
403  exec 3<&-
404  exec 3< $sdrfs
405  while read -u3 sdrfsLine
406  do
407    # Parse the line.
408    set -f ; set -A v -- - $sdrfsLine ; set +f
409    IFS="$IFS_sv"
410
411    # Change some of the fields depending on the type of line.
412    case ${v[$LINE_TYPE_Field]} in
413
414      $VERSION_LINE )
415        # Return if there is nothing to do.
416        startingSdrfsFormat=${v[$SDRFS_FORMAT_Field]}
417        [[ $startingSdrfsFormat -eq $CURRENT_SDRFS_FORMAT ]] &&  \
418          return 0
419
420        # Assume everything will work out.
421        v[$SDRFS_FORMAT_Field]=$CURRENT_SDRFS_FORMAT
422
423        # New fields since rel 2.3 (sdrfs format level 0):
424        #   NEW_KEY_Field COMMITTED_KEY_Field
425
426        [[ -z ${v[$NEW_KEY_Field]} ]] &&  \
427          v[$NEW_KEY_Field]=0
428
429        [[ -z ${v[$COMMITTED_KEY_Field]} ]] &&  \
430          v[$COMMITTED_KEY_Field]=${v[$NEW_KEY_Field]}
431
432        [[ -z ${v[$SECLEVEL_Field]} ]] &&  \
433          v[$SECLEVEL_Field]=0
434        secLevel=${v[$SECLEVEL_Field]}
435
436        [[ -z ${v[$KEYFILE_FORMAT_Field]} ]] &&  \
437          v[$KEYFILE_FORMAT_Field]=0
438        ;;
439
440     $NODESET_HDR )
441        # New fields since rel 2.3 (sdrfs format level 0):
442        #   CIPHER_LIST_Field
443        [[ $secLevel -gt 0 && -z ${v[$CIPHER_LIST_Field]} ]] &&  \
444          v[$CIPHER_LIST_Field]=AUTHONLY
445        ;;
446
447      $MEMBER_NODE )
448        # New fields since rel 2.3 (sdrfs format level 0):
449        #   DAEMON_NODENAME_Field ADMIN_SHORTNAME_Field
450
451        [[ -z ${v[$DAEMON_NODENAME_Field]} ]] &&  \
452          v[$DAEMON_NODENAME_Field]=${v[$REL_HOSTNAME_Field]}
453
454        [[ -z ${v[$ADMIN_SHORTNAME_Field]} ]] &&  \
455          v[$ADMIN_SHORTNAME_Field]=${v[$NODE_NAME_Field]}
456        ;;
457
458      $SG_MOUNT )
459        # New fields since rel 2.3 (sdrfs format level 0):
460        #   QUOTA_OPT_Field (additional filesetquota indicator)
461
462        [[ ${v[$QUOTA_OPT_Field]} != $QUOTA_DISACTIVATED ]] &&  \
463          v[$QUOTA_OPT_Field]=$QUOTA_ACTIVATED
464        ;;
465
466      $SG_DISKS )
467        # New fields since rel 2.3 (sdrfs format level 0):
468        #   STORAGE_POOL_Field DAEMON_NSD_PRIMARY_Field DAEMON_NSD_BACKUP_Field
469
470        # If storage pool is not assigned, assume the system pool.
471        [[ -z ${v[$STORAGE_POOL_Field]} ]] &&  \
472          v[$STORAGE_POOL_Field]="system"
473
474        # Fill in the missing daemon node names of NSD servers.
475        if [[ -z ${v[$DAEMON_NSD_PRIMARY_Field]} &&
476              -n ${v[$NSD_PRIMARY_NODE_Field]}   ]]
477        then
478          v[$DAEMON_NSD_PRIMARY_Field]=$(checkAndConvertNodeValue  \
479                 ${v[$NSD_PRIMARY_NODE_Field]} $DAEMON_NODENAME_Field)
480          checkForErrors "checkAndConvertNodeValue ${v[$NSD_PRIMARY_NODE_Field]}" $?
481        fi  # end of if [[ -z ${v[$DAEMON_NSD_PRIMARY_Field]} && ...
482
483        if [[ -z ${v[$DAEMON_NSD_BACKUP_Field]} &&
484              -n ${v[$NSD_BACKUP_NODE_Field]}   ]]
485        then
486          v[$DAEMON_NSD_BACKUP_Field]=$(checkAndConvertNodeValue  \
487                 ${v[$NSD_BACKUP_NODE_Field]} $DAEMON_NODENAME_Field)
488          checkForErrors "checkAndConvertNodeValue ${v[$NSD_BACKUP_NODE_Field]}" $?
489        fi  # end of if [[ -z ${v[$DAEMON_NSD_BACKUP_Field]} && ...
490
491        # Fill in the missing disk names of underlying lvs or vsds.
492        if [[ ${v[$DISK_TYPE_Field]} = nsd &&
493              (${v[$NSD_SUBTYPE_Field]} = lv ||
494               ${v[$NSD_SUBTYPE_Field]} = vsd) &&
495              -z ${v[$NSD_SUBTYPE_DISKNAME_Field]} ]]
496        then
497          # This an nsd built from an lv or a vsd but the name of
498          # the underlying lv or vsd is not recorded.
499
500          # Determine the node to ask about the nsd.
501          if [[ -z ${v[$NSD_PRIMARY_NODE_Field]} ]]
502          then
503            firstChoice=$ourNodeName
504            secondChoice=""
505          elif [[ ${v[$NSD_PRIMARY_NODE_Field]} = $ourNodeName ]]
506          then
507            firstChoice=$ourNodeName
508            secondChoice=${v[$NSD_BACKUP_NODE_Field]}
509          elif [[ ${v[$NSD_BACKUP_NODE_Field]} = $ourNodeName ]]
510          then
511            firstChoice=$ourNodeName
512            secondChoice=${v[$NSD_PRIMARY_NODE_Field]}
513          else
514            firstChoice=${v[$NSD_PRIMARY_NODE_Field]}
515            secondChoice=${v[$NSD_BACKUP_NODE_Field]}
516          fi  # end of if [[ -z ${v[$NSD_PRIMARY_NODE_Field]} ]]
517
518          # Determine the local device name.
519          if [[ $firstChoice = $ourNodeName ]]
520          then
521            getLocalDiskNameOutput=$(getLocalDiskName  \
522              ${v[$PVID_Field]} ${v[$NSD_SUBTYPE_Field]} 2>$errMsg)
523            rc=$?
524          else
525            getLocalDiskNameOutput=$($mmcommon on1 $firstChoice getLocalDiskName  \
526              ${v[$PVID_Field]} ${v[$NSD_SUBTYPE_Field]} 2>$errMsg)
527            rc=$?
528          fi
529
530          # Parse the output from the getLocalDiskName function.
531          IFS=":"
532          set -f ; set -- $getLocalDiskNameOutput ; set +f
533          magicWord=$1
534          localDiskName=$2
535          rc1=$3   # rcode from tspreparedisk -p <pvid> -t <nsdSubtype>
536          IFS="$IFS_sv"
537          nodeName=$firstChoice
538
539          if [[ $rc != 0 || $magicWord != getLocalDiskName || $rc1 -ne 0 ]]
540          then
541            # getLocalDiskName failed.  If there is a second choice, try again.
542            # Note that because of the way firstChoice and secondChoice
543            # were determined, secondChoice cannot be the local node.
544            if [[ -n $secondChoice ]]
545            then
546              getLocalDiskNameOutput=$($mmcommon on1 $secondChoice getLocalDiskName  \
547                ${v[$PVID_Field]} ${v[$NSD_SUBTYPE_Field]} 2>$errMsg)
548              rc=$?
549
550              # Parse the output from the getLocalDiskName function.
551              IFS=":"
552              set -f ; set -- $getLocalDiskNameOutput ; set +f
553              magicWord=$1
554              localDiskName=$2
555              rc1=$3   # rcode from tspreparedisk -p <pvid> -t <nsdSubtype>
556              IFS="$IFS_sv"
557              nodeName=$secondChoice
558            fi  # end of if [[ -n $secondChoice ]]
559          fi  # end of if [[ $rc != 0 || $magicWord != getLocalDiskName ...
560
561          if [[ $magicWord = getLocalDiskName ]]
562          then
563            if [[ $rc1 -eq 0 ]]
564            then
565              # Strip away the /dev/ prefix from the device name and then
566              # store the local disk name in the nsdSubtypeDiskname field.
567              localDiskName=${localDiskName##+(/)dev+(/)}
568              v[$NSD_SUBTYPE_DISKNAME_Field]=$localDiskName
569            else
570              # The disk information was not obtained.  Add the nsd to
571              # the list of failed disks, output any error info received,
572              # and issue an appropriate message.
573              failedDisks="$failedDisks\n\t${v[$DISK_NAME_Field]}"
574              [[ -s $errMsg ]] && $cat $errMsg 1>&2
575              if [[ $rc1 -eq $MM_DeviceNotFound ]]
576              then
577                printErrorMsg 187 $mmcmd $nodeName ${v[$DISK_NAME_Field]}
578              else
579                printErrorMsg 337 $mmcmd ${v[$DISK_NAME_Field]} $nodeName
580              fi
581            fi  # end of if [[ $rc1 -eq 0 ]]
582          else
583            # The disk information was not obtained.  Add the nsd to
584            # the list of failed disks, output any error info received,
585            # and issue an appropriate message.
586            failedDisks="$failedDisks\n\t${v[$DISK_NAME_Field]}"
587            [[ -s $errMsg ]] && $cat $errMsg 1>&2
588            printErrorMsg 337 $mmcmd ${v[$DISK_NAME_Field]} $nodeName
589          fi  # end of if [[ $magicWord = getLocalDiskName ]]
590          $rm -f $errMsg
591        fi  # end of if [[ ${v[$DISK_TYPE_Field]} = nsd && ...
592        ;;
593
594      $AUTHORIZED_CLUSTER )
595        # The format of the public key file changed since
596        # rel 2.3 (sdrfs format level 0).  The new information
597        # is dynamically inserted by updateMmfsEnvironment.
598        ;;
599
600      $REM_CLUSTER_KEY )
601        # The format of the public key file changed since
602        # rel 2.3 (sdrfs format level 0).  The new information
603        # is dynamically inserted by updateMmfsEnvironment.
604        ;;
605
606      * )  # We are not interested in any other lines.
607        ;;
608
609    esac  # end Change some of the fields
610
611    # Build and write the line to the temp version of the mmsdrfs file.
612    print_newLine >> $tmpsdrfs
613    checkForErrors "writing to file $tmpsdrfs" $?
614
615    IFS=":"  # Change the separator back to ":" for the next iteration.
616
617  done  # end while read -u3 sdrfsLine
618
619  IFS="$IFS_sv"  # Restore the default IFS settings.
620
621  if [[ -n $failedDisks ]]
622  then
623    # If we failed for any disks, tell the user which ones
624    # and instruct him to re-run the command.
625    printErrorMsg 176 $mmcmd "$failedDisks"
626    printErrorMsg 344 $mmcmd "mmchconfig release=LATEST"
627
628    # Do not change the format level if we were not able
629    # to fill in all of the missing information.
630    $rm -f $sdrfs
631    $awk -F:  '                                                                \
632      /^'$GLOBAL_ID:$VERSION_LINE:'/ {                                         \
633         # If this is the version line, update the format field.               \
634         { $'$SDRFS_FORMAT_Field' = "'$startingSdrfsFormat'" }                 \
635         { print  $1":" $2":" $3":" $4":" $5":" $6":" $7":" $8":" $9":"$10":"  \
636                 $11":"$12":"$13":"$14":"$15":"$16":"$17":"$18":"$19":"$20":"  \
637                 $21":"$22":"$23":"$24":"$25":"$26":"$27":" >> "'$sdrfs'" }    \
638         { next }                                                              \
639      }                                                                        \
640      # All other lines are echoed without change.                             \
641      { print $0 >> "'$sdrfs'" }                                               \
642    ' $tmpsdrfs
643    checkForErrors awk $?
644  fi  # end of if [[ -n $failedDisks ]]
645
646  # The sdrfs file was successfuly updated.
647  # Replace the old mmsdrfs file with the new one.
648  $mv -f $tmpsdrfs $sdrfs
649  checkForErrors "mv $tmpsdrfs $sdrfs" $?
650
651  return 0
652
653}  #----- end of convertMmsdrfsFile ----------------------------
654
655
656###########################################################################
657#
658# Function:  Determines the release level of the code installed on the
659#            specified set of nodes.  Accordingly, updates the relevant
660#            MEMBER_NODE line fields.
661#
662# Input:     $1 - file with the reliable hostnames of the nodes to check
663#            $2 - mmsdrfs file to update (or just the MEMBER_NODE lines)
664#            $3 - file that will contain the names of the failed nodes
665#
666# Output:    A string with the following format:
667#            getInstalledCodeLevel:rc:status:maxDaemonVers:minDaemonVers
668#
669# Returns:   0 - At least some of the nodes were processed successfully.
670#            1 - Error detected; appropriate messages issued.
671#
672###########################################################################
673function getInstalledCodeLevel  # <nodefile> <sdrfsFile> <failedNodes>
674{
675  typeset sourceFile="mmchconfig.sh"
676  [[ -n $DEBUG || -n $DEBUGgetInstalledCodeLevel ]] && set -x
677  $mmTRACE_ENTER "$*"
678  typeset nodefile=$1
679  typeset sdrfs=$2
680  typeset failedNodes=$3
681
682  typeset mmcommonOutput nodeName nodeNumber keyword cmdVersion
683  typeset installedDaemonVersion installedProductVersion installedOsName
684  typeset nodeSuccessfullyProcessed=""
685  typeset status="incomplete"
686  typeset maxDaemonVersion=0
687  typeset minDaemonVersion=100000
688  typeset outfile=${sdrfs}tmp$$
689  typeset rc=0
690
691  if [[ ! -s $nodefile || ! -s $sdrfs ]]
692  then
693    # Something is very wrong; there are missing input parms.
694    printErrorMsg 260 getInstalledCodeLevel "<nodefile> <sdrfsFile>"
695    rc=1
696    print -- "getInstalledCodeLevel:$rc:unexpected_failure:0:0:"
697    return $rc
698  fi
699
700  # Request the release level information for all of the nodes.
701  $mmcommon onall $nodefile $unreachedNodes mmVersion2 >$tmpfile 2>&1
702  rc=$?
703  if [[ ! -s $tmpfile ]]
704  then
705    # We didn't even get out of this box.
706    printErrorMsg 171 "getInstalledCodeLevel" "mmcommon onall $nodefile mmVersion2" $rc
707    [[ $rc -eq 0 ]] && rc=1
708    print -- "getInstalledCodeLevel:$rc:unexpected_failure:0:0:"
709    return $rc
710  fi
711
712  # Initialize the list of failed nodes.  Assume all will fail.
713  $cp $nodefile $failedNodes
714  rc=$?
715  if [[ $rc -ne 0 ]]
716  then
717    # Unexpected error from cp.
718    printErrorMsg 171 "getInstalledCodeLevel" "cp $nodefile $failedNodes" $rc
719    print -- "getInstalledCodeLevel:$rc:unexpected_failure:0:0:"
720    return $rc
721  fi
722
723  # Parse the output.  The normal output from mmremote mmVersion2
724  # starts with the keyword mmVersion2.  Any lines that do not start
725  # with this keyword are assumed to be error messages.
726  $rm -f $errMsg
727  IFS=":"
728  exec 3<&-
729  exec 3< $tmpfile
730  while read -u3 mmcommonOutput
731  do
732    set -f ; set -- $mmcommonOutput ; set +f
733    nodeName=$1
734    keyword=$2
735    cmdVersion=$3
736    nodeNumber=$4
737    installedDaemonVersion=$5
738    installedProductVersion=$6
739    installedOsName=$7
740    IFS="$IFS_sv"
741
742    if [[ $keyword != *( )mmVersion2 ]]
743    then
744      # Unexpected line, assume it is error information.
745      print -- "$mmcommonOutput" >> $errMsg
746      continue
747    fi
748
749    # Keep track of highest and lowest daemon versions found.
750    [[ $installedDaemonVersion -gt $maxDaemonVersion ]] &&  \
751      maxDaemonVersion=$installedDaemonVersion
752    [[ $installedDaemonVersion -lt $minDaemonVersion ]] &&  \
753      minDaemonVersion=$installedDaemonVersion
754
755    # Find in the mmsdrfs file the MEMBER_NODE line that corresponds
756    # to this node and update the fields accordingly.
757    processedNode=$($awk -F: '                                               \
758      $'$LINE_TYPE_Field'   == "'$MEMBER_NODE'" &&                           \
759      $'$NODE_NUMBER_Field' == "'$nodeNumber'"   {                           \
760        { $'$DAEMON_VERSION_Field'  = "'$installedDaemonVersion'" }          \
761        { $'$PRODUCT_VERSION_Field' = "'$installedProductVersion'" }         \
762        { $'$OS_NAME_Field'         = "'$installedOsName'" }                 \
763        { print  $1":" $2":" $3":" $4":" $5":" $6":" $7":" $8":" $9":"$10":" \
764                $11":"$12":"$13":"$14":"$15":"$16":"$17":"$18":"$19":"$20":" \
765                $21":"$22":"$23":"$24":"$25":"$26":"$27":" >> "'$outfile'" } \
766        { print "'$nodeName'" }                                              \
767        { next }                                                             \
768      }                                                                      \
769      # All other lines are echoed without change.                           \
770      { print $0 >> "'$outfile'" }                                           \
771    ' $sdrfs)
772    rc=$?
773    if [[ $rc -ne 0 ]]
774    then
775      # Unexpected awk error.
776      printErrorMsg 171 "getInstalledCodeLevel" "awk" $rc
777      print -- "getInstalledCodeLevel:$rc:unexpected_failure:0:0:"
778      return $rc
779    fi
780
781    # The file was updated successfully.  Replace the original file with it.
782    $mv $outfile $sdrfs
783    rc=$?
784    if [[ $rc -ne 0 ]]
785    then
786      # Unexpected error from mv.
787      printErrorMsg 171 "getInstalledCodeLevel" "mv $outfile $sdrfs" $rc
788      print -- "getInstalledCodeLevel:$rc:unexpected_failure:0:0:"
789      return $rc
790    fi
791    $mmsync $sdrfs
792
793    # If the node was found in the sdrfs file,
794    # remove it from the failed nodes list.
795    if [[ -n $processedNode ]]
796    then
797      $grep -v -w $processedNode $failedNodes >$tmpfile2
798      $mv $tmpfile2 $failedNodes
799      rc=$?
800      if [[ $rc -ne 0 ]]
801      then
802        # Unexpected error from mv.
803        printErrorMsg 171 "getInstalledCodeLevel" "mv $tmpfile2 $failedNodes" $rc
804        print -- "getInstalledCodeLevel:$rc:unexpected_failure:0:0:"
805        return $rc
806      fi
807      nodeSuccessfullyProcessed=yes
808    fi
809
810    IFS=":"  # Change the separator back to ":" for the next iteration.
811
812  done  # end of while read -u3 mmcommonOutput
813
814  IFS="$IFS_sv"  # Restore the default IFS settings.
815
816
817  # Determine the overall result.
818  if [[ -s $failedNodes ]]
819  then
820    # There is a failure.  Put out as much error information as possible.
821    [[ -s $errMsg ]] && $cat $errMsg 1>&2
822
823    if [[ -n $nodeSuccessfullyProcessed ]]
824    then
825      # The GPFS release level could not be determined on some of the nodes.
826      printErrorMsg 575 $mmcmd "$($cat $failedNodes | $sed "s/^/$TABchar/")"
827    else
828      # The GPFS release level could not be determined on any of the nodes.
829      printErrorMsg 576 $mmcmd
830    fi
831    # Tell the guy what to do.
832    printErrorMsg 577 $mmcmd "     mmchconfig release=LATEST [-N NodeList]"
833    rc=1
834    status="incomplete"
835
836  else
837    # Complete success; the release level was determined on all nodes.
838    rc=0
839    status="complete"
840  fi  # end if [[ -s $failedNodes ]]
841  $rm -f $errMsg
842
843  # Print out the results string and exit.
844  print -- "getInstalledCodeLevel:$rc:$status:$maxDaemonVersion:$minDaemonVersion"
845  return 0
846
847}  #----- end of function getInstalledCodeLevel ------------------
848
849
850####################################################################
851#
852#
853# Function:  Determines the release level of the installed code.
854#            If appropriate, updates the version information in
855#            the NODESET_HDR line.
856#
857# Input:    $1 - release level:  LATEST or specific daemon version
858#           $2 - file with the reliable hostnames of the nodes
859#           $3 - mmsdrfs file to use
860#
861# Output:   A string with the following format:
862#            setNodesetVersionFields:rc:status:DaemonVersion:
863#
864# Output:   Updated mmsdrfs file
865#
866# Returns:  Always zero; rc imbedded in output string.
867#
868####################################################################
869function setNodesetVersionFields # <release> <nodeFile> <sdrfsFile>
870{
871  typeset sourceFile="mmchconfig.sh"
872  [[ -n $DEBUG || -n $DEBUGsetNodesetVersionFields ]] && set -x
873  $mmTRACE_ENTER "$*"
874
875  typeset -u releaseLevel=$1
876  typeset nodefile=$2
877  typeset sdrfs=$3
878
879  typeset lowestVersion=100000
880  typeset highestVersion=0
881  typeset osEnvironment=$osName
882  typeset daemonVersionChanged=no
883  typeset rc=0
884
885  typeset result keyword status maxDaemonVersionFound minDaemonVersionFound
886  typeset oldNodesetVersion sdrfsLine printLine nodesetHdr ec
887  typeset newDaemonVersion
888
889  ########################################################################
890  # Verify the release level information is up-to-date and that
891  # the values for the daemon version fields are set correctly.
892  #
893  # Note that if the version is being increased, because new level
894  # of code is installed on all nodes, the change can be made without
895  # requiring daemon shutdown.  But if the request is to lower the value,
896  # the daemon must be down and a node list cannot be specified.
897  # These checks have been made prior to calling this routine.
898  ########################################################################
899
900  if [[ $releaseLevel = LATEST ]]
901  then
902    # Update the DAEMON_VERSION_Field on the MEMBER_NODE node lines.
903    # Depending on how the mmchconfig command was invoked, either all
904    # of the nodes in the cluster will be affected, or just a subset.
905    result=$(getInstalledCodeLevel $nodefile $sdrfs $undeterminedNodes)
906    ec=$?
907
908    # Parse the result.
909    IFS=':'
910    set -f ; set -- $result ; set +f
911    IFS="$IFS_sv"
912    keyword=$1
913    rc=$2
914    status=$3
915    maxDaemonVersionFound=$4
916    minDaemonVersionFound=$5
917
918    if [[ $keyword != getInstalledCodeLevel ]]
919    then
920      # Unexpected error.  Show error information and return.
921      [[ -n $result ]] && print -u2 "$result"
922      printErrorMsg 171 $mmcmd  \
923        "getInstalledCodeLevel: collecting relese information" $ec
924      [[ $ec -eq 0 ]] && ec=1
925      print -- "setNodesetVersionFields:$ec:unchanged:0:"
926      return 0
927    fi
928
929    if [[ $status != complete ]]
930    then
931      # The release level could not be determined on at least some of the nodes
932      # or there was some other unexpected error.  Messages should have already
933      # been issued.
934
935      # Find out the existing version (needed for message 579 below).
936      oldNodesetVersion=$(getNodesetInfo $MIN_DAEMON_VERSION_Field $nodesetId $sdrfs)
937      [[ -z $oldNodesetVersion ]] && oldNodesetVersion=unknown
938
939      # The GPFS release level remains unchanged.
940      printErrorMsg 579 $mmcmd  \
941        $oldNodesetVersion $(releaseToProductVersion $oldNodesetVersion)
942      print -- "setNodesetVersionFields:$rc:unchanged:0:"
943      return 0
944    fi
945
946  else
947    # Convert the input release parameter to daemon version.
948    newDaemonVersion=$(releaseToDaemonVersion $releaseLevel)
949    if [[ $newDaemonVersion -eq 0 ]]
950    then
951      # Invalid value specified
952      printErrorMsg 13 "$mmcmd" "release=$releaseLevel"
953      rc=1
954      print -- "setNodesetVersionFields:$rc:unchanged:0:"
955      return 0
956    fi
957  fi  # end if [[ $releaseLevel = LATEST ]]
958
959
960  # So far things seem to have worked out OK.  See if there is
961  # a need to change the version fields in the NODESET_HDR line.
962
963  # Go through the mmsdrfs file.  Keep track of the installed daemon
964  # versions on each node.  Record the lowest version in the NODESET_HDR line.
965  $rm -f $tmpsdrfs $undeterminedNodes
966  IFS=":"
967  exec 3<&-
968  exec 3< $sdrfs
969  while read -u3 sdrfsLine
970  do
971    # Parse the line.
972    set -f ; set -A v -- - $sdrfsLine ; set +f
973    IFS="$IFS_sv"
974    printLine=true
975
976    case ${v[$LINE_TYPE_Field]} in
977
978      $NODESET_HDR )
979        # Save the line and, if appropriate, change the nodeset version field.
980        nodesetHdr="$sdrfsLine"
981        oldNodesetVersion=${v[$MIN_DAEMON_VERSION_Field]}
982        if [[ $releaseLevel = LATEST ]]
983        then
984          printLine=false
985        else
986          if [[ $newDaemonVersion -lt $oldNodesetVersion ]]
987          then
988            v[$MIN_DAEMON_VERSION_Field]=$newDaemonVersion
989            daemonVersionChanged=yes
990          fi
991        fi  # end if [[ $releaseLevel = LATEST ]]
992        ;;
993
994      $MEMBER_NODE )
995        if [[ $releaseLevel = LATEST ]]
996        then
997          # Keep track of the daemon versions.
998          [[ -z ${v[$DAEMON_VERSION_Field]} ]] &&  \
999            print -- "${v[$REL_HOSTNAME_Field]}" >> $undeterminedNodes
1000          [[ ${v[$DAEMON_VERSION_Field]} -lt $lowestVersion ]] &&  \
1001            lowestVersion=${v[$DAEMON_VERSION_Field]}
1002          [[ ${v[$DAEMON_VERSION_Field]} -gt $highestVersion ]] &&  \
1003            highestVersion=${v[$DAEMON_VERSION_Field]}
1004          [[ -n ${v[$OS_NAME_Field]} && ${v[$OS_NAME_Field]} != $osEnvironment ]] &&  \
1005            osEnvironment="mixed"
1006        fi  # end of if [[ $releaseLevel = LATEST ]]
1007        ;;
1008
1009      * )  # We are not interested in any other lines.
1010        ;;
1011
1012    esac  # end Change some of the fields
1013
1014    # Build and write the line to the temp version of the mmsdrfs file.
1015    if [[ $printLine = true ]]
1016    then
1017      print_newLine >> $tmpsdrfs
1018      checkForErrors "writing to file $tmpsdrfs" $?
1019    fi
1020
1021    IFS=":"  # Change the separator back to ":" for the next iteration.
1022
1023  done  # end while read -u3 sdrfsLine
1024
1025  IFS="$IFS_sv"  # Restore the default IFS settings.
1026
1027  # Update the version numbers in the NODESET_HDR line as needed.
1028  if [[ $releaseLevel = LATEST ]]
1029  then
1030    # Parse the saved NODESET_HDR line.
1031    IFS=':'
1032    set -f ; set -A v -- - $nodesetHdr ; set +f
1033    IFS="$IFS_sv"
1034
1035    # Update the version fields with their latest values.
1036    v[$MIN_DAEMON_VERSION_Field]=$lowestVersion
1037    v[$MAX_DAEMON_VERSION_Field]=$highestVersion
1038    v[$OS_ENVIRONMENT_Field]=$osEnvironment
1039
1040    # Recreate the NODESET_HDR line and put it back.
1041    nodesetHdr=$(print_newLine)
1042    print -- "$nodesetHdr" >> $tmpsdrfs
1043    checkForErrors "writing to file $tmpsdrfs" $?
1044
1045    if [[ $oldNodesetVersion -lt $lowestVersion ]]
1046    then
1047      daemonVersionChanged=yes
1048      newDaemonVersion=$lowestVersion
1049    fi
1050
1051    # Examine the results so far and issue additional messages as needed.
1052    if [[ $lowestVersion -ne $highestVersion ]]
1053    then
1054      # Not all nodes are at the same level.
1055      if [[ -s $undeterminedNodes ]]
1056      then
1057        # The GPFS release level could not be determined on some of the nodes.
1058        printErrorMsg 575 $mmcmd "$($cat $undeterminedNodes | $sed "s/^/$TABchar/")"
1059
1060        # Tell the guy what to do.
1061        printErrorMsg 577 $mmcmd "     mmchconfig release=LATEST [NodeList]"
1062      else
1063        # The cluster contains nodes that are at different release levels.
1064        [[ -z $lowestVersion ]] && lowestVersion=unknown
1065        printErrorMsg 582 $mmcmd  \
1066          $lowestVersion $(releaseToProductVersion $lowestVersion)  \
1067          $highestVersion  $(releaseToProductVersion $highestVersion)
1068
1069        # Tell the guy what to do.
1070        printErrorMsg 578 $mmcmd "     mmchconfig release=LATEST [NodeList]"
1071      fi
1072    fi  # if [[ $lowestVersion -ne $highestVersion ]]
1073
1074  fi  # end if [[ $releaseLevel = LATEST ]]
1075
1076  # Sort and rename the updated version of the mmsdrfs file.
1077  LC_ALL=C $SORT_MMSDRFS $tmpsdrfs -o $sdrfs
1078  checkForErrors "sorting file $tmpsdrfs" $?
1079  $mmsync $sdrfs
1080
1081  # Put out the final messages and return.
1082  if [[ $daemonVersionChanged = yes ]]
1083  then
1084    [[ -z $oldNodesetVersion ]] && oldNodesetVersion=unknown
1085    # The GPFS release level for the cluster will be changed.
1086    printErrorMsg 581 $mmcmd  \
1087      $oldNodesetVersion $(releaseToProductVersion $oldNodesetVersion)  \
1088      $newDaemonVersion  $(releaseToProductVersion $newDaemonVersion)
1089    print -- "setNodesetVersionFields:$rc:changed:$newDaemonVersion:"
1090  elif [[ -n $oldNodesetVersion ]]
1091  then
1092    # The GPFS release level remains unchanged.
1093    printErrorMsg 579 $mmcmd  \
1094      $oldNodesetVersion $(releaseToProductVersion $oldNodesetVersion)
1095    print -- "setNodesetVersionFields:$rc:unchanged:$oldNodesetVersion:"
1096  else
1097    # The GPFS release level cannot be determined.
1098    printErrorMsg 580 $mmcmd  \
1099      $initialDaemonVersion $(releaseToProductVersion $initialDaemonVersion)
1100    print -- "setNodesetVersionFields:$rc:undefined:$initialDaemonVersion:"
1101  fi  # end if [[ $daemonVersionChanged = yes ]]
1102
1103
1104  return 0
1105
1106}  #--------- end of setNodesetVersionFields ----------------
1107
1108
1109##########################################################################
1110#
1111# Function:  Set the node designation field to the specified value.
1112#
1113# Input:     $1 - node designations list
1114#            $2 - mmsdrfs file to use
1115#            $3 - file with the reliable names of the nodes to change
1116#                 If not specified, all nodes in the cluster are changed.
1117#
1118# Output:    Updated mmsdrfs file.
1119#
1120# Returns:   0 - Node designation changed successfully.
1121#            Any other return code indicates unexpected error.
1122#
1123##########################################################################
1124function changeNodeDesignation # <designation> <mmsdrfsFile> [<nodeFile>]
1125{
1126  typeset sourceFile="mmchconfig.sh"
1127  [[ -n $DEBUG || -n $DEBUGchangeNodeDesignation ]] && set -x
1128  $mmTRACE_ENTER "$*"
1129
1130  typeset nodeRoles=$1
1131  typeset sdrfs=$2
1132  typeset nodeFile=$3
1133  typeset allNodeNames=$4
1134
1135  typeset designation=""
1136  typeset quorumField=""
1137  typeset quorumNodeCount=0
1138  typeset newQuorumNodes=""
1139  typeset oldQuorumNodes=""
1140  typeset diskQuorumInEffect=""
1141  typeset rc=0
1142
1143  typeset -l role
1144  typeset changeThisNode quorumNodeNumbers quorumNodeNames
1145
1146  # Parse the node designations list.
1147  IFS="-"
1148  set -f ; set -- $nodeRoles ; set +f
1149  IFS="$IFS_sv"
1150  while [[ -n $1 ]]
1151  do
1152    role=$1  # Convert the node's role to lower case only.
1153    case $role in
1154
1155      $CLIENT  ) designation=$CLIENT  ;;
1156
1157      $MANAGER ) designation=$MANAGER ;;
1158
1159      $QUORUM  ) quorumField=$quorumNode ;;
1160
1161      $NONQUORUM ) quorumField=$nonQuorumNode ;;
1162
1163      * ) # Invalid node designations specified.
1164        printErrorMsg 293 $mmcmd "$nodeRoles"
1165        cleanupAndExit
1166        ;;
1167    esac
1168    # Move to the next field.
1169    shift
1170  done  # end while [[ -n $1 ]]
1171
1172  # If nodes are going to be defined as quorum nodes,
1173  # find out whether disk-based quorum is in effect.
1174  if [[ $quorumField = $quorumNode ]]
1175  then
1176    diskQuorumInEffect=$(showCfgValue tiebreakerDisks no $ourShortName $oldcfgFile)
1177    [[ $diskQuorumInEffect = no ]] && diskQuorumInEffect=""
1178  fi
1179
1180  # Go through the mmsdrfs file.
1181  # Change the designation field on all applicable MEMBER_NODE lines.
1182  $rm -f $tmpsdrfs $chnodes $diskLines
1183  IFS=":"
1184  exec 3<&-
1185  exec 3< $sdrfs
1186  while read -u3 sdrfsLine
1187  do
1188    # Parse the line.
1189    set -f ; set -A v -- - $sdrfsLine ; set +f
1190
1191    IFS="$IFS_sv"
1192    changeThisNode=no
1193
1194    case ${v[$LINE_TYPE_Field]} in
1195
1196      $MEMBER_NODE )
1197        if [[ -z $nodeFile ]]
1198        then
1199          # If no argument list is provided,
1200          # all MEMBER_NODE lines are changed.
1201          changeThisNode=yes
1202        else
1203          # See if this node is one of the nodes in the command line list.
1204          changeThisNode=$($awk '                    \
1205             $1 == "'${v[$REL_HOSTNAME_Field]}'" {   \
1206               { print "yes" }                       \
1207               { exit }                              \
1208             }                                       \
1209          ' $nodeFile)
1210        fi  # end if [[ -z $nodeFile ]]
1211
1212        if [[ $changeThisNode = yes ]]
1213        then
1214          # Handle quorum/nonquorum changes.
1215          if [[ -n $quorumField ]]
1216          then
1217            if [[ $quorumField = $quorumNode ]]
1218            then
1219              # When a nonquorum node will become a quorum node,
1220              # mark the node as 'new'.
1221              if [[ ${v[$CORE_QUORUM_Field]} = $nonQuorumNode ]]
1222              then
1223                v[$ADDNODE_STATE_Field]=$NEW_NODE
1224                newQuorumNodes=yes
1225              fi
1226            else
1227              # When changing a node's designation from quorum to
1228              # nonquorum, GPFS must be down on the affected nodes.
1229              [[ ${v[$CORE_QUORUM_Field]} = $quorumNode ]] &&  \
1230                print -- "${v[$REL_HOSTNAME_Field]}" >> $chnodes
1231
1232              # Clear the new node flag in case it is still set.
1233              v[$ADDNODE_STATE_Field]=$OLD_NODE
1234            fi  # end if [[ $quorumField = $quorumNode ]]
1235
1236            # Set the new value.
1237            v[$CORE_QUORUM_Field]=$quorumField
1238          fi  # end of if [[ -n $quorumField ]]
1239
1240          # Handle client/manager changes.
1241          [[ -n $designation ]] &&  \
1242            v[$DESIGNATION_Field]=$designation
1243        fi  # end of if [[ $changeThisNode = yes ]]
1244
1245        if [[ ${v[$CORE_QUORUM_Field]} = $quorumNode ]]
1246        then
1247          (( quorumNodeCount += 1 ))
1248          if [[ -z $quorumNodeNames ]]
1249          then
1250            # This is the first node to add to the lists.
1251            quorumNodeNumbers="${v[$NODE_NUMBER_Field]}"
1252            quorumNodeNames="${v[$REL_HOSTNAME_Field]}"
1253          else
1254            if [[ ${v[$REL_HOSTNAME_Field]} = $ourNodeName ]]
1255            then
1256              # This is the local node; add it at the front of the lists
1257              # so it will be the first quorum node used.
1258              quorumNodeNumbers="${v[$NODE_NUMBER_Field]},${quorumNodeNumbers}"
1259              quorumNodeNames="${v[$REL_HOSTNAME_Field]},${quorumNodeNames}"
1260            else
1261              # This is not the local node; add it at the end of the lists.
1262              quorumNodeNumbers="${quorumNodeNumbers},${v[$NODE_NUMBER_Field]}"
1263              quorumNodeNames="${quorumNodeNames},${v[$REL_HOSTNAME_Field]}"
1264            fi
1265          fi  # end of if [[ -z $quorumNodeNames ]]
1266          [[ ${v[$ADDNODE_STATE_Field]} = $OLD_NODE ]] &&  \
1267            oldQuorumNodes=yes
1268        fi  # end of if [[ ${v[$CORE_QUORUM_Field]} = $quorumNode ]]
1269        ;;
1270
1271      $SG_DISKS )
1272        # Collect the lines that represent the quorum disks.
1273        if [[ -n $diskQuorumInEffect && ${v[$PAXOS_Field]} = $PaxosDisk ]]
1274        then
1275          print_newLine >> $diskLines
1276          checkForErrors "writing to file $diskLines" $?
1277        fi  # end if [[ -n $diskQuorumInEffect && ...
1278        ;;
1279
1280      * )  # Pass all other lines without a change.
1281        ;;
1282
1283    esac  # end Change some of the fields
1284
1285    # Build and write the line to the new mmsdrfs file.
1286    print_newLine >> $tmpsdrfs
1287    checkForErrors "writing to file $tmpsdrfs" $?
1288
1289    IFS=":"  # Change the separator back to ":" for the next iteration.
1290
1291  done  # end while read -u3 sdrfsLine
1292
1293  IFS="$IFS_sv"  # Restore the default IFS settings.
1294
1295  # Ensure that there is at least one quorum node in the cluster.
1296  if [[ $quorumNodeCount -eq 0 ]]
1297  then
1298    printErrorMsg 53 $mmcmd
1299    cleanupAndExit
1300  fi
1301
1302  # Perform additional processing if disk-based quorum is in effect.
1303  if [[ -n $diskQuorumInEffect ]]
1304  then
1305    # Fail the command if there are more than eight quorum nodes.
1306    if [[ $quorumNodeCount -gt 8 ]]
1307    then
1308      # There are more than 8 quorum nodes while tiebreaker disks are in use.
1309      printErrorMsg 131 $mmcmd
1310      cleanupAndExit
1311    fi
1312
1313    # The quorum disks must be reformatted.
1314    if [[ -n $newQuorumNodes ]]
1315    then
1316      formatPaxosDisks $diskLines $quorumNodeNumbers $quorumNodeNames mmaddnode
1317      if [[ $? -ne 0 ]]
1318      then
1319        # GPFS failed to initialize the tiebreaker disks.
1320        printErrorMsg 132 $mmcmd
1321        cleanupAndExit
1322      fi
1323    fi
1324  fi  # end of if [[ -n $diskQuorumInEffect ]]
1325
1326  # If, as a result of this command, all quorum nodes will end up
1327  # being marked as "new", the daemon must be stopped everywhere
1328  # and the addnode state field reset to "old".
1329  if [[ -z $oldQuorumNodes ]]
1330  then
1331    # Ensure the daemon is down everywhere.
1332    if [[ -z $daemonInactiveVerified ]]
1333    then
1334      printInfoMsg 339
1335      verifyDaemonInactive $allnodes $mmcmd
1336      [[ $? -ne 0 ]] && cleanupAndExit
1337      daemonInactiveVerified=yes
1338    fi
1339
1340    # Reset the addnode state of all nodes to 'old'.
1341    $rm -f $tmpfile
1342    $awk -F:  '                                                                \
1343       # If this is a node line, clear the addnode state field.                \
1344       /'^$HOME_CLUSTER:$MEMBER_NODE:'/ {                                      \
1345         { $'$ADDNODE_STATE_Field' = "'$OLD_NODE'" }                           \
1346         { print  $1":" $2":" $3":" $4":" $5":" $6":" $7":" $8":" $9":"$10":"  \
1347                 $11":"$12":"$13":"$14":"$15":"$16":"$17":"$18":"$19":"$20":"  \
1348                 $21":"$22":"$23":"$24":"$25":"$26":"$27":" >> "'$tmpfile'" }  \
1349          { next }                                                             \
1350       }                                                                       \
1351       # All other lines are echoed without change.                            \
1352       { print $0 >> "'$tmpfile'" }                                            \
1353       END { print gen }                                                       \
1354    ' $tmpsdrfs
1355    checkForErrors awk $?
1356
1357    # The file was updated successfully.
1358    $mv $tmpfile $tmpsdrfs
1359    checkForErrors "mv $tmpfile $tmpsdrfs" $?
1360  fi  # end of if [[ -z $oldQuorumNodes ]]
1361
1362  # If needed, ensure the daemon is down on the affected nodes.
1363  # Do not set the daemonInactiveVerified flag because we are
1364  # dealing with only a small subset of the nodes.
1365  if [[ -s $chnodes && -z $daemonInactiveVerified ]]
1366  then
1367    printInfoMsg 453
1368    verifyDaemonInactive $chnodes $mmcmd
1369    [[ $? -ne 0 ]] && cleanupAndExit
1370  fi
1371
1372  # Everything seems to have gone OK so far.
1373  # No need to sort the mmsdrfs file this time,
1374  # just rename it so that the caller can find it.
1375  $mv $tmpsdrfs $sdrfs
1376  checkForErrors "mv $tmpsdrfs $sdrfs" $?
1377
1378  return 0
1379
1380}  #----- end of function changeNodeDesignation ------------------
1381
1382
1383##########################################################################
1384#
1385# Function:  Set the add node state field to the specified value
1386#
1387# Input:     $1 - new state
1388#            $2 - mmsdrfs file to use
1389#            $3 - file with the reliable names of the nodes to change
1390#                 If not specified, all nodes in the cluster are changed.
1391#            $4 - file to hold the names of all nodes in the cluster
1392#
1393# Output:    Updated mmsdrfs file
1394#
1395# Returns:   0 - node state changed successfully
1396#            Any other return code indicates unexpected error.
1397#
1398##########################################################################
1399function changeAddNodeState  # <state> <sdrfsFile> [<nodeFile> <allNodeNames>]
1400{
1401  typeset sourceFile="mmchconfig.sh"
1402  [[ -n $DEBUG || -n $DEBUGchangeAddNodeState ]] && set -x
1403  $mmTRACE_ENTER "$*"
1404
1405  typeset new_state=$1
1406  typeset sdrfs=$2
1407  typeset nodeFile=$3
1408  typeset allNodeNames=$4
1409
1410  typeset rc=0
1411  typeset changeThisNode
1412
1413  if [[ $new_state = "new" ]]
1414  then
1415    new_state=$NEW_NODE
1416  elif [[ $new_state = "old" ]]
1417  then
1418    new_state=$OLD_NODE
1419  else
1420    # Unexpected error
1421    printErrorMsg 171 "$mmcmd" "$1" $2
1422    cleanupAndExit
1423  fi
1424
1425  # Clear files that will be created.
1426  $rm -f $tmpsdrfs
1427  [[ -n $allNodeNames ]] && $rm -f $allNodeNames
1428
1429  # Go through the mmsdrfs file.  Increment the generation number.
1430  # Change the add node state field on all applicable MEMBER_NODE lines.
1431  IFS=":"           # Change the field separator to ':'.
1432  exec 3<&-
1433  exec 3< $sdrfs
1434  while read -u3 sdrfsLine
1435  do
1436    # Parse the line.
1437    set -f ; set -A v -- - $sdrfsLine ; set +f
1438
1439    IFS="$IFS_sv"
1440    changeThisNode=no
1441
1442    case ${v[$LINE_TYPE_Field]} in
1443
1444      $MEMBER_NODE )
1445        if [[ -z $nodeFile ]]
1446        then
1447          # If no argument list is provided,
1448          # all MEMBER_NODE lines are changed.
1449          changeThisNode=yes
1450        else
1451          # See if this node is one of the nodes in the command line list.
1452          # The awk script checks if the name in the node file
1453          # matches the reliable name in the current MEMBER_NODE line.
1454          # If yes, the changeThisNode flag will be set to 'yes'.
1455          changeThisNode=$($awk '                    \
1456             $1 == "'${v[$REL_HOSTNAME_Field]}'" {   \
1457               { print "yes" }                       \
1458               { exit }                              \
1459             }                                       \
1460          ' $nodeFile)
1461        fi  # end of if [[ -z $nodeFile ]]
1462
1463        [[ $changeThisNode = yes ]] &&  \
1464          v[$ADDNODE_STATE_Field]=$new_state
1465
1466        [[ -n $allNodeNames ]] &&  \
1467          print -- "${v[$REL_HOSTNAME_Field]}" >> $allNodeNames
1468        ;;
1469
1470      * )  # Pass all other lines without a change.
1471        ;;
1472
1473    esac  # end Change some of the fields
1474
1475    # Build and write the line to the new mmsdrfs file.
1476    print_newLine >> $tmpsdrfs
1477    checkForErrors "writing to file $tmpsdrfs" $?
1478
1479    IFS=":"  # Change the separator back to ":" for the next iteration.
1480
1481  done  # end while read -u3 sdrfsLine
1482
1483  IFS="$IFS_sv"  # Restore the default IFS settings.
1484
1485  # Everything seems to have gone OK so far.
1486  # No need to sort the mmsdrfs file this time,
1487  # just rename it so that the caller can find it.
1488  $mv $tmpsdrfs $sdrfs
1489  checkForErrors "mv $tmpsdrfs $sdrfs" $?
1490
1491  $mmTRACE_EXIT rc=0
1492  return 0
1493
1494}  #----- end of function changeAddNodeState ---------------------
1495
1496
1497######################################################################
1498#
1499# Function:  Reevaluate the disk subtype field information for all
1500#            disks in the cluster.
1501#
1502# Input:     $1 - all or file name with disk names, one per line.
1503#            $2 - mmsdrfs file to use
1504#
1505# Output:    Updated mmsdrfs file
1506#
1507# Returns:   0 - disk subtypes changed successfully.
1508#            Any other return code indicates unexpected error.
1509#
1510######################################################################
1511function updateDiskType  # <all | filename> <mmsdrfsFile>
1512{
1513  [[ -n $DEBUG || -n $DEBUGupdateDiskType ]] && set -x
1514  $mmTRACE_ENTER "$*"
1515
1516  typeset disksToChange=$1
1517  typeset sdrfs=$2
1518
1519  typeset rc=0
1520  typeset disksNotUpdated=""
1521  typeset noDisksChanged=yes
1522  typeset diskSubtypeUpdated newDiskSubtype nodeName
1523
1524  # Some initializations.
1525  [[ $disksToChange = yes ]] && disksToChange=all
1526
1527  # If file name specified, verify the file exists.
1528  if [[ $disksToChange != all && ! -f $disksToChange ]]
1529  then
1530    # Can't read the file with disk names.
1531    printErrorMsg 43 $mmcmd $disksToChange
1532    cleanupAndExit
1533  fi
1534
1535  # Define a file for extended error information.
1536  errMsgLog=${rasDir}errMsgLog.${mmcmd}.$$
1537
1538  # Cleanup old logs that were not touched for over 10 days.
1539  $find ${rasDir} -name "errMsgLog.${mmcmd}.*"  \
1540      -atime +10 -mtime +10 -exec $rm -f {} \; >/dev/null 2>/dev/null
1541
1542  $rm -f $tmpsdrfs $errMsgLog $nodefile
1543
1544  # Sort the file using the line type field as a primary key.
1545  $sort -t: -k 2,2 -k 1,1  $sdrfs -o $sdrfs
1546
1547  # Go through the mmsdrfs file.  Increment the generation number.
1548  # Change the subtype field on all applicable SG_DISK lines.
1549  IFS=":"
1550  exec 3<&-
1551  exec 3< $sdrfs
1552  while read -u3 sdrfsLine
1553  do
1554    # Parse the line.
1555    set -f ; set -A v -- - $sdrfsLine ; set +f
1556
1557    IFS="$IFS_sv"
1558
1559    case ${v[$LINE_TYPE_Field]} in
1560
1561      $MEMBER_NODE )   # This line describes a node.
1562        # Collect the reliable names of all nodes in the cluster.
1563        print -- "${v[$REL_HOSTNAME_Field]}" >> $nodefile
1564        checkForErrors "writing to file $nodefile" $?
1565        ;;
1566
1567      $SG_DISKS )
1568        # Assume something will go wrong.
1569        diskSubtypeUpdated=no
1570        reevaluateThisDisk=no
1571
1572        # Determine whether we are interested in this disk.
1573        if [[ $disksToChange != all ]]
1574        then
1575          # disksToChange is the name of a file with disk names.
1576          diskName=$($grep -w ${v[$DISK_NAME_Field]} $disksToChange 2>/dev/null)
1577          [[ -n $diskName ]] && reevaluateThisDisk=yes
1578        else
1579          reevaluateThisDisk=yes
1580        fi
1581
1582        if [[ $reevaluateThisDisk = yes ]]
1583        then
1584          # Assume the disk is directly attached and known on this node.
1585          # Determine its subtype.
1586          newDiskSubtype=$(determineDiskSubtype  \
1587                           ${v[$DISK_NAME_Field]} reevaluate 2>>$errMsgLog)
1588          rc=$?
1589
1590          # If the disk type was successfully re-evaluated, record it
1591          # in the mmsdrfs file.  Otherwise, try to find a node that can
1592          # give us an answer.
1593          if [[ $rc -eq 0 && -n $newDiskSubtype ]]
1594          then
1595            v[$DISK_SUBTYPE_Field]=$newDiskSubtype
1596            diskSubtypeUpdated=yes
1597          else
1598            # Decide where to look for the disk.
1599            # Until the above is done better, try the nodes one at a time.
1600            for nodeName in $($cat $nodefile)
1601            do
1602              newDiskSubtype=$($mmcommon on1 $nodeName  \
1603                  determineDiskSubtype ${v[$DISK_NAME_Field]} reevaluate 2>>$errMsgLog)
1604              rc=$?
1605              if [[ $rc -eq 0 && -n $newDiskSubtype ]]
1606              then
1607                v[$DISK_SUBTYPE_Field]=$newDiskSubtype
1608                diskSubtypeUpdated=yes
1609                break
1610              fi
1611            done  # end for nodeName in $($cat $nodefile)
1612          fi  # end if [[ $rc -eq 0 && -n $newDiskSubtype ]]
1613
1614          # If we were not able to determine the new disk type,
1615          # add the disk to the list of failed/unchanged disks.
1616          if [[ $diskSubtypeUpdated = no ]]
1617          then
1618            disksNotUpdated="$disksNotUpdated\n\t${v[$DISK_NAME_Field]}"
1619          else
1620            noDisksChanged=no
1621          fi
1622        fi  # end if [[ $reevaluateThisDisk = yes ]]
1623        ;;
1624
1625      * )  # Pass all other lines without a change.
1626        ;;
1627
1628    esac  # end Change some of the fields
1629
1630    # Build and write the line to the new mmsdrfs file.
1631    print_newLine >> $tmpsdrfs
1632    checkForErrors "writing to file $tmpsdrfs" $?
1633
1634    IFS=":"  # Change the separator back to ":" for the next iteration.
1635
1636  done  # end while read -u3 sdrfsLine
1637
1638  IFS="$IFS_sv"  # Restore the default IFS settings.
1639
1640  if [[ $noDisksChanged = yes ]]
1641  then
1642    # We were not able to change any of the disks.
1643    print -u2 "$mmcmd:  Not able to determine the disk type for any of the disks."
1644  elif [[ -n $disksNotUpdated ]]
1645  then
1646    # Tell the user which disks failed.
1647    print -u2 "$mmcmd:  Not able to determine the disk type for the following disks: $disksNotUpdated"
1648    print -u2 "$mmcmd:  Reissue the command from a node that has access to the disks."
1649    [[ -s $errMsgLog ]] &&  \
1650      print -u2 "$mmcmd:  File $errMsgLog contains additional error information."
1651  else
1652    :  # All disks were successfully re-evaluated.
1653  fi
1654
1655  [[ ! -s $errMsgLog ]] && $rm -f $errMsgLog
1656
1657  # Everything seems to have gone OK so far.
1658  # Put the file back in the correct order and return.
1659  LC_ALL=C $SORT_MMSDRFS $tmpsdrfs -o $sdrfs
1660  checkForErrors sort $?
1661
1662  return 0
1663
1664}  #----- end of function updateDiskType -------------------------
1665
1666
1667####################################################################
1668#
1669# Function:  Define disks for use by the disk quorum algorithm.
1670#
1671# Input:     $1 - comma-separated list of NSD names
1672#            $2 - mmsdrfs file to use
1673#
1674# Output:    None.
1675#
1676# Returns:   0 - quorum disks defined successfully
1677#            Any other return code indicates unexpected error.
1678#
1679####################################################################
1680function setDiskQuorum # <diskNameList> <mmsdrfsFile>
1681{
1682  [[ -n $DEBUG || -n $DEBUGsetDiskQuorum ]] && set -x
1683  $mmTRACE_ENTER "$*"
1684
1685  typeset diskNameList=$1
1686  typeset sdrfs=$2
1687
1688  typeset rc=0
1689  typeset quorumNodeNumbers=""
1690  typeset quorumNodeNames=""
1691  typeset quorumNodeCount=0
1692  typeset diskCount=0
1693
1694  typeset diskList sdrfsLine assignThisDisk
1695  typeset diskName tempList
1696
1697  # Create a blank-separated list of the disk names.
1698  IFS=";"
1699  for diskName in $diskNameList
1700  do
1701    [[ -z $diskName ]] && continue
1702    diskList="${diskList}${diskName}${BLANKchar}"
1703    (( diskCount += 1 ))
1704  done  # end for diskName in $diskNameList
1705  IFS="$IFS_sv"
1706
1707  if [[ $diskCount -gt 3 ]]
1708  then
1709    print -u2 "$mmcmd: More than three disks specified."
1710    return 1
1711  fi
1712
1713  # Go through the mmsdrfs file and collect needed information.
1714  $rm -f $tmpsdrfs $diskLines
1715  IFS=":"
1716  exec 3<&-
1717  exec 3< $sdrfs
1718  while read -u3 sdrfsLine
1719  do
1720    # Parse the line.
1721    set -f ; set -A v -- - $sdrfsLine ; set +f
1722
1723    IFS="$IFS_sv"
1724
1725    case ${v[$LINE_TYPE_Field]} in
1726
1727      $MEMBER_NODE )   # This line describes a node.
1728        # Collect information about the quorum nodes in the cluster.
1729        if [[ ${v[$CORE_QUORUM_Field]} = $quorumNode ]]
1730        then
1731          (( quorumNodeCount += 1 ))
1732          if [[ -z $quorumNodeNames ]]
1733          then
1734            # This is the first node to add to the lists.
1735            quorumNodeNumbers="${v[$NODE_NUMBER_Field]}"
1736            quorumNodeNames="${v[$REL_HOSTNAME_Field]}"
1737          else
1738            if [[ ${v[$REL_HOSTNAME_Field]} = $ourNodeName ]]
1739            then
1740              # This is the local node; add it at the front of the lists
1741              # so it will be the first quorum node used.
1742              quorumNodeNumbers="${v[$NODE_NUMBER_Field]},${quorumNodeNumbers}"
1743              quorumNodeNames="${v[$REL_HOSTNAME_Field]},${quorumNodeNames}"
1744            else
1745              # This is not the local node; add it at the end of the lists.
1746              quorumNodeNumbers="${quorumNodeNumbers},${v[$NODE_NUMBER_Field]}"
1747              quorumNodeNames="${quorumNodeNames},${v[$REL_HOSTNAME_Field]}"
1748            fi
1749          fi  # end of if [[ -z $quorumNodeNames ]]
1750        fi  # end of if [[ ${v[$CORE_QUORUM_Field]} = $quorumNode ]]
1751        ;;
1752
1753      $SG_DISKS )
1754        # Determine whether we are interested in this disk.
1755        tempList=""
1756        assignThisDisk=no
1757        for diskName in $diskList
1758        do
1759          if [[ ${v[$DISK_NAME_Field]} = $diskName ]]
1760          then
1761            # The disk represented by the current SG_DISKS line
1762            # is one of the disks that we want.
1763
1764            if [[ $assignThisDisk = no ]]
1765            then
1766              # If we see this disk for the first time,
1767              # mark it as a quorum (Paxos) disk.
1768              assignThisDisk=yes
1769
1770            else
1771              # We have already seen this name during the current iteration.
1772              # It must be a duplicate entry in the command line list.
1773              printErrorMsg 88 $mmcmd $diskName
1774              return 1
1775            fi  # end of if [[ $assignThisDisk = no ]]
1776
1777          else
1778            # diskName does not match the name of the disk in the current
1779            # SG_DISKS line.  Add diskName to the temporary list.
1780            tempList="$tempList $diskName"
1781          fi  # end of if [[ ${v[$DISK_NAME_Field]} = $diskName ]]
1782        done  # end of for diskName in $diskList
1783
1784        # At this point we know if the current SG_DISKS line represents
1785        # a disk that will be designated as a quorum disk.
1786        # If yes, mark the disk accordingly and save the line for later
1787        # processing.  Otherwise, clear the field; this may be an old
1788        # disk that is not needed anymore.
1789        if [[ $assignThisDisk = yes ]]
1790        then
1791          v[$PAXOS_Field]=$PaxosDisk
1792          print_newLine >> $diskLines
1793          checkForErrors "writing to file $diskLines" $?
1794        else
1795          v[$PAXOS_Field]=""
1796        fi
1797
1798         # Initialize diskList for the next iteration.
1799         diskList=$tempList
1800        ;;
1801
1802      * )  # Pass all other lines without a change.
1803        ;;
1804
1805    esac  # end Change some of the fields
1806
1807    # Build and write the line to the new mmsdrfs file.
1808    print_newLine >> $tmpsdrfs
1809    checkForErrors "writing to file $tmpsdrfs" $?
1810
1811    IFS=":"  # Change the separator back to ":" for the next iteration.
1812
1813  done  # end while read -u3 sdrfsLine
1814
1815  IFS="$IFS_sv"  # Restore the default IFS settings.
1816
1817  # Replace the old sdrfs file with the new one.
1818  $mv $tmpsdrfs $sdrfs
1819  checkForErrors "mv $tmpsdrfs $sdrfs" $?
1820
1821  # Disk-based quorum is not allowed if there are more than eight quorum nodes.
1822  if [[ $quorumNodeCount -gt 8 ]]
1823  then
1824    # There are more than 8 quorum nodes while tiebreaker disks are in use.
1825    printErrorMsg 131 $mmcmd
1826    return 1
1827  fi
1828
1829  # If there are still entries left in diskList list, this means
1830  # that the user specified disks that do not belong to the cluster.
1831  if [[ -n $diskList ]]
1832  then
1833    # Disks not known to GPFS.
1834    printErrorMsg 486 $mmcmd "$diskList"
1835    return 1
1836  fi
1837
1838  # Things are OK so far.  Start formatting the disks.
1839  formatPaxosDisks $diskLines $quorumNodeNumbers $quorumNodeNames mmchconfig
1840  if [[ $? -ne 0 ]]
1841  then
1842    # GPFS failed to initialize the tiebreaker disks.
1843    printErrorMsg 132 $mmcmd
1844    return 1
1845  fi
1846
1847  # Everything must be OK.
1848  return 0
1849
1850}  #----- end of function setDiskQuorum --------------------------
1851
1852
1853#######################################################################
1854#
1855# Function:  Verifies that the mmfixcfg command executed successfully.
1856#            If the return code from the command is not zero,
1857#            the function issues a message, and exits via the
1858#            cleanupAndExit routine.
1859#
1860# Input:     $1 - name of the parameter being changed
1861#            $2 - return code from the mmfixcfg command
1862#
1863# Output:    None
1864#
1865# Returns:   0 - command finished successfully
1866#            If error, no return; processing is stopped.
1867#
1868#######################################################################
1869function checkForMmfixcfgErrors   # <argument> <rc>
1870{
1871  typeset sourceFile="mmchconfig.sh"
1872  [[ -n $DEBUG || -n $DEBUGcheckForMmfixcfgErrors ]] && set -x
1873  $mmTRACE_ENTER "$*"
1874
1875  if [ $2 != "0" ]
1876  then
1877    # mmfixcfg error
1878    printErrorMsg 79 "$mmcmd" "$1"
1879    cleanupAndExit
1880  fi
1881
1882  $mmTRACE_EXIT "rc=0"
1883
1884}  #----- end of function checkForMmfixcfgErrors -----------------
1885
1886
1887
1888######################
1889# Mainline processing
1890######################
1891
1892
1893#################################
1894# Process the command arguments.
1895#################################
1896[[ $arg1 = '-?' || $arg1 = '-h' || $arg1 = '--help' || $arg1 = '--' ]] &&  \
1897  syntaxError "help" $usageMsg
1898
1899[[ $argc -lt 1  ]] &&  \
1900  syntaxError "missingArgs" $usageMsg
1901
1902# The attributes to be changed are always the first argument.
1903attributeList=$arg1
1904shift 1
1905argc=argc-1
1906
1907while getopts :iIn:N: OPT
1908do
1909  case $OPT in
1910
1911    i) # immediate option
1912       [[ $iarg = yes ]] && syntaxError "multiple" $noUsageMsg "-$OPT"
1913       immediate="-i";
1914       iarg=yes
1915       argc=argc-1
1916       ;;
1917
1918    I) # immediate-only option
1919       [[ $Iarg = yes ]] && syntaxError "multiple" $noUsageMsg "-$OPT"
1920       immediate="-I";
1921       immediateOnly=yes
1922       Iarg=yes
1923       argc=argc-1
1924       ;;
1925
1926    n) # node names file
1927       [[ -n $narg ]] && syntaxError "multiple" $noUsageMsg "-$OPT"
1928       nflag="-$OPT"
1929       narg=$OPTARG
1930       argc=argc-2
1931       [[ -n $Nflag ]] &&  \
1932         syntaxError "invalidCombination" $usageMsg $nflag $Nflag
1933       ;;
1934
1935    N) # node names list, file, or class
1936       [[ -n $Narg ]] && syntaxError "multiple" $noUsageMsg "-$OPT"
1937       Nflag="-$OPT"
1938       Narg=$OPTARG
1939       argc=argc-2
1940       [[ -n $nflag ]] &&  \
1941         syntaxError "invalidCombination" $usageMsg $Nflag $nflag
1942       ;;
1943
1944    +[iInN]) # Invalid option
1945       syntaxError "invalidOption" $usageMsg $OPT
1946       ;;
1947
1948    :) # Missing argument
1949       syntaxError "missingValue" $usageMsg $OPTARG
1950       ;;
1951
1952    *) # Invalid option
1953       syntaxError "invalidOption" $usageMsg $OPTARG
1954       ;;
1955
1956  esac
1957
1958done   # end of while getopts :iIn:N: OPT
1959
1960# Drop the processed options from the parameter list.
1961shift OPTIND-1
1962
1963# Complete the parameter checking.
1964if [[ -n $Narg ]]
1965then
1966  # Set vars to indicate that node names were specified.
1967  nodeNames=$Narg
1968  arglist=yes
1969
1970elif [[ -z $narg ]]
1971then
1972  # If the -n option is not used, a list of node names is allowed.
1973  if [[ $argc -eq 1 ]]
1974  then
1975    # If there is exactly one string left,
1976    # it is assumed to be a list of nodes.
1977    arglist=$1
1978
1979    # Convert the input node list into a file.
1980    $rm -f $inputNodes
1981    IFS=','
1982    for nodeName in $arglist
1983    do
1984      print -- "$nodeName" >> $inputNodes
1985      checkForErrors "writing to $inputNodes" $?
1986    done
1987    IFS="$IFS_sv"    # Restore the default IFS settings.
1988    nodeNames=$inputNodes
1989    arglist=yes
1990
1991  elif [[ $argc -gt 1 ]]
1992  then
1993    # If more than one string is left, we have a syntax error.
1994    syntaxError "extraArg" $usageMsg "$2"
1995  else
1996    # No node names were specified.
1997    :  # Do nothing; the change is for all nodes.
1998  fi
1999
2000else
2001  # -n was specified, so there should be no other parms.
2002  [[ $argc -gt 0 ]] &&  \
2003    syntaxError "extraArg" $usageMsg "$1"
2004
2005  nodeNames=$narg
2006  arglist=yes
2007
2008fi   # end of if [[ -n $Narg ]]
2009
2010# If a node list or node file was specified on the command line,
2011# create a file containing the IP address and the original node
2012# identifier of each of the nodes.
2013if [[ -n $nodeNames ]]
2014then
2015  createVerifiedNodefile $nodeNames $IPA_Field yes $chnodes
2016  [[ $? -ne 0 ]] && cleanupAndExit
2017fi
2018
2019
2020#######################################################################
2021# Set up trap exception handling and call the gpfsInit function.
2022# It will ensure that the local copy of the mmsdrfs and the rest of
2023# the GPFS system files are up-to-date and will obtain the sdr lock.
2024#######################################################################
2025trap pretrap HUP INT QUIT KILL
2026gpfsInitOutput=$(gpfsInit $lockId)
2027setGlobalVar $? $gpfsInitOutput
2028
2029
2030########################################################################
2031# Call the mmchconfigCommonProcessing local function.  It makes sure
2032# that the input node list has no errors in it, and performs other
2033# common for all attributes processing.  If any error is discovered,
2034# the function terminates the command via the cleanupAndExit routine.
2035########################################################################
2036mmchconfigCommonProcessing
2037
2038
2039###############################################
2040# Start of main loop
2041###############################################
2042IFS=","
2043for attributePair in $attributeList
2044do
2045  # Parse the attribute=value pair.
2046  IFS="="
2047  set -f ; set -- $attributePair ; set +f
2048  attr=$1
2049  value=$2
2050  junk=$3
2051  IFS="$IFS_sv"
2052
2053  [[ $attributePair != *=* || -n $junk ]] &&  \
2054    syntaxError "invalidAttrValuePair" $usageMsg $attributePair
2055
2056  [[ -z $value || $value = DELETE ]] && value=DEFAULT
2057
2058
2059  # Processing depends on the attribute type being changed.
2060  ignoreNodeList=""
2061  attr_lc=$attr        # Convert attr to lower case only.
2062  case $attr_lc in
2063
2064    #-----------
2065    "pagepool" )  # Documented attribute
2066    #-----------
2067      if [[ $value != DEFAULT ]]
2068      then
2069        # Verify the value is an integer.
2070        # Range checking is left for the daemon.
2071        intValue=$(checkIntRange pagepool $value)
2072        [[ $? -ne 0 ]] && cleanupAndExit
2073      fi
2074
2075      # If needed, set parameters for the tschpool command.
2076      if [[ -n $immediate ]]
2077      then
2078        if [[ $value = DEFAULT ]]
2079        then
2080          tschpoolParms="$tschpoolParms -s 64M "
2081        else
2082          tschpoolParms="$tschpoolParms -s $value "
2083        fi
2084      fi
2085
2086      # Make the change to the work copy of the mmfs.cfg file.
2087      attr="pagepool"
2088      mmfscfgChange=yes
2089      ;;
2090
2091
2092    #------------------
2093    "maxbufferdescs" )
2094    #------------------
2095      if [[ $value != DEFAULT ]]
2096      then
2097        # Convert attribute value into a simple integer.
2098        intValue=$(checkIntRange maxBufferDescs $value 512 1000000)
2099        [[ $? -ne 0 ]] && cleanupAndExit
2100      fi
2101
2102      if [[ -n $immediate ]]
2103      then
2104        # -i cannot be used.
2105        printErrorMsg 375 $mmcmd $immediate $attr
2106        cleanupAndExit
2107      fi
2108
2109      # Make the change to the work copy of the mmfs.cfg file.
2110      attr="maxBufferDescs"
2111      mmfscfgChange=yes
2112      ;;
2113
2114
2115    #------------------
2116    "maxfilestocache" )  # Documented attribute
2117    #------------------
2118      if [[ $value != DEFAULT ]]
2119      then
2120        # Convert attribute value into a simple integer.
2121        intValue=$(checkIntRange maxFilesToCache $value 1 100000)
2122        [[ $? -ne 0 ]] && cleanupAndExit
2123      fi
2124
2125      if [[ -n $immediate ]]
2126      then
2127        # -i cannot be used.
2128        printErrorMsg 375 $mmcmd $immediate $attr
2129        cleanupAndExit
2130      fi
2131
2132      # Make the change to the work copy of the mmfs.cfg file.
2133      attr="maxFilesToCache"
2134      mmfscfgChange=yes
2135      ;;
2136
2137
2138    #---------------
2139    "maxstatcache" )  # Documented attribute
2140    #---------------
2141      if [[ $value != DEFAULT ]]
2142      then
2143        # Convert attribute value into a simple integer.
2144        intValue=$(checkIntRange maxStatCache $value 0 10000000)
2145        [[ $? -ne 0 ]] && cleanupAndExit
2146      fi
2147
2148      if [[ -n $immediate ]]
2149      then
2150        # -i cannot be used.
2151        printErrorMsg 375 $mmcmd $immediate $attr
2152        cleanupAndExit
2153      fi
2154
2155      # Make the change to the work copy of the mmfs.cfg file.
2156      attr="maxStatCache"
2157      mmfscfgChange=yes
2158      ;;
2159
2160
2161    #------------------
2162    "statcachedirpct" )
2163    #------------------
2164      if [[ $value != DEFAULT ]]
2165      then
2166        # Convert attribute value into a simple integer.
2167        intValue=$(checkIntRange statCacheDirPct $value 0 90)
2168        [[ $? -ne 0 ]] && cleanupAndExit
2169      fi
2170
2171      if [[ -n $immediate ]]
2172      then
2173        # -i cannot be used.
2174        printErrorMsg 375 $mmcmd $immediate $attr
2175        cleanupAndExit
2176      fi
2177
2178      # Make the change to the work copy of the mmfs.cfg file.
2179      attr="statCacheDirPct"
2180      mmfscfgChange=yes
2181      ;;
2182
2183
2184    #-------------------
2185    "maxdiskaddrbuffs" )
2186    #-------------------
2187      if [[ $value != DEFAULT ]]
2188      then
2189        # Convert attribute value into a simple integer.
2190        intValue=$(checkIntRange maxDiskAddrBuffs $value 0 1000000)
2191        [[ $? -ne 0 ]] && cleanupAndExit
2192      fi
2193
2194      if [[ -n $immediate ]]
2195      then
2196        # -i cannot be used.
2197        printErrorMsg 375 $mmcmd $immediate $attr
2198        cleanupAndExit
2199      fi
2200
2201      # Make the change to the work copy of the mmfs.cfg file.
2202      attr="maxDiskAddrBuffs"
2203      mmfscfgChange=yes
2204      ;;
2205
2206
2207    #--------------------
2208    "datastructuredump" )  # Documented attribute
2209    #--------------------
2210      if [[ $value != DEFAULT ]]
2211      then
2212        # Acceptable values are 'yes', 'no' or an absolute path name.
2213        if [[ $value != yes && $value != no && $value = ${value#/} ]]
2214        then
2215          printErrorMsg 149 $mmcmd dataStructureDump $value
2216          cleanupAndExit
2217        fi
2218      fi
2219
2220      # If needed, set parameters for the tsctl command.
2221      if [[ -n $immediate ]]
2222      then
2223        if [[ $value = DEFAULT ]]
2224        then
2225          tsctlParms="$tsctlParms $attr yes "
2226        else
2227          tsctlParms="$tsctlParms $attr $value "
2228        fi
2229      fi
2230
2231      # Make the change to the work copy of the mmfs.cfg file.
2232      attr="dataStructureDump"
2233      mmfscfgChange=yes
2234      ;;
2235
2236
2237    #-----------------------------
2238    "datastructuredumponsgpanic" )
2239    #-----------------------------
2240      if [[ $value != DEFAULT ]]
2241      then
2242        # Acceptable values are 'yes', 'no' or an absolute path name.
2243        if [[ $value != yes && $value != no && $value = ${value#/} ]]
2244        then
2245          printErrorMsg 149 $mmcmd dataStructureDumpOnSGPanic $value
2246          cleanupAndExit
2247        fi
2248      fi
2249
2250      # If needed, set parameters for the tsctl command.
2251      if [[ -n $immediate ]]
2252      then
2253        if [[ $value = DEFAULT ]]
2254        then
2255          tsctlParms="$tsctlParms $attr no "
2256        else
2257          tsctlParms="$tsctlParms $attr $value "
2258        fi
2259      fi
2260
2261      # Make the change to the work copy of the mmfs.cfg file.
2262      attr="dataStructureDumpOnSGPanic"
2263      mmfscfgChange=yes
2264      ;;
2265
2266
2267    #---------
2268    "envvar" )    # Documented attribute
2269    #---------
2270      if [[ -n $immediate ]]
2271      then
2272        # -i cannot be used.
2273        printErrorMsg 375 $mmcmd $immediate $attr
2274        cleanupAndExit
2275      fi
2276
2277      # Make the change to the work copy of the mmfs.cfg file.
2278      attr="envVar"
2279      mmfscfgChange=yes
2280      ;;
2281
2282
2283    #------------
2284    "uiddomain" )    # Documented attribute
2285    #------------
2286      if [[ -n "$arglist" ]]
2287      then
2288        # <nodelist> cannot be used.
2289        printErrorMsg 192 $mmcmd $attr
2290        cleanupAndExit
2291      fi
2292
2293      if [[ -n $immediate ]]
2294      then
2295        # -i cannot be used.
2296        printErrorMsg 375 $mmcmd $immediate $attr
2297        cleanupAndExit
2298      fi
2299
2300      # The daemon must be down on all nodes in the cluster.
2301      if [[ -z $daemonInactiveVerified ]]
2302      then
2303        printInfoMsg 339
2304        verifyDaemonInactive $allnodes $mmcmd
2305        [[ $? -ne 0 ]] && cleanupAndExit
2306        daemonInactiveVerified=yes
2307      fi
2308
2309      # Make the change to the work copy of the mmfs.cfg file.
2310      attr="uidDomain"
2311      mmfscfgChange=yes
2312      ;;
2313
2314
2315    #---------------
2316    "automountdir" )       # Documented attribute
2317    #---------------
2318      if [[ $value != DEFAULT ]]
2319      then
2320        # The value must be an absolute path name.
2321        if [[ $value = ${value#/} ]]
2322        then
2323          printErrorMsg 149 $mmcmd automountDir $value
2324          cleanupAndExit
2325        fi
2326      fi
2327
2328      if [[ -n "$arglist" ]]
2329      then
2330        # <nodelist> cannot be used.
2331        printErrorMsg 192 $mmcmd $attr
2332        cleanupAndExit
2333      fi
2334
2335      if [[ -n $immediate ]]
2336      then
2337        # -i cannot be used.
2338        printErrorMsg 375 $mmcmd $immediate $attr
2339        cleanupAndExit
2340      fi
2341
2342      # The daemon must be down on all nodes in the cluster.
2343      if [[ -z $daemonInactiveVerified ]]
2344      then
2345        printInfoMsg 339
2346        verifyDaemonInactive $allnodes $mmcmd
2347        [[ $? -ne 0 ]] && cleanupAndExit
2348        daemonInactiveVerified=yes
2349      fi
2350
2351      # Make the change to the work copy of the mmfs.cfg file.
2352      attr="automountDir"
2353      mmfscfgChange=yes
2354      ;;
2355
2356
2357    #-------------------------
2358    "allowremoteconnections" )
2359    #-------------------------
2360      if [[ $value != DEFAULT ]]
2361      then
2362        # Check the new attribute value.
2363        if [[ $value != yes && $value != no ]]
2364        then
2365          printErrorMsg 37 $mmcmd $attr
2366          cleanupAndExit
2367        fi
2368      fi
2369
2370      if [[ -n "$arglist" ]]
2371      then
2372        # <nodelist> cannot be used.
2373        printErrorMsg 192 $mmcmd $attr
2374        cleanupAndExit
2375      fi
2376
2377      if [[ -n $immediate ]]
2378      then
2379        # -i cannot be used.
2380        printErrorMsg 375 $mmcmd $immediate $attr
2381        cleanupAndExit
2382      fi
2383
2384      # The daemon must be down on all nodes in the cluster.
2385      if [[ -z $daemonInactiveVerified ]]
2386      then
2387        printInfoMsg 339
2388        verifyDaemonInactive $allnodes $mmcmd
2389        [[ $? -ne 0 ]] && cleanupAndExit
2390        daemonInactiveVerified=yes
2391      fi
2392
2393      # Make the change to the work copy of the mmfs.cfg file.
2394      attr="allowRemoteConnections"
2395      mmfscfgChange=yes
2396      ;;
2397
2398
2399    #------------------------
2400    "allowdummyconnections" )
2401    #------------------------
2402      if [[ $value != DEFAULT ]]
2403      then
2404        # Check the new attribute value.
2405        if [[ $value != yes && $value != no ]]
2406        then
2407          printErrorMsg 37 $mmcmd $attr
2408          cleanupAndExit
2409        fi
2410      fi
2411
2412      if [[ -n "$arglist" ]]
2413      then
2414        # <nodelist> cannot be used.
2415        printErrorMsg 192 $mmcmd $attr
2416        cleanupAndExit
2417      fi
2418
2419      if [[ -n $immediate ]]
2420      then
2421        # -i cannot be used.
2422        printErrorMsg 375 $mmcmd $immediate $attr
2423        cleanupAndExit
2424      fi
2425
2426      # The daemon must be down on all nodes in the cluster.
2427      if [[ -z $daemonInactiveVerified ]]
2428      then
2429        printInfoMsg 339
2430        verifyDaemonInactive $allnodes $mmcmd
2431        [[ $? -ne 0 ]] && cleanupAndExit
2432        daemonInactiveVerified=yes
2433      fi
2434
2435      # Make the change to the work copy of the mmfs.cfg file.
2436      attr="allowDummyConnections"
2437      mmfscfgChange=yes
2438      ;;
2439
2440
2441    #-----------------
2442    "openssllibname" )
2443    #-----------------
2444      # Make the change to the work copy of the mmfs.cfg file.
2445      attr="openssllibname"
2446      mmfscfgChange=yes
2447      ;;
2448
2449
2450    #-------------
2451    "cipherlist" )  # Documented attribute
2452    #-------------
2453      [[ $value = EMPTY ]] && value=DEFAULT
2454
2455      if [[ -n "$arglist" ]]
2456      then
2457        # <nodelist> cannot be used.
2458        printErrorMsg 192 $mmcmd $attr
2459        cleanupAndExit
2460      fi
2461
2462      if [[ -n $immediate ]]
2463      then
2464        # -i cannot be used.
2465        printErrorMsg 375 $mmcmd $immediate $attr
2466        cleanupAndExit
2467      fi
2468
2469      if [[ $value != DEFAULT ]]
2470      then
2471        # Ensure OpenSSL is installed.
2472        if [[ ! -x $openssl ]]
2473        then
2474          print -u2 "$mmcmd: $openssl not found."
2475          print -u2 "     Ensure the OpenSSL code is properly installed."
2476          cleanupAndExit
2477        fi
2478
2479        # Replace any colons in the cipher list string with commas.
2480        cipherList=$(print -- "$value" | $sed 's/:/,/g')
2481
2482        # Ensure the version of openssl installed on this node
2483        # understands cipherList before setting it.
2484        if [[ $cipherList = "AUTHONLY" ]]
2485        then
2486          ciphers=$($openssl ciphers "NULL-SHA")
2487        elif [[ $cipherList = *"AUTHONLY"* ]]
2488        then
2489          print -u2 "$mmcmd:  AUTHONLY cannot be specified in conjunction with other ciphers."
2490        else
2491          ciphers=$($openssl ciphers rsa "$cipherList")
2492        fi
2493
2494        if [[ $cipherList != "AUTHONLY" && $sdrfsFormatLevel -eq 0 ]]
2495        then
2496          print -u2 "$mmcmd:  Support for cipher lists other than AUTHONLY has not been enabled yet."
2497          print -u2 "    Run \"mmchconfig release=LATEST\" to activate the new function."
2498          cleanupAndExit
2499        fi
2500
2501        if [[ -z "$ciphers" ]]
2502        then
2503          # The specified cipher list is not supported.
2504          printErrorMsg 483 $mmcmd "$value"
2505          cleanupAndExit
2506        else
2507          :  # The new cipher list is acceptable.
2508        fi  # end of if [[ -z "$ciphers" ]]
2509
2510        secLevel=1
2511
2512      else
2513        cipherList=""
2514        secLevel=0
2515      fi  # end of if [[ $value != DEFAULT ]]
2516
2517      # Make the change in the working copy of the mmsdrfs file.
2518      # Return the genkey generation number.
2519      keyGenNumber=$($awk -F:  '                                                  \
2520         /^'$GLOBAL_ID:$VERSION_LINE:'/ {                                         \
2521            # If this is the version line, update the SECLEVEL field.             \
2522            { $'$SECLEVEL_Field' = "'$secLevel'" }                                \
2523            { print  $1":" $2":" $3":" $4":" $5":" $6":" $7":" $8":" $9":"$10":"  \
2524                    $11":"$12":"$13":"$14":"$15":"$16":"$17":"$18":"$19":"$20":"  \
2525                    $21":"$22":"$23":"$24":"$25":"$26":"$27":" >> "'$tmpsdrfs'" } \
2526            # Return the current value of the genkey generation number.           \
2527            { print $'$NEW_KEY_Field' }                                           \
2528            { next }                                                              \
2529         }                                                                        \
2530         /^'$HOME_CLUSTER:$NODESET_HDR:'/ {                                       \
2531            # If this is the header line, update the cipher list field.           \
2532            { $'$CIPHER_LIST_Field' = "'$cipherList'" }                           \
2533            { print  $1":" $2":" $3":" $4":" $5":" $6":" $7":" $8":" $9":"$10":"  \
2534                    $11":"$12":"$13":"$14":"$15":"$16":"$17":"$18":"$19":"$20":"  \
2535                    $21":"$22":"$23":"$24":"$25":"$26":"$27":" >> "'$tmpsdrfs'" } \
2536            { next }                                                              \
2537         }                                                                        \
2538         # All other lines are echoed without change.                             \
2539         { print $0 >> "'$tmpsdrfs'" }                                            \
2540      ' $newsdrfs)
2541      checkForErrors awk $?
2542
2543      # Ensure that an authentication key file exists.
2544      if [[ $keyGenNumber -eq 0 && $secLevel -gt 0 ]]
2545      then
2546        # Run "mmauth genkey" first.
2547        printErrorMsg 307 $mmcmd
2548        cleanupAndExit
2549      fi
2550
2551      # The file was updated successfully.
2552      $mv $tmpsdrfs $newsdrfs
2553      checkForErrors "mv $tmpsdrfs $newsdrfs" $?
2554      mmsdrfsModified=yes
2555
2556      # The daemon must be down on all nodes if the multiple keys support
2557      # has not been activated yet or if we are about to switch from
2558      # a non-secure to a secure environment or vice-versa.
2559      if [[ $sdrfsFormatLevel -eq 0 || $currentCipherList != $value &&
2560            ( $currentCipherList = DEFAULT || $value = DEFAULT ) ]]
2561      then
2562        if [[ -z $daemonInactiveVerified ]]
2563        then
2564          printInfoMsg 339
2565          verifyDaemonInactive $allnodes $mmcmd
2566          [[ $? -ne 0 ]] && cleanupAndExit
2567          daemonInactiveVerified=yes
2568        fi
2569      fi
2570
2571      # Make the change to the work copy of the mmfs.cfg file.
2572      attr="cipherList"
2573      mmfscfgChange=yes
2574      ;;
2575
2576
2577    #----------------------
2578    "maxreceiverthreads" )
2579    #----------------------
2580      if [[ $value != DEFAULT ]]
2581      then
2582        n=$(checkIntRange maxReceiverThreads $value 1 128)
2583        [[ $? -ne 0 ]] && cleanupAndExit
2584      fi
2585
2586      if [[ -n $immediate ]]
2587      then
2588        # -i cannot be used.
2589        printErrorMsg 375 $mmcmd $immediate $attr
2590        cleanupAndExit
2591      fi
2592
2593      # Make the change to the work copy of the mmfs.cfg file.
2594      attr="maxReceiverThreads"
2595      mmfscfgChange=yes
2596      ;;
2597
2598
2599    #--------------------
2600    "dmapieventtimeout" )  # Documented attribute
2601    #--------------------
2602      if [[ $value != DEFAULT ]]
2603      then
2604        n=$(checkIntRange dmapiEventTimeout $value)
2605        [[ $? -ne 0 ]] && cleanupAndExit
2606      fi
2607
2608      # If needed, set parameters for the tsctl command.
2609      if [[ -n $immediate ]]
2610      then
2611        if [[ $value = DEFAULT ]]
2612        then
2613          tsctlParms="$tsctlParms $attr 86400000 "
2614        else
2615          tsctlParms="$tsctlParms $attr $value "
2616        fi
2617      fi
2618
2619      # Make the change to the work copy of the mmfs.cfg file.
2620      attr="dmapiEventTimeout"
2621      mmfscfgChange=yes
2622      ;;
2623
2624
2625    #-----------------------------
2626    "dmapisessionfailuretimeout" )  # Documented attribute
2627    #-----------------------------
2628      if [[ $value != DEFAULT ]]
2629      then
2630        n=$(checkIntRange dmapiSessionFailureTimeout $value)
2631        [[ $? -ne 0 ]] && cleanupAndExit
2632      fi
2633
2634      # If needed, set parameters for the tsctl command.
2635      if [[ -n $immediate ]]
2636      then
2637        if [[ $value = DEFAULT ]]
2638        then
2639          tsctlParms="$tsctlParms $attr 0 "
2640        else
2641          tsctlParms="$tsctlParms $attr $value "
2642        fi
2643      fi
2644
2645      # Make the change to the work copy of the mmfs.cfg file.
2646      attr="dmapiSessionFailureTimeout"
2647      mmfscfgChange=yes
2648      ;;
2649
2650
2651    #--------------------
2652    "dmapimounttimeout" )  # Documented attribute
2653    #--------------------
2654      if [[ $value != DEFAULT ]]
2655      then
2656        n=$(checkIntRange dmapiMountTimeout $value)
2657        [[ $? -ne 0 ]] && cleanupAndExit
2658      fi
2659
2660      # If needed, set parameters for the tsctl command.
2661      if [[ -n $immediate ]]
2662      then
2663        if [[ $value = DEFAULT ]]
2664        then
2665          tsctlParms="$tsctlParms $attr 60 "
2666        else
2667          tsctlParms="$tsctlParms $attr $value "
2668        fi
2669      fi
2670
2671      # Make the change to the work copy of the mmfs.cfg file.
2672      attr="dmapiMountTimeout"
2673      mmfscfgChange=yes
2674      ;;
2675
2676
2677    #------------------
2678    "tiebreakerdisks" )        # Documented attribute
2679    #------------------
2680      if [[ "$value" = *+([-:${BLANKchar}${TABchar}])* ]]
2681      then
2682        # Use semi-colon (;) to separate the disk names.
2683        printErrorMsg 62 $mmcmd
2684        cleanupAndExit
2685      fi
2686
2687      if [[ -n "$arglist" ]]
2688      then
2689        # <nodelist> cannot be used.
2690        printErrorMsg 192 $mmcmd $attr
2691        cleanupAndExit
2692      fi
2693
2694      if [[ -n $immediate ]]
2695      then
2696        # -i cannot be used.
2697        printErrorMsg 375 $mmcmd $immediate $attr
2698        cleanupAndExit
2699      fi
2700
2701      # Daemon must be down when changing quorum semantics.
2702      if [[ -z $daemonInactiveVerified ]]
2703      then
2704        printInfoMsg 339
2705        verifyDaemonInactive $allnodes $mmcmd
2706        [[ $? -ne 0 ]] && cleanupAndExit
2707        daemonInactiveVerified=yes
2708      fi
2709
2710      # If going back to regular node quorum, nothing special to do.
2711      # If switching to disk-based quorum, or if changing the set
2712      # of quorum disks, call the setDiskQuorum routine to
2713      # prepare the disks.
2714      if [[ $value != no && $value != DEFAULT ]]
2715      then
2716        setDiskQuorum "$value" $newsdrfs
2717        rc=$?
2718        if [[ $rc -ne 0 ]]
2719        then
2720          # Command failed.
2721          printErrorMsg 389 $mmcmd
2722          cleanupAndExit $rc
2723        fi
2724      fi  # end of if [[ $value != no && $value != DEFAULT ]]
2725
2726      # Make the change to the work copy of the mmfs.cfg file.
2727      attr="tiebreakerDisks"
2728      mmfscfgChange=yes
2729      mmsdrfsModified=yes
2730      ;;
2731
2732
2733    #------------------
2734    "minquorumnodes" )
2735    #------------------
2736      if [[ $value != DEFAULT ]]
2737      then
2738        n=$(checkIntRange minQuorumNodes $value 1 5)
2739        [[ $? -ne 0 ]] && cleanupAndExit
2740      fi
2741
2742      if [[ -n "$arglist" ]]
2743      then
2744        # <nodelist> cannot be used.
2745        printErrorMsg 192 $mmcmd $attr
2746        cleanupAndExit
2747      fi
2748
2749      if [[ -n $immediate ]]
2750      then
2751        # -i cannot be used.
2752        printErrorMsg 375 $mmcmd $immediate $attr
2753        cleanupAndExit
2754      fi
2755
2756      # Make the change to the work copy of the mmfs.cfg file.
2757      attr="minQuorumNodes"
2758      mmfscfgChange=yes
2759      ;;
2760
2761
2762    #--------------
2763    "designation" )  # Documented attribute
2764    #--------------
2765      # The detailed syntax check is done in function changeNodeDesignation.
2766      if [[ "$value" = *+([;:${BLANKchar}${TABchar}])* ]]
2767      then
2768        # Use the dash character to separate multiple node designations.
2769        printErrorMsg 61 $mmcmd
2770        cleanupAndExit
2771      fi
2772      [[ $value = DEFAULT ]] && value=quorum-client
2773
2774      # Ensure there will be at least one quorum node in the cluster.
2775      if [[ $value = *nonquorum* && -z "$arglist" ]]
2776      then
2777        printErrorMsg 53 $mmcmd
2778        cleanupAndExit
2779      fi
2780
2781      # Make the change in the MEMBER_NODE lines.
2782      if [[ -z "$arglist" ]]
2783      then
2784        changeNodeDesignation "$value" $newsdrfs
2785        rc=$?
2786      else
2787        changeNodeDesignation "$value" $newsdrfs $nodefile
2788        rc=$?
2789      fi
2790      [[ $rc -ne 0 ]] && cleanupAndExit
2791      mmsdrfsModified=yes
2792      [[ $propagateOptions != *rereadNodeList* ]] &&  \
2793        propagateOptions=rereadNodeList,${propagateOptions}
2794      ;;
2795
2796
2797    #-----------
2798    "autoload" )   # Documented attribute
2799    #-----------
2800      # Check the new attribute value.
2801      [[ $value = DEFAULT ]] && value=no
2802      if [[ $value != yes && $value != no ]]
2803      then
2804        printErrorMsg 37 $mmcmd $attr
2805        cleanupAndExit
2806      fi
2807
2808      if [[ -n $immediate ]]
2809      then
2810        # -i cannot be used.
2811        printErrorMsg 375 $mmcmd $immediate $attr
2812        cleanupAndExit
2813      fi
2814
2815      # Make the change to the work copy of the mmfs.cfg file.
2816      attr="autoload"
2817      mmfscfgChange=yes
2818      ;;
2819
2820
2821    #---------------
2822    "maxblocksize" )   # Documented attribute
2823    #---------------
2824      if [[ $value != DEFAULT ]]
2825      then
2826        # Convert attribute value into a simple integer.
2827        intValue=$(checkIntRange maxblocksize $value 16K 16M)
2828        [[ $? -ne 0 ]] && cleanupAndExit
2829      fi
2830
2831      if [[ -n $immediate ]]
2832      then
2833        # -i cannot be used.
2834        printErrorMsg 375 $mmcmd $immediate $attr
2835        cleanupAndExit
2836      fi
2837
2838      # Make the change to the work copy of the mmfs.cfg file.
2839      attr="maxblocksize"
2840      mmfscfgChange=yes
2841      ;;
2842
2843
2844    #-----------------
2845    "updatedisktype" )     # Documented attribute
2846    #-----------------
2847      [[ $value = DEFAULT ]] && value=all
2848      if [[ $value != "all" && $value != "yes" && $value != /* ]]
2849      then
2850        # Incorrect value for this option.
2851        printErrorMsg 153 $mmcmd $attr
2852        cleanupAndExit
2853      fi
2854
2855      if [[ -n $immediate ]]
2856      then
2857        # -i cannot be used.
2858        printErrorMsg 375 $mmcmd $immediate $attr
2859        cleanupAndExit
2860      fi
2861
2862      # Reevaluate the disk type for all disks in the cluster.
2863      updateDiskType $value $newsdrfs
2864      rc=$?
2865      [[ $rc -ne 0 ]] && cleanupAndExit
2866      mmsdrfsModified=yes
2867      ;;
2868
2869
2870    #-------------
2871    "pindaemon"  )
2872    #-------------
2873      if [[ $value != DEFAULT ]]
2874      then
2875        # Check the new attribute value.
2876        if [[ $value != yes && $value != no ]]
2877        then
2878          printErrorMsg 37 $mmcmd $attr
2879          cleanupAndExit
2880        fi
2881      fi
2882
2883      if [[ -n "$arglist" ]]
2884      then
2885        # <nodelist> cannot be used.
2886        printErrorMsg 192 $mmcmd $attr
2887        cleanupAndExit
2888      fi
2889
2890      if [[ -n $immediate ]]
2891      then
2892        # -i cannot be used.
2893        printErrorMsg 375 $mmcmd $immediate $attr
2894        cleanupAndExit
2895      fi
2896
2897      # Make the change to the work copy of the mmfs.cfg file.
2898      attr="pindaemon"
2899      mmfscfgChange=yes
2900      ;;
2901
2902
2903    #-------------------------
2904    "tcpport" | "tsctcpport" )
2905    #-------------------------
2906      # Convert attribute value into a simple integer.
2907      [[ $value = DEFAULT ]] && value=$defaultTcpPort
2908      intValue=$(checkIntRange tscTcpPort $value)
2909      [[ $? -ne 0 ]] && cleanupAndExit
2910
2911      if [[ -n "$arglist" ]]
2912      then
2913        # <nodelist> cannot be used.
2914        printErrorMsg 192 $mmcmd $attr
2915        cleanupAndExit
2916      fi
2917
2918      if [[ -n $immediate ]]
2919      then
2920        # -i cannot be used.
2921        printErrorMsg 375 $mmcmd $immediate $attr
2922        cleanupAndExit
2923      fi
2924
2925      # Find and parse the NODESET_HDR line.
2926      sdrfsLine=$($grep -e "^$nodesetId:$NODESET_HDR::" $newsdrfs)
2927      IFS=":"
2928      set -f ; set -A v -- - $sdrfsLine ; set +f
2929      IFS="$IFS_sv"
2930
2931      # Set the new value and put the line back
2932      v[$TCP_PORT_Field]=$value
2933      newLine=$(print_newLine)
2934      newGenNumber=$(updateSdrfsFile $newsdrfs "$nodesetId:$NODESET_HDR::" $newLine)
2935      checkForErrors "updateSdrfsFile $newsdrfs" $?
2936
2937      # The daemon must be down on all nodes in the cluster.
2938      if [[ -z $daemonInactiveVerified ]]
2939      then
2940        printInfoMsg 339
2941        verifyDaemonInactive $allnodes $mmcmd
2942        [[ $? -ne 0 ]] && cleanupAndExit
2943        daemonInactiveVerified=yes
2944      fi
2945
2946      # Make the change to the work copy of the mmfs.cfg file.
2947      attr="tscTcpPort"
2948      mmfscfgChange=yes
2949      ;;
2950
2951
2952    #-------------------------------------------
2953    "gpfseventsport" | "eventsexportertcpport" )
2954    #-------------------------------------------
2955      if [[ $value = DEFAULT ]]
2956      then
2957        # The default is the value of tscTcpPort, whatever it happens to be.
2958        # This is reflected by storing null in the mmsdrfs file.
2959        value=""
2960      else
2961        # Convert attribute value into a simple integer.
2962        intValue=$(checkIntRange eventsExporterTcpPort $value)
2963        [[ $? -ne 0 ]] && cleanupAndExit
2964      fi
2965
2966      if [[ -n "$arglist" ]]
2967      then
2968        # <nodelist> cannot be used.
2969        printErrorMsg 192 $mmcmd $attr
2970        cleanupAndExit
2971      fi
2972
2973      if [[ -n $immediate ]]
2974      then
2975        # -i cannot be used.
2976        printErrorMsg 375 $mmcmd $immediate $attr
2977        cleanupAndExit
2978      fi
2979
2980      # Make the change in the working copy of the mmsdrfs file.
2981      $awk -F:  '                                                                 \
2982         # If this is the NODESET_HDR line, update the EVENTS_PORT_Field.         \
2983         /^'$HOME_CLUSTER:$NODESET_HDR:'/ {                                       \
2984            { $'$EVENTS_PORT_Field' = "'$value'" }                                \
2985            { print  $1":" $2":" $3":" $4":" $5":" $6":" $7":" $8":" $9":"$10":"  \
2986                    $11":"$12":"$13":"$14":"$15":"$16":"$17":"$18":"$19":"$20":"  \
2987                    $21":"$22":"$23":"$24":"$25":"$26":"$27":" >> "'$tmpsdrfs'" } \
2988            { next }                                                              \
2989         }                                                                        \
2990         # All other lines are echoed without change.                             \
2991         { print $0 >> "'$tmpsdrfs'" }                                            \
2992      ' $newsdrfs
2993      checkForErrors awk $?
2994
2995      # The file was updated successfully.
2996      $mv $tmpsdrfs $newsdrfs
2997      checkForErrors "mv $tmpsdrfs $newsdrfs" $?
2998      mmsdrfsModified=yes
2999
3000      # The daemon must be down on all nodes in the cluster.
3001      if [[ -z $daemonInactiveVerified ]]
3002      then
3003        printInfoMsg 339
3004        verifyDaemonInactive $allnodes $mmcmd
3005        [[ $? -ne 0 ]] && cleanupAndExit
3006        daemonInactiveVerified=yes
3007      fi
3008
3009      # Make the change to the work copy of the mmfs.cfg file.
3010      [[ -z $value ]] && value=DEFAULT
3011      attr="eventsExporterTcpPort"
3012      mmfscfgChange=yes
3013      ;;
3014
3015
3016    #-------------------------------------
3017    "gpfsobjectport" | "mmgetobjdport" | \
3018    "mmsdrservport" | "mmsdrservtcpport" )
3019    #-------------------------------------
3020      if [[ $value = DEFAULT ]]
3021      then
3022        # The default is the value of tscTcpPort, whatever it happens to be.
3023        # This is reflected by storing null in the mmsdrfs file.  Note that
3024        # zero is an acceptable value - it means that mmsdrserv should not
3025        # be used at all.
3026        value=""
3027      else
3028        # Convert attribute value into a simple integer.
3029        intValue=$(checkIntRange mmsdrservTcpPort $value)
3030        [[ $? -ne 0 ]] && cleanupAndExit
3031      fi
3032
3033      if [[ -n "$arglist" ]]
3034      then
3035        # <nodelist> cannot be used.
3036        printErrorMsg 192 $mmcmd $attr
3037        cleanupAndExit
3038      fi
3039
3040      # Make the change in the working copy of the mmsdrfs file.
3041      # The script will also determine if it is necessary to ensure
3042      # that GPFS is not running on the config server nodes.
3043      daemonMustBeDown=$($awk -F:  '                                              \
3044         /^'$HOME_CLUSTER:$NODESET_HDR:'/ {                                       \
3045            { daemonPort = $'$TCP_PORT_Field' }                                   \
3046            { oldSdrPort = $'$GETOBJECT_PORT_Field' }                             \
3047            { newSdrPort = "'$value'" }                                           \
3048            # Decide if the daemon must be down.                                  \
3049            if ( oldSdrPort == "" || oldSdrPort == daemonPort ||                  \
3050                 newSdrPort == "" || newSdrPort == daemonPort ) {                 \
3051              { print "yes" }                                                     \
3052            }                                                                     \
3053            # Update the GETOBJECT_PORT_Field with its new value.                 \
3054            { $'$GETOBJECT_PORT_Field' = "'$value'" }                             \
3055            { print  $1":" $2":" $3":" $4":" $5":" $6":" $7":" $8":" $9":"$10":"  \
3056                    $11":"$12":"$13":"$14":"$15":"$16":"$17":"$18":"$19":"$20":"  \
3057                    $21":"$22":"$23":"$24":"$25":"$26":"$27":" >> "'$tmpsdrfs'" } \
3058            { next }                                                              \
3059         }                                                                        \
3060         # All other lines are echoed without change.                             \
3061         { print $0 >> "'$tmpsdrfs'" }                                            \
3062      ' $newsdrfs)
3063      checkForErrors awk $?
3064
3065      # The file was updated successfully.
3066      $mv $tmpsdrfs $newsdrfs
3067      checkForErrors "mv $tmpsdrfs $newsdrfs" $?
3068      mmsdrfsModified=yes
3069
3070      # Since we are changing the TCP port number, the currently running
3071      # mmsdrserv daemons must be killed before the new instances can be
3072      # started.  This is done as part of the commit process.
3073      commitOption=KILLSDRSERV
3074
3075      # Depending on the old and new values of the sdrserv port,
3076      # it may be necessary to shutdown GPFS on the primary and
3077      # backup server for the change to be accomplished.  If this
3078      # is not done, the config servers may be left over returning
3079      # stale information or mmsdrserv requests may fail because
3080      # an already running daemon cannot take over sdrserv duties.
3081      if [[ -n $daemonMustBeDown && -z $daemonInactiveVerified ]]
3082      then
3083        print -- "${primaryServer}\n${backupServer}" > $tmpNodes
3084        checkForErrors "writing to file $tmpNodes" $?
3085
3086        # Verify the daemon is down; do not lock the Gpfs object.
3087        printInfoMsg 453
3088        verifyDaemonInactive $tmpNodes
3089        [[ $? -ne 0 ]] && cleanupAndExit
3090      fi  # end of if [[ -n $daemonMustBeDown ]]
3091      ;;
3092
3093
3094    #-------------------
3095    "mmsdrservtimeout" )
3096    #-------------------
3097      if [[ $value != DEFAULT ]]
3098      then
3099        n=$(checkIntRange mmsdrservTimeout $value 1 3600)
3100        [[ $? -ne 0 ]] && cleanupAndExit
3101      fi
3102
3103      # Make the change to the work copy of the mmfs.cfg file.
3104      attr="mmsdrservTimeout"
3105      mmfscfgChange=yes
3106      ;;
3107
3108
3109    #----------------------
3110    "mmsdrservworkerpool" )
3111    #----------------------
3112      if [[ $value != DEFAULT ]]
3113      then
3114        n=$(checkIntRange mmsdrservWorkerPool $value)
3115        [[ $? -ne 0 ]] && cleanupAndExit
3116      fi
3117
3118      if [[ -n $immediate ]]
3119      then
3120        # -i cannot be used.
3121        printErrorMsg 375 $mmcmd $immediate $attr
3122        cleanupAndExit
3123      fi
3124
3125      # Make the change to the work copy of the mmfs.cfg file.
3126      attr="mmsdrservWorkerPool"
3127      mmfscfgChange=yes
3128      ;;
3129
3130
3131    #-----------
3132    "priority" )
3133    #-----------
3134      if [[ $value != DEFAULT ]]
3135      then
3136        # Convert attribute value into a simple integer.
3137        intValue=$(checkIntRange priority $value 1 99)
3138        [[ $? -ne 0 ]] && cleanupAndExit
3139      fi
3140
3141      # If needed, set parameters for the tsctl command.
3142      if [[ $value = DEFAULT ]]
3143      then
3144        tsctlParms="$tsctlParms $attr 40 "
3145      else
3146        tsctlParms="$tsctlParms $attr $value "
3147      fi
3148
3149      # Make the change to the work copy of the mmfs.cfg file.
3150      attr="priority"
3151      mmfscfgChange=yes
3152      ;;
3153
3154
3155    #----------------------
3156    "maxdatashippoolsize" )
3157    #----------------------
3158      if [[ $value != DEFAULT ]]
3159      then
3160        # Convert attribute value into a simple integer.
3161        intValue=$(checkIntRange maxDataShipPoolSize $value 32K 1M)
3162        [[ $? -ne 0 ]] && cleanupAndExit
3163      fi
3164
3165      if [[ -n $immediate ]]
3166      then
3167        # -i cannot be used.
3168        printErrorMsg 375 $mmcmd $immediate $attr
3169        cleanupAndExit
3170      fi
3171
3172      # Make the change to the work copy of the mmfs.cfg file.
3173      attr="maxDataShipPoolSize"
3174      mmfscfgChange=yes
3175      ;;
3176
3177
3178    #--------------
3179    "dmapienable" )
3180    #--------------
3181      if [[ $value != DEFAULT ]]
3182      then
3183        # Check the new attribute value.
3184        if [[ $value != yes && $value != no ]]
3185        then
3186          printErrorMsg 37 $mmcmd $attr
3187          cleanupAndExit
3188        fi
3189      fi
3190
3191      if [[ -n $immediate ]]
3192      then
3193        # -i cannot be used.
3194        printErrorMsg 375 $mmcmd $immediate $attr
3195        cleanupAndExit
3196      fi
3197
3198      # Make the change to the work copy of the mmfs.cfg file.
3199      attr="dmapiEnable"
3200      mmfscfgChange=yes
3201      ;;
3202
3203
3204    #---------------------
3205    "dmapiworkerthreads" )
3206    #---------------------
3207      if [[ $value != DEFAULT ]]
3208      then
3209        # Convert attribute value into a simple integer.
3210        intValue=$(checkIntRange dmapiWorkerThreads $value 1 24)
3211        [[ $? -ne 0 ]] && cleanupAndExit
3212      fi
3213
3214      if [[ -n $immediate ]]
3215      then
3216        # -i cannot be used.
3217        printErrorMsg 375 $mmcmd $immediate $attr
3218        cleanupAndExit
3219      fi
3220
3221      # Make the change to the work copy of the mmfs.cfg file.
3222      attr="dmapiWorkerThreads"
3223      mmfscfgChange=yes
3224      ;;
3225
3226
3227    #--------------------
3228    "dmapieventbuffers" )
3229    #--------------------
3230      if [[ $value != DEFAULT ]]
3231      then
3232        # Convert attribute value into a simple integer.
3233        intValue=$(checkIntRange dmapiEventBuffers $value 1 128)
3234        [[ $? -ne 0 ]] && cleanupAndExit
3235      fi
3236
3237      if [[ -n $immediate ]]
3238      then
3239        # -i cannot be used.
3240        printErrorMsg 375 $mmcmd $immediate $attr
3241        cleanupAndExit
3242      fi
3243
3244      # Make the change to the work copy of the mmfs.cfg file.
3245      attr="dmapiEventBuffers"
3246      mmfscfgChange=yes
3247      ;;
3248
3249
3250    #-------------
3251    "tscprimary" )
3252    #-------------
3253      if [[ -n "$arglist" ]]
3254      then
3255        # <nodelist> cannot be used.
3256        printErrorMsg 192 $mmcmd $attr
3257        cleanupAndExit
3258      fi
3259
3260      if [[ -n $immediate ]]
3261      then
3262        # -i cannot be used.
3263        printErrorMsg 375 $mmcmd $immediate $attr
3264        cleanupAndExit
3265      fi
3266
3267      # Make the change to the work copy of the mmfs.cfg file.
3268      attr="tscPrimary"
3269      mmfscfgChange=yes
3270      ;;
3271
3272
3273    #--------------
3274    "clustertype" )
3275    #--------------
3276      if [[ -n "$arglist" ]]
3277      then
3278        # <nodelist> cannot be used.
3279        printErrorMsg 192 $mmcmd $attr
3280        cleanupAndExit
3281      fi
3282
3283      if [[ -n $immediate ]]
3284      then
3285        # -i cannot be used.
3286        printErrorMsg 375 $mmcmd $immediate $attr
3287        cleanupAndExit
3288      fi
3289
3290      # Make the change to the work copy of the mmfs.cfg file.
3291      attr="clusterType"
3292      mmfscfgChange=yes
3293      ;;
3294
3295
3296    #--------------
3297    "clustername" )
3298    #--------------
3299      # Note:  This value should be changed via mmchcluster -C only.
3300
3301      if [[ -n "$arglist" ]]
3302      then
3303        # <nodelist> cannot be used.
3304        printErrorMsg 192 $mmcmd $attr
3305        cleanupAndExit
3306      fi
3307
3308      if [[ -n $immediate ]]
3309      then
3310        # -i cannot be used.
3311        printErrorMsg 375 $mmcmd $immediate $attr
3312        cleanupAndExit
3313      fi
3314
3315      # Make the change to the work copy of the mmfs.cfg file.
3316      attr="clusterName"
3317      mmfscfgChange=yes
3318      ;;
3319
3320
3321    #------------
3322    "clusterid" )
3323    #------------
3324      # Note:  This value should not be changed.
3325
3326      if [[ -n "$arglist" ]]
3327      then
3328        # <nodelist> cannot be used.
3329        printErrorMsg 192 $mmcmd $attr
3330        cleanupAndExit
3331      fi
3332
3333      if [[ -n $immediate ]]
3334      then
3335        # -i cannot be used.
3336        printErrorMsg 375 $mmcmd $immediate $attr
3337        cleanupAndExit
3338      fi
3339
3340      # Make the change to the work copy of the mmfs.cfg file.
3341      attr="clusterID"
3342      mmfscfgChange=yes
3343      ;;
3344
3345
3346    #--------------------
3347    "autosgloadbalance" )
3348    #--------------------
3349      if [[ $value != DEFAULT ]]
3350      then
3351        # Check the new attribute value.
3352        if [[ $value != yes && $value != no ]]
3353        then
3354          printErrorMsg 37 $mmcmd $attr
3355          cleanupAndExit
3356        fi
3357      fi
3358
3359      # If needed, set parameters for the tsctl command.
3360      if [[ -n $immediate ]]
3361      then
3362        if [[ $value = DEFAULT ]]
3363        then
3364          tsctlParms="$tsctlParms $attr no "
3365        else
3366          tsctlParms="$tsctlParms $attr $value "
3367        fi
3368      fi
3369
3370      # Make the change to the work copy of the mmfs.cfg file.
3371      attr="autoSgLoadBalance"
3372      mmfscfgChange=yes
3373      ;;
3374
3375
3376    #----------------
3377    "tscworkerpool" )
3378    #----------------
3379      if [[ $value != DEFAULT ]]
3380      then
3381        n=$(checkIntRange tscWorkerPool $value)
3382        [[ $? -ne 0 ]] && cleanupAndExit
3383      fi
3384
3385      if [[ -n $immediate ]]
3386      then
3387        # -i cannot be used.
3388        printErrorMsg 375 $mmcmd $immediate $attr
3389        cleanupAndExit
3390      fi
3391
3392      # Make the change to the work copy of the mmfs.cfg file.
3393      attr="tscWorkerPool"
3394      mmfscfgChange=yes
3395      ;;
3396
3397
3398    #----------------------
3399    "socketrcvbuffersize" )
3400    #----------------------
3401      if [[ $value != DEFAULT ]]
3402      then
3403        n=$(checkIntRange socketRcvBufferSize $value 0)
3404        [[ $? -ne 0 ]] && cleanupAndExit
3405      fi
3406
3407      if [[ -n $immediate ]]
3408      then
3409        # -i cannot be used.
3410        printErrorMsg 375 $mmcmd $immediate $attr
3411        cleanupAndExit
3412      fi
3413
3414      # Make the change to the work copy of the mmfs.cfg file.
3415      attr="socketRcvBufferSize"
3416      mmfscfgChange=yes
3417      ;;
3418
3419
3420    #----------------------
3421    "socketsndbuffersize" )
3422    #----------------------
3423      if [[ $value != DEFAULT ]]
3424      then
3425        n=$(checkIntRange socketSndBufferSize $value 0)
3426        [[ $? -ne 0 ]] && cleanupAndExit
3427      fi
3428
3429      if [[ -n $immediate ]]
3430      then
3431        # -i cannot be used.
3432        printErrorMsg 375 $mmcmd $immediate $attr
3433        cleanupAndExit
3434      fi
3435
3436      # Make the change to the work copy of the mmfs.cfg file.
3437      attr="socketSndBufferSize"
3438      mmfscfgChange=yes
3439      ;;
3440
3441
3442    #-----------------------
3443    "writealldescreplicas" )
3444    #-----------------------
3445      if [[ $value != DEFAULT ]]
3446      then
3447        # Check the new attribute value.
3448        if [[ $value != yes && $value != no ]]
3449        then
3450          printErrorMsg 37 $mmcmd $attr
3451          cleanupAndExit
3452        fi
3453      fi
3454
3455      if [[ -n "$arglist" ]]
3456      then
3457        # <nodelist> cannot be used.
3458        printErrorMsg 192 $mmcmd $attr
3459        cleanupAndExit
3460      fi
3461
3462      if [[ -n $immediate ]]
3463      then
3464        # -i cannot be used.
3465        printErrorMsg 375 $mmcmd $immediate $attr
3466        cleanupAndExit
3467      fi
3468
3469      # The daemon must be down on all nodes.
3470      if [[ -z $daemonInactiveVerified ]]
3471      then
3472        printInfoMsg 339
3473        verifyDaemonInactive $allnodes $mmcmd
3474        [[ $? -ne 0 ]] && cleanupAndExit
3475        daemonInactiveVerified=yes
3476      fi
3477
3478      # Make the change to the work copy of the mmfs.cfg file.
3479      attr="writeAllDescReplicas"
3480      mmfscfgChange=yes
3481      ;;
3482
3483
3484    #---------------------------
3485    "waitforvsd" | "wait4rvsd" )
3486    #---------------------------
3487      if [[ $value != DEFAULT ]]
3488      then
3489        # Check the new attribute value.
3490        if [[ $value != yes && $value != no ]]
3491        then
3492          printErrorMsg 37 $mmcmd $attr
3493          cleanupAndExit
3494        fi
3495      fi
3496
3497      if [[ -n $immediate ]]
3498      then
3499        # -i cannot be used.
3500        printErrorMsg 375 $mmcmd $immediate $attr
3501        cleanupAndExit
3502      fi
3503
3504      # Make the change to the work copy of the mmfs.cfg file.
3505      attr="wait4RVSD"
3506      mmfscfgChange=yes
3507      ;;
3508
3509
3510    #---------------
3511    "usedisklease" )
3512    #---------------
3513      # Check the new attribute value.
3514      [[ $value = DEFAULT ]] && value=yes
3515      if [[ $value != yes && $value != no ]]
3516      then
3517        printErrorMsg 37 $mmcmd $attr
3518        cleanupAndExit
3519      fi
3520
3521      if [[ -n "$arglist" ]]
3522      then
3523        # <nodelist> cannot be used.
3524        printErrorMsg 192 $mmcmd $attr
3525        cleanupAndExit
3526      fi
3527
3528      if [[ -n $immediate && $value = no ]]
3529      then
3530        # -i cannot be used.
3531        printErrorMsg 375 $mmcmd $immediate $attr
3532        cleanupAndExit
3533      fi
3534
3535      # When turning off useDiskLease, the daemon must be down on all nodes.
3536      if [[ $value = no && -z $daemonInactiveVerified ]]
3537      then
3538        printInfoMsg 339
3539        verifyDaemonInactive $allnodes $mmcmd
3540        [[ $? -ne 0 ]] && cleanupAndExit
3541        daemonInactiveVerified=yes
3542      fi
3543
3544      # If needed, set parameters for the tsctl command.
3545      [[ -n $immediate ]] &&  \
3546        tsctlParms_onactive="$tsctlParms_onactive $attr $value "
3547
3548      # Make the change to the work copy of the mmfs.cfg file.
3549      attr="useDiskLease"
3550      mmfscfgChange=yes
3551      ;;
3552
3553
3554    #----------------
3555    "leaseduration" )
3556    #----------------
3557      if [[ $value != DEFAULT ]]
3558      then
3559        n=$(checkIntRange leaseDuration $value 5 1800)
3560        [[ $? -ne 0 ]] && cleanupAndExit
3561      fi
3562
3563      if [[ -n "$arglist" ]]
3564      then
3565        # <nodelist> cannot be used.
3566        printErrorMsg 192 $mmcmd $attr
3567        cleanupAndExit
3568      fi
3569
3570      if [[ -n $immediate ]]
3571      then
3572        # -i cannot be used.
3573        printErrorMsg 375 $mmcmd $immediate $attr
3574        cleanupAndExit
3575      fi
3576
3577      # The daemon must be down on all nodes in the cluster.
3578      if [[ -z $daemonInactiveVerified ]]
3579      then
3580        printInfoMsg 339
3581        verifyDaemonInactive $allnodes $mmcmd
3582        [[ $? -ne 0 ]] && cleanupAndExit
3583        daemonInactiveVerified=yes
3584      fi
3585
3586      # Make the change to the work copy of the mmfs.cfg file.
3587      attr="leaseDuration"
3588      mmfscfgChange=yes
3589      ;;
3590
3591
3592    #--------------------
3593    "leaserecoverywait" )
3594    #--------------------
3595      if [[ $value != DEFAULT ]]
3596      then
3597        n=$(checkIntRange leaseRecoveryWait $value 1 1800)
3598        [[ $? -ne 0 ]] && cleanupAndExit
3599      fi
3600
3601      if [[ -n "$arglist" ]]
3602      then
3603        # <nodelist> cannot be used.
3604        printErrorMsg 192 $mmcmd $attr
3605        cleanupAndExit
3606      fi
3607
3608      if [[ -n $immediate ]]
3609      then
3610        # -i cannot be used.
3611        printErrorMsg 375 $mmcmd $immediate $attr
3612        cleanupAndExit
3613      fi
3614
3615      # Make the change to the work copy of the mmfs.cfg file.
3616      attr="leaseRecoveryWait"
3617      mmfscfgChange=yes
3618      ;;
3619
3620
3621    #------------------
3622    "leasedmstimeout" )
3623    #------------------
3624      if [[ $value != DEFAULT ]]
3625      then
3626        n=$(checkIntRange leaseDMSTimeout $value 0 1800)
3627        [[ $? -ne 0 ]] && cleanupAndExit
3628      fi
3629
3630      if [[ -n "$arglist" ]]
3631      then
3632        # <nodelist> cannot be used.
3633        printErrorMsg 192 $mmcmd $attr
3634        cleanupAndExit
3635      fi
3636
3637      if [[ -n $immediate ]]
3638      then
3639        # -i cannot be used.
3640        printErrorMsg 375 $mmcmd $immediate $attr
3641        cleanupAndExit
3642      fi
3643
3644      # Make the change to the work copy of the mmfs.cfg file.
3645      attr="leaseDMSTimeout"
3646      mmfscfgChange=yes
3647      ;;
3648
3649
3650    #------------
3651    "pingperiod" )
3652    #------------
3653      if [[ $value != DEFAULT ]]
3654      then
3655        n=$(checkIntRange pingPeriod $value 1 10)
3656        [[ $? -ne 0 ]] && cleanupAndExit
3657      fi
3658
3659      if [[ -n "$arglist" ]]
3660      then
3661        # <nodelist> cannot be used.
3662        printErrorMsg 192 $mmcmd $attr
3663        cleanupAndExit
3664      fi
3665
3666      if [[ -n $immediate ]]
3667      then
3668        # -i cannot be used.
3669        printErrorMsg 375 $mmcmd $immediate $attr
3670        cleanupAndExit
3671      fi
3672
3673      # Make the change to the work copy of the mmfs.cfg file.
3674      attr="pingPeriod"
3675      mmfscfgChange=yes
3676      ;;
3677
3678
3679    #-------------------
3680    "totalpingtimeout" )
3681    #-------------------
3682      if [[ $value != DEFAULT ]]
3683      then
3684        n=$(checkIntRange totalPingTimeout $value 1 1800)
3685        [[ $? -ne 0 ]] && cleanupAndExit
3686      fi
3687
3688      if [[ -n "$arglist" ]]
3689      then
3690        # <nodelist> cannot be used.
3691        printErrorMsg 192 $mmcmd $attr
3692        cleanupAndExit
3693      fi
3694
3695      if [[ -n $immediate ]]
3696      then
3697        # -i cannot be used.
3698        printErrorMsg 375 $mmcmd $immediate $attr
3699        cleanupAndExit
3700      fi
3701
3702      # Make the change to the work copy of the mmfs.cfg file.
3703      attr="totalPingTimeout"
3704      mmfscfgChange=yes
3705      ;;
3706
3707
3708    #-----------------------
3709    "minmissedpingtimeout" )
3710    #-----------------------
3711      if [[ $value != DEFAULT ]]
3712      then
3713        n=$(checkIntRange minMissedPingTimeout $value 1 300)
3714        [[ $? -ne 0 ]] && cleanupAndExit
3715      fi
3716
3717      if [[ -n "$arglist" ]]
3718      then
3719        # <nodelist> cannot be used.
3720        printErrorMsg 192 $mmcmd $attr
3721        cleanupAndExit
3722      fi
3723
3724      if [[ -n $immediate ]]
3725      then
3726        # -i cannot be used.
3727        printErrorMsg 375 $mmcmd $immediate $attr
3728        cleanupAndExit
3729      fi
3730
3731      # Make the change to the work copy of the mmfs.cfg file.
3732      attr="minMissedPingTimeout"
3733      mmfscfgChange=yes
3734      ;;
3735
3736
3737    #-----------------------
3738    "maxmissedpingtimeout" )
3739    #-----------------------
3740      if [[ $value != DEFAULT ]]
3741      then
3742        n=$(checkIntRange maxMissedPingTimeout $value 1 300)
3743        [[ $? -ne 0 ]] && cleanupAndExit
3744      fi
3745
3746      if [[ -n "$arglist" ]]
3747      then
3748        # <nodelist> cannot be used.
3749        printErrorMsg 192 $mmcmd $attr
3750        cleanupAndExit
3751      fi
3752
3753      if [[ -n $immediate ]]
3754      then
3755        # -i cannot be used.
3756        printErrorMsg 375 $mmcmd $immediate $attr
3757        cleanupAndExit
3758      fi
3759
3760      # Make the change to the work copy of the mmfs.cfg file.
3761      attr="maxMissedPingTimeout"
3762      mmfscfgChange=yes
3763      ;;
3764
3765
3766    #-----------------------
3767    "sendtimeout" )
3768    #-----------------------
3769      if [[ $value != DEFAULT ]]
3770      then
3771        n=$(checkIntRange sendTimeout $value 1 300)
3772        [[ $? -ne 0 ]] && cleanupAndExit
3773      fi
3774
3775      if [[ -n "$arglist" ]]
3776      then
3777        # <nodelist> cannot be used.
3778        printErrorMsg 192 $mmcmd $attr
3779        cleanupAndExit
3780      fi
3781
3782      if [[ -n $immediate ]]
3783      then
3784        # -i cannot be used.
3785        printErrorMsg 375 $mmcmd $immediate $attr
3786        cleanupAndExit
3787      fi
3788
3789      # Make the change to the work copy of the mmfs.cfg file.
3790      attr="sendTimeout"
3791      mmfscfgChange=yes
3792      ;;
3793
3794
3795    #------------------
3796    "prefetchtimeout" )
3797    #------------------
3798      if [[ $value != DEFAULT ]]
3799      then
3800        # Convert attribute value into a simple integer.
3801        intValue=$(checkIntRange prefetchTimeout $value 2 30)
3802        [[ $? -ne 0 ]] && cleanupAndExit
3803      fi
3804
3805      # If needed, set parameters for the tsctl command.
3806      if [[ -n $immediate ]]
3807      then
3808        if [[ $value = DEFAULT ]]
3809        then
3810          tsctlParms="$tsctlParms $attr 5 "
3811        else
3812          tsctlParms="$tsctlParms $attr $value "
3813        fi
3814      fi
3815
3816      # Make the change to the work copy of the mmfs.cfg file.
3817      attr="prefetchTimeout"
3818      mmfscfgChange=yes
3819      ;;
3820
3821
3822    #------------------
3823    "prefetchthreads" )
3824    #------------------
3825      if [[ $value != DEFAULT ]]
3826      then
3827        # Convert attribute value into a simple integer.
3828        intValue=$(checkIntRange prefetchThreads $value 2 550)
3829        [[ $? -ne 0 ]] && cleanupAndExit
3830      fi
3831
3832      if [[ -n $immediate ]]
3833      then
3834        # -i cannot be used.
3835        printErrorMsg 375 $mmcmd $immediate $attr
3836        cleanupAndExit
3837      fi
3838
3839      # Make the change to the work copy of the mmfs.cfg file.
3840      attr="prefetchThreads"
3841      mmfscfgChange=yes
3842      ;;
3843
3844
3845    #--------------
3846    "prefetchpct" )
3847    #--------------
3848      if [[ $value != DEFAULT ]]
3849      then
3850        # Convert attribute value into a simple integer.
3851        intValue=$(checkIntRange prefetchPct $value 0 60)
3852        [[ $? -ne 0 ]] && cleanupAndExit
3853      fi
3854
3855      if [[ -n $immediate ]]
3856      then
3857        # -i cannot be used.
3858        printErrorMsg 375 $mmcmd $immediate $attr
3859        cleanupAndExit
3860      fi
3861
3862      # Make the change to the work copy of the mmfs.cfg file.
3863      attr="prefetchPct"
3864      mmfscfgChange=yes
3865      ;;
3866
3867
3868    #-------------
3869    "hotlistpct" )
3870    #-------------
3871      if [[ $value != DEFAULT ]]
3872      then
3873        # Convert attribute value into a simple integer.
3874        intValue=$(checkIntRange hotlistPct $value 0 60)
3875        [[ $? -ne 0 ]] && cleanupAndExit
3876      fi
3877
3878      if [[ -n $immediate ]]
3879      then
3880        # -i cannot be used.
3881        printErrorMsg 375 $mmcmd $immediate $attr
3882        cleanupAndExit
3883      fi
3884
3885      # Make the change to the work copy of the mmfs.cfg file.
3886      attr="hotlistPct"
3887      mmfscfgChange=yes
3888      ;;
3889
3890
3891    #-----------------
3892    "worker1threads" )
3893    #-----------------
3894      if [[ $value != DEFAULT ]]
3895      then
3896        # Convert attribute value into a simple integer.
3897        intValue=$(checkIntRange worker1Threads $value 1 550)
3898        [[ $? -ne 0 ]] && cleanupAndExit
3899      fi
3900
3901      if [[ -n $immediate ]]
3902      then
3903        # -i cannot be used.
3904        printErrorMsg 375 $mmcmd $immediate $attr
3905        cleanupAndExit
3906      fi
3907
3908      # Make the change to the work copy of the mmfs.cfg file.
3909      attr="worker1Threads"
3910      mmfscfgChange=yes
3911      ;;
3912
3913
3914    #-----------------
3915    "worker3threads" )
3916    #-----------------
3917      if [[ $value != DEFAULT ]]
3918      then
3919        # Convert attribute value into a simple integer.
3920        intValue=$(checkIntRange worker3Threads $value 1 64)
3921        [[ $? -ne 0 ]] && cleanupAndExit
3922      fi
3923
3924      if [[ -n $immediate ]]
3925      then
3926        # -i cannot be used.
3927        printErrorMsg 375 $mmcmd $immediate $attr
3928        cleanupAndExit
3929      fi
3930
3931      # Make the change to the work copy of the mmfs.cfg file.
3932      attr="worker3Threads"
3933      mmfscfgChange=yes
3934      ;;
3935
3936
3937    #----------
3938    "maxmbps" )
3939    #----------
3940      if [[ $value != DEFAULT ]]
3941      then
3942        n=$(checkIntRange maxMBpS $value 1 100000)
3943        [[ $? -ne 0 ]] && cleanupAndExit
3944      fi
3945
3946      # If needed, set parameters for the tsctl command.
3947      if [[ -n $immediate ]]
3948      then
3949        if [[ $value = DEFAULT ]]
3950        then
3951          tsctlParms="$tsctlParms $attr 150 "
3952        else
3953          tsctlParms="$tsctlParms $attr $value "
3954        fi
3955      fi
3956
3957      # Make the change to the work copy of the mmfs.cfg file.
3958      attr="maxMBpS"
3959      mmfscfgChange=yes
3960      ;;
3961
3962
3963    #------------------
3964    "takeovertimeout" )
3965    #------------------
3966      if [[ $value != DEFAULT ]]
3967      then
3968        n=$(checkIntRange takeovertimeout $value)
3969        [[ $? -ne 0 ]] && cleanupAndExit
3970      fi
3971
3972      # If needed, set parameters for the tsctl command.
3973      if [[ -n $immediate ]]
3974      then
3975        if [[ $value = DEFAULT ]]
3976        then
3977          tsctlParms="$tsctlParms $attr 600 "
3978        else
3979          tsctlParms="$tsctlParms $attr $value "
3980        fi
3981      fi
3982
3983      # Make the change to the work copy of the mmfs.cfg file.
3984      attr="takeovertimeout"
3985      mmfscfgChange=yes
3986      ;;
3987
3988
3989    #------------------------
3990    "pcttokenmgrstorageuse" )
3991    #------------------------
3992      if [[ $value != DEFAULT ]]
3993      then
3994        # Convert attribute value into a simple integer.
3995        intValue=$(checkIntRange pctTokenMgrStorageUse $value 1 90)
3996        [[ $? -ne 0 ]] && cleanupAndExit
3997      fi
3998
3999      # If needed, set parameters for the tsctl command.
4000      if [[ -n $immediate ]]
4001      then
4002        if [[ $value = DEFAULT ]]
4003        then
4004          tsctlParms="$tsctlParms $attr 25 "
4005        else
4006          tsctlParms="$tsctlParms $attr $value "
4007        fi
4008      fi
4009
4010      # Make the change to the work copy of the mmfs.cfg file.
4011      attr="pctTokenMgrStorageUse"
4012      mmfscfgChange=yes
4013      ;;
4014
4015
4016    #----------------------------------------
4017    "unmountondiskfail" | "panicondiskfail" )    # Documented attribute
4018    #----------------------------------------
4019      if [[ $value != DEFAULT ]]
4020      then
4021        # Check the new attribute value.
4022        if [[ $value != yes && $value != no && $value != meta ]]
4023        then
4024          printErrorMsg 37 $mmcmd $attr
4025          cleanupAndExit
4026        fi
4027      fi
4028
4029      # If needed, set parameters for the tsctl command.
4030      if [[ -n $immediate ]]
4031      then
4032        if [[ $value = DEFAULT ]]
4033        then
4034          tsctlParms="$tsctlParms $attr no "
4035        else
4036          tsctlParms="$tsctlParms $attr $value "
4037        fi
4038      fi
4039
4040      # Make the change to the work copy of the mmfs.cfg file.
4041      attr="unmountOnDiskFail"
4042      mmfscfgChange=yes
4043      ;;
4044
4045
4046    #------------
4047    "crashdump" )
4048    #------------
4049      if [[ $value != DEFAULT ]]
4050      then
4051        n=$(checkIntRange crashdump $value 0 1)
4052        [[ $? -ne 0 ]] && cleanupAndExit
4053      fi
4054
4055      # If needed, set parameters for the tsctl command.
4056      if [[ -n $immediate ]]
4057      then
4058        if [[ $value = DEFAULT ]]
4059        then
4060          tsctlParms="$tsctlParms $attr 0 "
4061        else
4062          tsctlParms="$tsctlParms $attr $value "
4063        fi
4064      fi
4065
4066      # Make the change to the work copy of the mmfs.cfg file.
4067      attr="crashdump"
4068      mmfscfgChange=yes
4069      ;;
4070
4071
4072    #-------------------------
4073    "assertonstructureerror" )
4074    #-------------------------
4075      if [[ $value != DEFAULT ]]
4076      then
4077        # Check the new attribute value.
4078        if [[ $value != yes && $value != no ]]
4079        then
4080          printErrorMsg 37 $mmcmd $attr
4081          cleanupAndExit
4082        fi
4083      fi
4084
4085      # If needed, set parameters for the tsctl command.
4086      if [[ -n $immediate ]]
4087      then
4088        if [[ $value = DEFAULT ]]
4089        then
4090          tsctlParms="$tsctlParms $attr no "
4091        else
4092          tsctlParms="$tsctlParms $attr $value "
4093        fi
4094      fi
4095
4096      # Make the change to the work copy of the mmfs.cfg file.
4097      attr="assertOnStructureError"
4098      mmfscfgChange=yes
4099      ;;
4100
4101
4102    #--------
4103    "trace" )
4104    #--------
4105      # If requested, change the trace levels on the running daemon.
4106      if [[ -n $immediate && -s $nodefile ]]
4107      then
4108        if [[ $value = DEFAULT ]]
4109        then
4110          $mmcommon onall $nodefile $unreachedNodes  \
4111                             adminCmd mmfsadm trace "all 0"
4112        else
4113          $mmcommon onall $nodefile $unreachedNodes  \
4114                             adminCmd mmfsadm trace "$value"
4115        fi
4116      fi
4117
4118      # Make the change to the work copy of the mmfs.cfg file.
4119      attr="trace"
4120      mmfscfgChange=yes
4121      ;;
4122
4123
4124    #------
4125    "res" )            # Resource tracking options
4126    #------
4127      if [[ -n "$arglist" ]]
4128      then
4129        # <nodelist> cannot be used.
4130        printErrorMsg 192 $mmcmd $attr
4131        cleanupAndExit
4132      fi
4133
4134      if [[ -n $immediate ]]
4135      then
4136        # -i cannot be used.
4137        printErrorMsg 375 $mmcmd $immediate $attr
4138        cleanupAndExit
4139      fi
4140
4141      # Make the change to the work copy of the mmfs.cfg file.
4142      attr="res"
4143      mmfscfgChange=yes
4144      ;;
4145
4146
4147    #---------------------
4148    "asyncsocketnotify"  )
4149    #---------------------
4150      if [[ $value != DEFAULT ]]
4151      then
4152        # Check the new attribute value.
4153        if [[ $value != yes && $value != no ]]
4154        then
4155          printErrorMsg 37 $mmcmd $attr
4156          cleanupAndExit
4157        fi
4158      fi
4159
4160      if [[ -n $immediate ]]
4161      then
4162        # -i cannot be used.
4163        printErrorMsg 375 $mmcmd $immediate $attr
4164        cleanupAndExit
4165      fi
4166
4167      # Make the change to the work copy of the mmfs.cfg file.
4168      attr="asyncSocketNotify"
4169      mmfscfgChange=yes
4170      ;;
4171
4172
4173    #------------
4174    "pinmaster" )
4175    #------------
4176      # value must have the following format: "stack:256K data:4096K"
4177      # The range for stack is 64K to 4M
4178      # The range for data is 64K to 128M
4179
4180      if [[ -n $immediate ]]
4181      then
4182        # -i cannot be used.
4183        printErrorMsg 375 $mmcmd $immediate $attr
4184        cleanupAndExit
4185      fi
4186
4187      # Make the change to the work copy of the mmfs.cfg file.
4188      attr="pinmaster"
4189      mmfscfgChange=yes
4190      ;;
4191
4192
4193    #-------------------------
4194    "maxinodedeallochistory" )
4195    #-------------------------
4196      # The range for maxInodeDeallocPrefetch is 0 to maxFilesToCache
4197
4198      # Convert attribute value into a simple integer.
4199      if [[ $value != DEFAULT ]]
4200      then
4201        intValue=$(checkIntRange maxInodeDeallocHistory $value 1 100000)
4202        [[ $? -ne 0 ]] && cleanupAndExit
4203      fi
4204
4205      if [[ -n $immediate ]]
4206      then
4207        # -i cannot be used.
4208        printErrorMsg 375 $mmcmd $immediate $attr
4209        cleanupAndExit
4210      fi
4211
4212      # Make the change to the work copy of the mmfs.cfg file.
4213      attr="maxInodeDeallocHistory"
4214      mmfscfgChange=yes
4215      ;;
4216
4217
4218    #--------------------------
4219    "maxinodedeallocprefetch" )
4220    #--------------------------
4221      # The range for maxInodeDeallocPrefetch is
4222      #   0 to min(maxInodeDeallocHistory, 16)
4223
4224      # Convert attribute value into a simple integer.
4225      if [[ $value != DEFAULT ]]
4226      then
4227        intValue=$(checkIntRange maxInodeDeallocPrefetch $value 1 16)
4228        [[ $? -ne 0 ]] && cleanupAndExit
4229      fi
4230
4231      # If needed, set parameters for the tsctl command.
4232      if [[ -n $immediate ]]
4233      then
4234        if [[ $value = DEFAULT ]]
4235        then
4236          tsctlParms="$tsctlParms $attr 8 "
4237        else
4238          tsctlParms="$tsctlParms $attr $value "
4239        fi
4240      fi
4241
4242      # Make the change to the work copy of the mmfs.cfg file.
4243      attr="maxInodeDeallocPrefetch"
4244      mmfscfgChange=yes
4245      ;;
4246
4247
4248    #-------------
4249    "mmapkprocs" )
4250    #-------------
4251      if [[ $value != DEFAULT ]]
4252      then
4253        n=$(checkIntRange mmapKprocs $value 0 10000)
4254        [[ $? -ne 0 ]] && cleanupAndExit
4255      fi
4256
4257      # If needed, set parameters for the tsctl command.
4258      if [[ -n $immediate ]]
4259      then
4260        if [[ $value = DEFAULT ]]
4261        then
4262          tsctlParms="$tsctlParms $attr 3 "
4263        else
4264          tsctlParms="$tsctlParms $attr $value "
4265        fi
4266      fi
4267
4268      # Make the change to the work copy of the mmfs.cfg file.
4269      attr="mmapKprocs"
4270      mmfscfgChange=yes
4271      ;;
4272
4273
4274    #------------------------
4275    "maxfcntlrangesperfile" )
4276    #------------------------
4277      if [[ $value != DEFAULT ]]
4278      then
4279        n=$(checkIntRange maxFcntlRangesPerFile $value 10 200000)
4280        [[ $? -ne 0 ]] && cleanupAndExit
4281      fi
4282
4283      # If needed, set parameters for the tsctl command.
4284      if [[ -n $immediate ]]
4285      then
4286        if [[ $value = DEFAULT ]]
4287        then
4288          tsctlParms="$tsctlParms $attr 200 "
4289        else
4290          tsctlParms="$tsctlParms $attr $value "
4291        fi
4292      fi
4293
4294      # Make the change to the work copy of the mmfs.cfg file.
4295      attr="maxFcntlRangesPerFile"
4296      mmfscfgChange=yes
4297      ;;
4298
4299
4300    #-------------------------------
4301    "allowsynchronousfcntlretries" )
4302    #-------------------------------
4303      if [[ $value != DEFAULT ]]
4304      then
4305        # Check the new attribute value.
4306        if [[ $value != yes && $value != no ]]
4307        then
4308          printErrorMsg 37 $mmcmd $attr
4309          cleanupAndExit
4310        fi
4311      fi
4312
4313      # If needed, set parameters for the tsctl command.
4314      if [[ -n $immediate ]]
4315      then
4316        if [[ $value = DEFAULT ]]
4317        then
4318          tsctlParms="$tsctlParms $attr yes "
4319        else
4320          tsctlParms="$tsctlParms $attr $value "
4321        fi
4322      fi
4323
4324      # Make the change to the work copy of the mmfs.cfg file.
4325      attr="allowSynchronousFcntlRetries"
4326      mmfscfgChange=yes
4327      ;;
4328
4329
4330    #---------------------------
4331    "retryfcntltokenthreshold" )
4332    #---------------------------
4333      if [[ $value != DEFAULT ]]
4334      then
4335        n=$(checkIntRange retryFcntlTokenThreshold $value 0 1000)
4336        [[ $? -ne 0 ]] && cleanupAndExit
4337      fi
4338
4339      # If needed, set parameters for the tsctl command.
4340      if [[ -n $immediate ]]
4341      then
4342        if [[ $value = DEFAULT ]]
4343        then
4344          tsctlParms="$tsctlParms $attr 200 "
4345        else
4346          tsctlParms="$tsctlParms $attr $value "
4347        fi
4348      fi
4349
4350      # Make the change to the work copy of the mmfs.cfg file.
4351      attr="retryFcntlTokenThreshold"
4352      mmfscfgChange=yes
4353      ;;
4354
4355
4356    #---------------------
4357    "eewatchdoginterval" )
4358    #---------------------
4359      if [[ $value != DEFAULT ]]
4360      then
4361        n=$(checkIntRange eeWatchDogInterval $value)
4362        [[ $? -ne 0 ]] && cleanupAndExit
4363      fi
4364
4365      # If needed, set parameters for the tsctl command.
4366      if [[ -n $immediate ]]
4367      then
4368        if [[ $value = DEFAULT ]]
4369        then
4370          tsctlParms="$tsctlParms $attr 90 "
4371        else
4372          tsctlParms="$tsctlParms $attr $value "
4373        fi
4374      fi
4375
4376      # Make the change to the work copy of the mmfs.cfg file.
4377      attr="eeWatchDogInterval"
4378      mmfscfgChange=yes
4379      ;;
4380
4381
4382    #-----------------------------
4383    "eewatchdoghungthreadcutoff" )
4384    #-----------------------------
4385      if [[ $value != DEFAULT ]]
4386      then
4387        n=$(checkIntRange eeWatchDogHungThreadCutoff $value)
4388        [[ $? -ne 0 ]] && cleanupAndExit
4389      fi
4390
4391      # If needed, set parameters for the tsctl command.
4392      if [[ -n $immediate ]]
4393      then
4394        if [[ $value = DEFAULT ]]
4395        then
4396          tsctlParms="$tsctlParms $attr 60 "
4397        else
4398          tsctlParms="$tsctlParms $attr $value "
4399        fi
4400      fi
4401
4402      # Make the change to the work copy of the mmfs.cfg file.
4403      attr="eeWatchDogHungThreadCutoff"
4404      mmfscfgChange=yes
4405      ;;
4406
4407
4408    #------------------
4409    "watchdogtimeout" )
4410    #------------------
4411      if [[ $value != DEFAULT ]]
4412      then
4413        n=$(checkIntRange watchdogtimeout $value)
4414        [[ $? -ne 0 ]] && cleanupAndExit
4415      fi
4416
4417      # If needed, set parameters for the tsctl command.
4418      if [[ -n $immediate ]]
4419      then
4420        if [[ $value = DEFAULT ]]
4421        then
4422          tsctlParms="$tsctlParms $attr 20 "
4423        else
4424          tsctlParms="$tsctlParms $attr $value "
4425        fi
4426      fi
4427
4428      # Make the change to the work copy of the mmfs.cfg file.
4429      attr="watchdogtimeout"
4430      mmfscfgChange=yes
4431      ;;
4432
4433
4434    #--------------
4435    "nsdbufspace" )
4436    #--------------
4437      if [[ $value != DEFAULT ]]
4438      then
4439        n=$(checkIntRange nsdbufspace $value 10 70)
4440        [[ $? -ne 0 ]] && cleanupAndExit
4441      fi
4442
4443      # If needed, set parameters for the tsctl command.
4444      if [[ -n $immediate ]]
4445      then
4446        if [[ $value = DEFAULT ]]
4447        then
4448          tsctlParms="$tsctlParms $attr 30 "
4449        else
4450          tsctlParms="$tsctlParms $attr $value "
4451        fi
4452      fi
4453
4454      # Make the change to the work copy of the mmfs.cfg file.
4455      attr="nsdbufspace"
4456      mmfscfgChange=yes
4457      ;;
4458
4459
4460    #--------------------
4461    "nsdthreadsperdisk" )
4462    #--------------------
4463      if [[ $value != DEFAULT ]]
4464      then
4465        n=$(checkIntRange nsdThreadsPerDisk $value 1 128)
4466        [[ $? -ne 0 ]] && cleanupAndExit
4467      fi
4468
4469      if [[ -n $immediate ]]
4470      then
4471        # -i cannot be used.
4472        printErrorMsg 375 $mmcmd $immediate $attr
4473        cleanupAndExit
4474      fi
4475
4476      # Make the change to the work copy of the mmfs.cfg file.
4477      attr="nsdThreadsPerDisk"
4478      mmfscfgChange=yes
4479      ;;
4480
4481
4482    #----------------------
4483    "nsdminworkerthreads" )
4484    #----------------------
4485      if [[ $value != DEFAULT ]]
4486      then
4487        n=$(checkIntRange nsdMinWorkerThreads $value 1 128)
4488        [[ $? -ne 0 ]] && cleanupAndExit
4489      fi
4490
4491      if [[ -n $immediate ]]
4492      then
4493        # -i cannot be used.
4494        printErrorMsg 375 $mmcmd $immediate $attr
4495        cleanupAndExit
4496      fi
4497
4498      # Make the change to the work copy of the mmfs.cfg file.
4499      attr="nsdMinWorkerThreads"
4500      mmfscfgChange=yes
4501      ;;
4502
4503
4504    #----------------------
4505    "nsdmaxworkerthreads" )
4506    #----------------------
4507      if [[ $value != DEFAULT ]]
4508      then
4509        n=$(checkIntRange nsdMaxWorkerThreads $value 1 128)
4510        [[ $? -ne 0 ]] && cleanupAndExit
4511      fi
4512
4513      if [[ -n $immediate ]]
4514      then
4515        # -i cannot be used.
4516        printErrorMsg 375 $mmcmd $immediate $attr
4517        cleanupAndExit
4518      fi
4519
4520      # Make the change to the work copy of the mmfs.cfg file.
4521      attr="nsdMaxWorkerThreads"
4522      mmfscfgChange=yes
4523      ;;
4524
4525
4526    #------------------------------------
4527    "nsdservercheckingintervalformount" )
4528    #------------------------------------
4529      if [[ $value != DEFAULT ]]
4530      then
4531        n=$(checkIntRange nsdServerCheckingIntervalForMount $value 1 60)
4532        [[ $? -ne 0 ]] && cleanupAndExit
4533      fi
4534
4535      # If needed, set parameters for the tsctl command.
4536      if [[ -n $immediate ]]
4537      then
4538        if [[ $value = DEFAULT ]]
4539        then
4540          tsctlParms="$tsctlParms $attr 10 "
4541        else
4542          tsctlParms="$tsctlParms $attr $value "
4543        fi
4544      fi
4545
4546      # Make the change to the work copy of the mmfs.cfg file.
4547      attr="nsdServerCheckingIntervalForMount"
4548      mmfscfgChange=yes
4549      ;;
4550
4551
4552    #----------------------------
4553    "nsdserverwaitconfig" )
4554    #----------------------------
4555      if [[ $value != DEFAULT ]]
4556      then
4557        n=$(checkIntRange nsdServerWaitConfig $value 0 2)
4558        [[ $? -ne 0 ]] && cleanupAndExit
4559      fi
4560
4561      # If needed, set parameters for the tsctl command.
4562      if [[ -n $immediate ]]
4563      then
4564        if [[ $value = DEFAULT ]]
4565        then
4566          tsctlParms="$tsctlParms $attr 2 "
4567        else
4568          tsctlParms="$tsctlParms $attr $value "
4569        fi
4570      fi
4571
4572      # Make the change to the work copy of the mmfs.cfg file.
4573      attr="nsdServerWaitConfig"
4574      mmfscfgChange=yes
4575      ;;
4576
4577
4578    #----------------------------
4579    "nsdserverwaittimeformount" )
4580    #----------------------------
4581      if [[ $value != DEFAULT ]]
4582      then
4583        n=$(checkIntRange nsdServerWaitTimeForMount $value 0 1200)
4584        [[ $? -ne 0 ]] && cleanupAndExit
4585      fi
4586
4587      # If needed, set parameters for the tsctl command.
4588      if [[ -n $immediate ]]
4589      then
4590        if [[ $value = DEFAULT ]]
4591        then
4592          tsctlParms="$tsctlParms $attr 300 "
4593        else
4594          tsctlParms="$tsctlParms $attr $value "
4595        fi
4596      fi
4597
4598      # Make the change to the work copy of the mmfs.cfg file.
4599      attr="nsdServerWaitTimeForMount"
4600      mmfscfgChange=yes
4601      ;;
4602
4603
4604    #---------------------------------
4605    "nsdserverwaittimewindowonmount" )
4606    #---------------------------------
4607      if [[ $value != DEFAULT ]]
4608      then
4609        n=$(checkIntRange nsdServerWaitTimeWindowOnMount $value 1 1200)
4610        [[ $? -ne 0 ]] && cleanupAndExit
4611      fi
4612
4613      # If needed, set parameters for the tsctl command.
4614      if [[ -n $immediate ]]
4615      then
4616        if [[ $value = DEFAULT ]]
4617        then
4618          tsctlParms="$tsctlParms $attr 600 "
4619        else
4620          tsctlParms="$tsctlParms $attr $value "
4621        fi
4622      fi
4623
4624      # Make the change to the work copy of the mmfs.cfg file.
4625      attr="nsdServerWaitTimeWindowOnMount"
4626      mmfscfgChange=yes
4627      ;;
4628
4629
4630    #--------------------
4631    "readreplicapolicy" )
4632    #--------------------
4633      if [[ $value != DEFAULT ]]
4634      then
4635        if [[ $value != "local" && $value != "fastest" && $value != "default" ]]
4636        then
4637          # Incorrect value for this option.
4638          printErrorMsg 153 $mmcmd $attr
4639          cleanupAndExit
4640        fi
4641      fi
4642
4643      # If needed, set parameters for the tsctl command.
4644      if [[ -n $immediate ]]
4645      then
4646        tsctlParms="$tsctlParms $attr $value "
4647      fi
4648
4649      # Make the change to the work copy of the mmfs.cfg file.
4650      attr="readReplicaPolicy"
4651      mmfscfgChange=yes
4652      ;;
4653
4654
4655    #---------------
4656    "addnodestate" )
4657    #---------------
4658      if [[ $value != "new" && $value != "old" ]]
4659      then
4660        # Invalid node designation specified
4661        printErrorMsg 293 $mmcmd $value
4662        cleanupAndExit
4663      fi
4664
4665      if [[ -n $immediate ]]
4666      then
4667        # -i cannot be used.
4668        printErrorMsg 375 $mmcmd $immediate $attr
4669        cleanupAndExit
4670      fi
4671
4672      # Make the change in the MEMBER_NODE lines.
4673      if [[ -z "$arglist" ]]
4674      then
4675        changeAddNodeState $value $newsdrfs
4676        rc=$?
4677      else
4678        changeAddNodeState $value $newsdrfs $nodefile $allnodes
4679        rc=$?
4680      fi
4681      [[ $rc -ne 0 ]] && cleanupAndExit
4682      mmsdrfsModified=yes
4683      synchronousNotify=yes
4684      [[ $propagateOptions != *rereadNodeList* ]] &&  \
4685        propagateOptions=rereadNodeList,${propagateOptions}
4686
4687      # No other attributes can be processed after addNodeState
4688      break
4689      ;;
4690
4691
4692    #----------
4693    "release" )    # Documented attribute
4694    #----------
4695      [[ $value = DEFAULT ]] && value=LATEST
4696      if [[ $value != "LATEST" && $value != "latest" ]]
4697      then
4698        # An invalid value was specified.
4699        printErrorMsg 13 "$mmcmd" "$attributePair"
4700        cleanupAndExit
4701      fi
4702
4703      if [[ -n $immediate ]]
4704      then
4705        # -i cannot be used.
4706        printErrorMsg 375 $mmcmd $immediate $attr
4707        cleanupAndExit
4708      fi
4709
4710      if [[ -n "$arglist" ]]
4711      then
4712        # <nodelist> cannot be used.
4713        printErrorMsg 192 $mmcmd $attr
4714        cleanupAndExit
4715      fi
4716
4717      # Make the appropriate preliminary changes.
4718      convertMmsdrfsFile $newsdrfs
4719      rc=$?
4720      [[ $rc -ne 0 ]] && cleanupAndExit
4721      mmsdrfsModified=yes
4722      ;;
4723
4724
4725    #-------------------
4726    "release_disabled" )    # Disable the code that handles release level determination.
4727    #-------------------
4728      [[ $value = DEFAULT ]] && value=LATEST
4729      if [[ $value != "LATEST" && $value != "latest" &&
4730            $value != +([0-9]).+([0-9]).+([0-9]).+([0-9]) ]]
4731      then
4732        n=$(checkIntRange DaemonVersion $value)
4733        if [[ $? -ne 0 ]]
4734        then
4735          # Invalid value specified
4736          printErrorMsg 13 "$mmcmd" "$attributePair"
4737          cleanupAndExit
4738        fi
4739      fi
4740
4741      # -I (immediate only) option not allowed
4742      if [[ $immediate = "-I" ]]
4743      then
4744        printErrorMsg 375 $mmcmd $immediate $attr
4745        cleanupAndExit
4746      fi
4747
4748      if [[ $value = "LATEST" || $value = "latest" ]]
4749      then
4750        # Make the appropriate preliminary changes.
4751        convertMmsdrfsFile $newsdrfs
4752        rc=$?
4753        [[ $rc -ne 0 ]] && cleanupAndExit
4754        mmsdrfsModified=yes
4755
4756      else
4757        # The request is to set the version to a specific level.
4758        # This requires the daemon to be stopped everywhere.
4759        if [[ -n "$arglist" ]]
4760        then
4761          # <nodelist> cannot be used.
4762          printErrorMsg 192 $mmcmd $attr
4763          cleanupAndExit
4764        fi
4765
4766        # The daemon must be down on all nodes in the cluster.
4767        if [[ -z $daemonInactiveVerified ]]
4768        then
4769          printInfoMsg 339
4770          verifyDaemonInactive $allnodes $mmcmd
4771          [[ $? -ne 0 ]] && cleanupAndExit
4772          daemonInactiveVerified=yes
4773        fi
4774      fi  # end if [[ $value = "LATEST" || $value = "latest" ]]
4775
4776      # Verify that the NODESET_HDR version fields are up-to-date.
4777      result=$(setNodesetVersionFields $value $nodefile $newsdrfs)
4778      IFS=':'
4779      set -f ; set -- $result ; set +f
4780      IFS="$IFS_sv"
4781      rc=$2
4782      status=$3
4783      maxFeatureLevelAllowed=$4
4784
4785      # If the daemon version has changed, make the appropriate
4786      # changes to mmfs.cfg.
4787      if [[ $status = changed ]]
4788      then
4789        # If upgrading the version level, the immediate option is implied.
4790        [[ $value = "LATEST" || $value = "latest" ]] &&  \
4791          immediate="-i";
4792
4793        # If needed, set parameters for the tsctl command.
4794        [[ -n $immediate ]] &&  \
4795          tsctlParms_onactive="$tsctlParms_onactive $attr $value "
4796
4797        # Make the change to the work copy of the mmfs.cfg file.
4798        value=$maxFeatureLevelAllowed
4799        attr="maxFeatureLevelAllowed"
4800        mmfscfgChange=yes
4801        ignoreNodeList=yes
4802      fi
4803      ;;
4804
4805
4806    #-------------------------
4807    "maxfeaturelevelallowed" )
4808    #-------------------------
4809      n=$(checkIntRange maxFeatureLevelAllowed $value 0 100000)
4810      [[ $? -ne 0 ]] && cleanupAndExit
4811
4812      # If needed, set parameters for the tsctl command.
4813      [[ -n $immediate ]] &&  \
4814        tsctlParms_onactive="$tsctlParms_onactive $attr $value "
4815
4816      # Make the change to the work copy of the mmfs.cfg file.
4817      attr="maxFeatureLevelAllowed"
4818      mmfscfgChange=yes
4819      ;;
4820
4821
4822    #------------------------
4823    "writebehindthreshhold" )
4824    #------------------------
4825      if [[ $value != DEFAULT ]]
4826      then
4827        n=$(checkIntRange writebehindThreshhold $value 0 )
4828        [[ $? -ne 0 ]] && cleanupAndExit
4829      fi
4830
4831      # If needed, set parameters for the tsctl command.
4832      if [[ -n $immediate ]]
4833      then
4834        if [[ $value = DEFAULT ]]
4835        then
4836          tsctlParms="$tsctlParms $attr 512K "
4837        else
4838          tsctlParms="$tsctlParms $attr $value "
4839        fi
4840      fi
4841
4842      # Make the change to the work copy of the mmfs.cfg file.
4843      attr="writebehindThreshhold"
4844      mmfscfgChange=yes
4845      ;;
4846
4847
4848    #-----------------------
4849    "seqdiscardthreshhold" )
4850    #-----------------------
4851      if [[ $value != DEFAULT ]]
4852      then
4853        n=$(checkIntRange seqDiscardThreshhold $value 0 )
4854        [[ $? -ne 0 ]] && cleanupAndExit
4855      fi
4856
4857      # If needed, set parameters for the tsctl command.
4858      if [[ -n $immediate ]]
4859      then
4860        if [[ $value = DEFAULT ]]
4861        then
4862          tsctlParms="$tsctlParms $attr 1M "
4863        else
4864          tsctlParms="$tsctlParms $attr $value "
4865        fi
4866      fi
4867
4868      # Make the change to the work copy of the mmfs.cfg file.
4869      attr="seqDiscardThreshhold"
4870      mmfscfgChange=yes
4871      ;;
4872
4873
4874    #---------------
4875    "syncinterval" )
4876    #---------------
4877      if [[ $value != DEFAULT ]]
4878      then
4879        n=$(checkIntRange syncInterval $value 0 3600)
4880        [[ $? -ne 0 ]] && cleanupAndExit
4881      fi
4882
4883      # If needed, set parameters for the tsctl command.
4884      if [[ -n $immediate ]]
4885      then
4886        if [[ $value = DEFAULT ]]
4887        then
4888          if [[ $osName = Linux ]]
4889          then
4890            tsctlParms="$tsctlParms $attr 30 "
4891          else
4892            tsctlParms="$tsctlParms $attr 70 "
4893          fi
4894        else
4895          tsctlParms="$tsctlParms $attr $value "
4896        fi  # end if [[ $value = DEFAULT ]]
4897      fi  # end if [[ -n $immediate ]]
4898
4899      # Make the change to the work copy of the mmfs.cfg file.
4900      attr="syncInterval"
4901      mmfscfgChange=yes
4902      ;;
4903
4904
4905    #----------------
4906    "iohistorysize" )
4907    #----------------
4908      if [[ $value != DEFAULT ]]
4909      then
4910        n=$(checkIntRange ioHistorySize $value 32 32768)
4911        [[ $? -ne 0 ]] && cleanupAndExit
4912      fi
4913
4914      # If needed, set parameters for the tsctl command.
4915      if [[ -n $immediate ]]
4916      then
4917        if [[ $value = DEFAULT ]]
4918        then
4919          tsctlParms="$tsctlParms $attr 512 "
4920        else
4921          tsctlParms="$tsctlParms $attr $value "
4922        fi
4923      fi
4924
4925      # Make the change to the work copy of the mmfs.cfg file.
4926      attr="ioHistorySize"
4927      mmfscfgChange=yes
4928      ;;
4929
4930
4931    #------------------
4932    "maxfilecleaners" )
4933    #------------------
4934      if [[ $value != DEFAULT ]]
4935      then
4936        n=$(checkIntRange maxfilecleaners $value 0 32)
4937        [[ $? -ne 0 ]] && cleanupAndExit
4938      fi
4939
4940      # If needed, set parameters for the tsctl command.
4941      if [[ -n $immediate ]]
4942      then
4943        if [[ $value = DEFAULT ]]
4944        then
4945          tsctlParms="$tsctlParms $attr 8 "
4946        else
4947          tsctlParms="$tsctlParms $attr $value "
4948        fi
4949      fi
4950
4951      # Make the change to the work copy of the mmfs.cfg file.
4952      attr="maxFileCleaners"
4953      mmfscfgChange=yes
4954      ;;
4955
4956
4957    #--------------------
4958    "flusheddatatarget" )
4959    #--------------------
4960      if [[ $value != DEFAULT ]]
4961      then
4962        n=$(checkIntRange flushedDataTarget $value 0 256)
4963        [[ $? -ne 0 ]] && cleanupAndExit
4964      fi
4965
4966      # If needed, set parameters for the tsctl command.
4967      if [[ -n $immediate ]]
4968      then
4969        if [[ $value = DEFAULT ]]
4970        then
4971          tsctlParms="$tsctlParms $attr 32 "
4972        else
4973          tsctlParms="$tsctlParms $attr $value "
4974        fi
4975      fi
4976
4977      # Make the change to the work copy of the mmfs.cfg file.
4978      attr="flushedDataTarget"
4979      mmfscfgChange=yes
4980      ;;
4981
4982
4983    #---------------------
4984    "flushedinodetarget" )
4985    #---------------------
4986      if [[ $value != DEFAULT ]]
4987      then
4988        n=$(checkIntRange flushedInodeTarget $value 0 256)
4989        [[ $? -ne 0 ]] && cleanupAndExit
4990      fi
4991
4992      # If needed, set parameters for the tsctl command.
4993      if [[ -n $immediate ]]
4994      then
4995        if [[ $value = DEFAULT ]]
4996        then
4997          tsctlParms="$tsctlParms $attr 32 "
4998        else
4999          tsctlParms="$tsctlParms $attr $value "
5000        fi
5001      fi
5002
5003      # Make the change to the work copy of the mmfs.cfg file.
5004      attr="flushedInodeTarget"
5005      mmfscfgChange=yes
5006      ;;
5007
5008
5009    #-----------------
5010    "sharedmemlimit" )
5011    #-----------------
5012      if [[ $value != DEFAULT ]]
5013      then
5014        # Convert attribute value into a simple integer.
5015        intValue=$(checkIntRange sharedMemLimit $value 0 2047M)
5016        [[ $? -ne 0 ]] && cleanupAndExit
5017      fi
5018
5019      if [[ -n $immediate ]]
5020      then
5021        # -i cannot be used.
5022        printErrorMsg 375 $mmcmd $immediate $attr
5023        cleanupAndExit
5024      fi
5025
5026      # Make the change to the work copy of the mmfs.cfg file.
5027      attr="sharedMemLimit"
5028      mmfscfgChange=yes
5029      ;;
5030
5031    #-----------------
5032    "tokenmemlimit" )
5033    #-----------------
5034      if [[ $value != DEFAULT ]]
5035      then
5036        # Convert attribute value into a simple integer.
5037        intValue=$(checkIntRange tokenMemLimit $value 0 2047M)
5038        [[ $? -ne 0 ]] && cleanupAndExit
5039      fi
5040
5041      if [[ -n $immediate ]]
5042      then
5043        # -i cannot be used.
5044        printErrorMsg 375 $mmcmd $immediate $attr
5045        cleanupAndExit
5046      fi
5047
5048      # Make the change to the work copy of the mmfs.cfg file.
5049      attr="tokenMemLimit"
5050      mmfscfgChange=yes
5051      ;;
5052
5053    #-------------------------------
5054    "maxbackgrounddeletionthreads" )
5055    #-------------------------------
5056      if [[ $value != DEFAULT ]]
5057      then
5058        n=$(checkIntRange maxBackgroundDeletionThreads $value 0 8)
5059        [[ $? -ne 0 ]] && cleanupAndExit
5060      fi
5061
5062      # If needed, set parameters for the tsctl command.
5063      if [[ -n $immediate ]]
5064      then
5065        if [[ $value = DEFAULT ]]
5066        then
5067          tsctlParms="$tsctlParms $attr 4 "
5068        else
5069          tsctlParms="$tsctlParms $attr $value "
5070        fi
5071      fi
5072
5073      # Make the change to the work copy of the mmfs.cfg file.
5074      attr="maxBackgroundDeletionThreads"
5075      mmfscfgChange=yes
5076      ;;
5077
5078
5079    #--------------------------
5080    "maxnfsdelegationtimeout" )
5081    #--------------------------
5082      if [[ $value != DEFAULT ]]
5083      then
5084        n=$(checkIntRange maxNFSDelegationTimeout $value 3 3600)
5085        [[ $? -ne 0 ]] && cleanupAndExit
5086      fi
5087
5088      # If needed, set parameters for the tsctl command.
5089      if [[ -n $immediate ]]
5090      then
5091        if [[ $value = DEFAULT ]]
5092        then
5093          tsctlParms="$tsctlParms $attr 60 "
5094        else
5095          tsctlParms="$tsctlParms $attr $value "
5096        fi
5097      fi
5098
5099      # Make the change to the work copy of the mmfs.cfg file.
5100      attr="maxNFSDelegationTimeout"
5101      mmfscfgChange=yes
5102      ;;
5103
5104    #----------------------
5105    "nfsprefetchstrategy" )
5106    #----------------------
5107      if [[ $value != DEFAULT ]]
5108      then
5109        n=$(checkIntRange nfsPrefetchStrategy $value 0 10)
5110        [[ $? -ne 0 ]] && cleanupAndExit
5111      fi
5112
5113      # If needed, set parameters for the tsctl command.
5114      if [[ -n $immediate ]]
5115      then
5116        if [[ $value = DEFAULT ]]
5117        then
5118          tsctlParms="$tsctlParms $attr 0 "
5119        else
5120          tsctlParms="$tsctlParms $attr $value "
5121        fi
5122      fi
5123
5124      # Make the change to the work copy of the mmfs.cfg file.
5125      attr="nfsPrefetchStrategy"
5126      mmfscfgChange=yes
5127      ;;
5128
5129
5130    #-----------------
5131    "enablenfscluster" )
5132    #-----------------
5133      if [[ $value != DEFAULT ]]
5134      then
5135        # Check the new attribute value.
5136        if [[ $value != yes && $value != no ]]
5137        then
5138          printErrorMsg 37 $mmcmd $attr
5139          cleanupAndExit
5140        fi
5141      fi
5142
5143      if [[ -n $immediate ]]
5144      then
5145        # -i cannot be used.
5146        printErrorMsg 375 $mmcmd $immediate $attr
5147        cleanupAndExit
5148      fi
5149
5150      # Make the change to the work copy of the mmfs.cfg file.
5151      attr="enableNFSCluster"
5152      mmfscfgChange=yes
5153      ;;
5154
5155    #-----------------
5156    "enableuidremap" )
5157    #-----------------
5158      if [[ $value != DEFAULT ]]
5159      then
5160        # Check the new attribute value.
5161        if [[ $value != yes && $value != no ]]
5162        then
5163          printErrorMsg 37 $mmcmd $attr
5164          cleanupAndExit
5165        fi
5166      fi
5167
5168      if [[ -n $immediate ]]
5169      then
5170        # -i cannot be used.
5171        printErrorMsg 375 $mmcmd $immediate $attr
5172        cleanupAndExit
5173      fi
5174
5175      # The daemon must be down on all nodes in the cluster.
5176      if [[ -z $daemonInactiveVerified ]]
5177      then
5178        printInfoMsg 339
5179        verifyDaemonInactive $allnodes $mmcmd
5180        [[ $? -ne 0 ]] && cleanupAndExit
5181        daemonInactiveVerified=yes
5182      fi
5183
5184      # Make the change to the work copy of the mmfs.cfg file.
5185      attr="enableUIDremap"
5186      mmfscfgChange=yes
5187      ;;
5188
5189
5190    #---------------------
5191    "enablestatuidremap" )
5192    #---------------------
5193      if [[ $value != DEFAULT ]]
5194      then
5195        # Check the new attribute value.
5196        if [[ $value != yes && $value != no ]]
5197        then
5198          printErrorMsg 37 $mmcmd $attr
5199          cleanupAndExit
5200        fi
5201      fi
5202
5203      if [[ -n $immediate ]]
5204      then
5205        # -i cannot be used.
5206        printErrorMsg 375 $mmcmd $immediate $attr
5207        cleanupAndExit
5208      fi
5209
5210      # The daemon must be down on all nodes in the cluster.
5211      if [[ -z $daemonInactiveVerified ]]
5212      then
5213        printInfoMsg 339
5214        verifyDaemonInactive $allnodes $mmcmd
5215        [[ $? -ne 0 ]] && cleanupAndExit
5216        daemonInactiveVerified=yes
5217      fi
5218
5219      # Make the change to the work copy of the mmfs.cfg file.
5220      attr="enableStatUIDremap"
5221      mmfscfgChange=yes
5222      ;;
5223
5224    #----------------
5225    "uidexpiration" )
5226    #----------------
5227      if [[ $value != DEFAULT ]]
5228      then
5229        # Convert attribute value into a simple integer.
5230        intValue=$(checkIntRange uidExpiration $value)
5231        [[ $? -ne 0 ]] && cleanupAndExit
5232      fi
5233
5234      if [[ -n $immediate ]]
5235      then
5236        # -i cannot be used.
5237        printErrorMsg 375 $mmcmd $immediate $attr
5238        cleanupAndExit
5239      fi
5240
5241      # The daemon must be down on all nodes in the cluster.
5242      if [[ -z $daemonInactiveVerified ]]
5243      then
5244        printInfoMsg 339
5245        verifyDaemonInactive $allnodes $mmcmd
5246        [[ $? -ne 0 ]] && cleanupAndExit
5247        daemonInactiveVerified=yes
5248      fi
5249
5250      # Make the change to the work copy of the mmfs.cfg file.
5251      attr="uidExpiration"
5252      mmfscfgChange=yes
5253      ;;
5254
5255    #---------------------
5256    "maxallocpcttocache" )
5257    #---------------------
5258      if [[ $value != DEFAULT ]]
5259      then
5260        # Convert attribute value into a simple integer.
5261        intValue=$(checkIntRange maxAllocPctToCache $value 0 100)
5262        [[ $? -ne 0 ]] && cleanupAndExit
5263      fi
5264
5265      # If needed, set parameters for the tsctl command.
5266      if [[ -n $immediate ]]
5267      then
5268        if [[ $value = DEFAULT ]]
5269        then
5270          tsctlParms="$tsctlParms $attr 0 "
5271        else
5272          tsctlParms="$tsctlParms $attr $value "
5273        fi
5274      fi
5275
5276      # Make the change to the work copy of the mmfs.cfg file.
5277      attr="maxAllocPctToCache"
5278      mmfscfgChange=yes
5279      ;;
5280
5281
5282    #---------------------------
5283    "ignorereplicaspaceonstat" )
5284    #---------------------------
5285      if [[ $value != DEFAULT ]]
5286      then
5287        # Check the new attribute value.
5288        if [[ $value != yes && $value != no ]]
5289        then
5290          printErrorMsg 37 $mmcmd $attr
5291          cleanupAndExit
5292        fi
5293      fi
5294
5295      # If needed, set parameters for the tsctl command.
5296      if [[ -n $immediate ]]
5297      then
5298        if [[ $value = DEFAULT ]]
5299        then
5300          tsctlParms="$tsctlParms $attr no "
5301        else
5302          tsctlParms="$tsctlParms $attr $value "
5303        fi
5304      fi
5305
5306      # Make the change to the work copy of the mmfs.cfg file.
5307      attr="IgnoreReplicaSpaceOnStat"
5308      mmfscfgChange=yes
5309      ;;
5310
5311
5312    #------------------------
5313    "enabletreebasedquotas" )
5314    #------------------------
5315      if [[ $value != DEFAULT ]]
5316      then
5317        # Check the new attribute value.
5318        if [[ $value != yes && $value != no ]]
5319        then
5320          printErrorMsg 37 $mmcmd $attr
5321          cleanupAndExit
5322        fi
5323      fi
5324
5325      if [[ -n $immediate ]]
5326      then
5327        # -i cannot be used.
5328        printErrorMsg 375 $mmcmd $immediate $attr
5329        cleanupAndExit
5330      fi
5331
5332      # The daemon must be down on all nodes in the cluster.
5333      if [[ -z $daemonInactiveVerified ]]
5334      then
5335        printInfoMsg 339
5336        verifyDaemonInactive $allnodes $mmcmd
5337        [[ $? -ne 0 ]] && cleanupAndExit
5338        daemonInactiveVerified=yes
5339      fi
5340
5341      # Make the change to the work copy of the mmfs.cfg file.
5342      attr="enableTreeBasedQuotas"
5343      mmfscfgChange=yes
5344      ;;
5345
5346
5347    #----------
5348    "license" )
5349    #----------
5350      if [[ -n $immediate ]]
5351      then
5352        # -i cannot be used.
5353        printErrorMsg 375 $mmcmd $immediate $attr
5354        cleanupAndExit
5355      fi
5356
5357      # Make the change to the work copy of the mmfs.cfg file.
5358      attr="LICENSE"
5359      mmfscfgChange=yes
5360      ;;
5361
5362
5363    #-------------------------
5364    "listenonallinterfaces"  )
5365    #-------------------------
5366      if [[ $value != DEFAULT ]]
5367      then
5368        # Check the new attribute value.
5369        if [[ $value != yes && $value != no ]]
5370        then
5371          printErrorMsg 37 $mmcmd $attr
5372          cleanupAndExit
5373        fi
5374      fi
5375
5376      if [[ -n "$arglist" ]]
5377      then
5378        # <nodelist> cannot be used.
5379        printErrorMsg 192 $mmcmd $attr
5380        cleanupAndExit
5381      fi
5382
5383      if [[ -n $immediate ]]
5384      then
5385        # -i cannot be used.
5386        printErrorMsg 375 $mmcmd $immediate $attr
5387        cleanupAndExit
5388      fi
5389
5390      # Make the change to the work copy of the mmfs.cfg file.
5391      attr="listenOnAllInterfaces"
5392      mmfscfgChange=yes
5393      ;;
5394
5395
5396    #----------
5397    "subnets" )
5398    #----------
5399      if [[ -n $immediate ]]
5400      then
5401        # -i cannot be used.
5402        printErrorMsg 375 $mmcmd $immediate $attr
5403        cleanupAndExit
5404      fi
5405
5406      # Make the change to the work copy of the mmfs.cfg file.
5407      attr="subnets"
5408      mmfscfgChange=yes
5409      ;;
5410
5411
5412    #---------------------
5413    "maxsgdesciobufsize" )   # Undocumented attribute
5414    #---------------------
5415      if [[ $value != DEFAULT ]]
5416      then
5417        # Convert attribute value into a simple integer.
5418        intValue=$(checkIntRange maxSGDescIOBufSize $value 262144 2097152)
5419        [[ $? -ne 0 ]] && cleanupAndExit
5420      fi
5421
5422      if [[ -n $immediate ]]
5423      then
5424        # -i cannot be used.
5425        printErrorMsg 375 $mmcmd $immediate $attr
5426        cleanupAndExit
5427      fi
5428
5429      # Make the change to the work copy of the mmfs.cfg file.
5430      attr="maxSGDescIOBufSize"
5431      mmfscfgChange=yes
5432      ;;
5433
5434
5435    #-------------------------
5436    "distributedtokenserver" )
5437    #-------------------------
5438      if [[ $value != DEFAULT ]]
5439      then
5440        # Check the new attribute value.
5441        if [[ $value != yes && $value != no ]]
5442        then
5443          printErrorMsg 37 $mmcmd $attr
5444          cleanupAndExit
5445        fi
5446      fi
5447
5448      if [[ -n "$arglist" ]]
5449      then
5450        # <nodelist> cannot be used.
5451        printErrorMsg 192 $mmcmd $attr
5452        cleanupAndExit
5453      fi
5454
5455      # If needed, set parameters for the tsctl command.
5456      if [[ -n $immediate ]]
5457      then
5458        if [[ $value = DEFAULT ]]
5459        then
5460          tsctlParms="$tsctlParms $attr yes "
5461        else
5462          tsctlParms="$tsctlParms $attr $value "
5463        fi
5464      fi
5465
5466      # Make the change to the work copy of the mmfs.cfg file.
5467      attr="distributedTokenServer"
5468      mmfscfgChange=yes
5469      ;;
5470
5471
5472    #------------------------
5473    "multitmmountthreshold" )
5474    #------------------------
5475      if [[ $value != DEFAULT ]]
5476      then
5477        n=$(checkIntRange multiTMMountThreshold $value 1 4096)
5478        [[ $? -ne 0 ]] && cleanupAndExit
5479      fi
5480
5481      if [[ -n "$arglist" ]]
5482      then
5483        # <nodelist> cannot be used.
5484        printErrorMsg 192 $mmcmd $attr
5485        cleanupAndExit
5486      fi
5487
5488      # If needed, set parameters for the tsctl command.
5489      if [[ -n $immediate ]]
5490      then
5491        if [[ $value = DEFAULT ]]
5492        then
5493          tsctlParms="$tsctlParms $attr 2 "
5494        else
5495          tsctlParms="$tsctlParms $attr $value "
5496        fi
5497      fi
5498
5499      # Make the change to the work copy of the mmfs.cfg file.
5500      attr="multiTMMountThreshold"
5501      mmfscfgChange=yes
5502      ;;
5503
5504
5505    #------------------
5506    "maxtokenservers" )
5507    #------------------
5508      if [[ $value != DEFAULT ]]
5509      then
5510        n=$(checkIntRange maxTokenServers $value 1 256)
5511        [[ $? -ne 0 ]] && cleanupAndExit
5512      fi
5513
5514      if [[ -n "$arglist" ]]
5515      then
5516        # <nodelist> cannot be used.
5517        printErrorMsg 192 $mmcmd $attr
5518        cleanupAndExit
5519      fi
5520
5521      # If needed, set parameters for the tsctl command.
5522      if [[ -n $immediate ]]
5523      then
5524        if [[ $value = DEFAULT ]]
5525        then
5526          tsctlParms="$tsctlParms $attr 128 "
5527        else
5528          tsctlParms="$tsctlParms $attr $value "
5529        fi
5530      fi
5531
5532      # Make the change to the work copy of the mmfs.cfg file.
5533      attr="maxTokenServers"
5534      mmfscfgChange=yes
5535      ;;
5536
5537    #----------------
5538    "healthcheckinterval" )
5539    #----------------
5540      if [[ $value != DEFAULT ]]
5541      then
5542        n=$(checkIntRange healthCheckInterval $value 10 7200)
5543        [[ $? -ne 0 ]] && cleanupAndExit
5544      fi
5545
5546      if [[ -n $immediate ]]
5547      then
5548        # -i cannot be used.
5549        printErrorMsg 375 $mmcmd $immediate $attr
5550        cleanupAndExit
5551      fi
5552
5553      # Make the change to the work copy of the mmfs.cfg file.
5554      attr="healthCheckInterval"
5555      mmfscfgChange=yes
5556      ;;
5557
5558    #-----------------------
5559    "setctimeonattrchange" )
5560    #-----------------------
5561      if [[ $value != DEFAULT ]]
5562      then
5563        # Check the new attribute value.
5564        if [[ $value != yes && $value != no ]]
5565        then
5566          printErrorMsg 37 $mmcmd $attr
5567          cleanupAndExit
5568        fi
5569      fi
5570
5571      if [[ -n "$arglist" ]]
5572      then
5573        # <nodelist> cannot be used.
5574        printErrorMsg 192 $mmcmd $attr
5575        cleanupAndExit
5576      fi
5577
5578      # If needed, set parameters for the tsctl command.
5579      if [[ -n $immediate ]]
5580      then
5581        if [[ $value = DEFAULT ]]
5582        then
5583          tsctlParms="$tsctlParms $attr yes "
5584        else
5585          tsctlParms="$tsctlParms $attr $value "
5586        fi
5587      fi
5588
5589      # Make the change to the work copy of the mmfs.cfg file.
5590      attr="setCtimeOnAttrChange"
5591      mmfscfgChange=yes
5592      ;;
5593
5594
5595    #-----------------
5596    "qrevokewatchthreshold" )
5597    #-----------------
5598      if [[ $value != DEFAULT ]]
5599      then
5600        # Check the new attribute value.
5601        n=$(checkIntRange qRevokeWatchThreshold $value 0 600)
5602        [[ $? -ne 0 ]] && cleanupAndExit
5603      fi
5604
5605      if [[ -n "$arglist" ]]
5606      then
5607        # <nodelist> cannot be used.
5608        printErrorMsg 192 $mmcmd $attr
5609        cleanupAndExit
5610      fi
5611
5612      # If needed, set parameters for the tsctl command.
5613      if [[ -n $immediate ]]
5614      then
5615        if [[ $value = DEFAULT ]]
5616        then
5617          tsctlParms="$tsctlParms $attr 2 "
5618        else
5619          tsctlParms="$tsctlParms $attr $value "
5620        fi
5621      fi
5622
5623      # Make the change to the work copy of the mmfs.cfg file.
5624      attr="qRevokeWatchThreshold"
5625      mmfscfgChange=yes
5626      ;;
5627
5628    #----------------------
5629    "allowdeleteaclonchmod" )
5630    #----------------------
5631      if [[ $value != DEFAULT ]]
5632      then
5633        # Check the new attribute value.
5634        if [[ $value != yes && $value != no ]]
5635        then
5636          printErrorMsg 37 $mmcmd $attr
5637          cleanupAndExit
5638        fi
5639      fi
5640
5641      # If needed, set parameters for the tsctl command.
5642      if [[ -n $immediate ]]
5643      then
5644        if [[ $value = DEFAULT ]]
5645        then
5646          tsctlParms="$tsctlParms $attr yes "
5647        else
5648          tsctlParms="$tsctlParms $attr $value "
5649        fi
5650      fi
5651
5652      # Make the change to the work copy of the mmfs.cfg file.
5653      attr="allowDeleteAclOnChmod"
5654      mmfscfgChange=yes
5655      ;;
5656
5657
5658    ####################################################################
5659    # The following parameters are obsolete.  They can only be deleted.
5660    ####################################################################
5661
5662    #-------------------------------------------
5663    "singlenodequorum" | "usesinglenodequorum" ) # Obsolete attribute
5664    #-------------------------------------------
5665      if [[ $value != DEFAULT ]]
5666      then
5667        # Obsolete attribute.
5668        printErrorMsg 19 $mmcmd $attr
5669        cleanupAndExit
5670      fi
5671
5672      if [[ -n "$arglist" ]]
5673      then
5674        # <nodelist> cannot be used.
5675        printErrorMsg 192 $mmcmd $attr
5676        cleanupAndExit
5677      fi
5678
5679      # Make the change to the work copy of the mmfs.cfg file.
5680      attr="useSingleNodeQuorum"
5681      mmfscfgChange=yes
5682      ;;
5683
5684    #-------------
5685    "corequorum" )        # Obsolete parameter
5686    #-------------
5687      if [[ $value != DEFAULT ]]
5688      then
5689        # Obsolete attribute.
5690        printErrorMsg 19 $mmcmd $attr
5691        cleanupAndExit
5692      fi
5693
5694      if [[ -n "$arglist" ]]
5695      then
5696        # <nodelist> cannot be used.
5697        printErrorMsg 192 $mmcmd $attr
5698        cleanupAndExit
5699      fi
5700
5701      # Make the change to the work copy of the mmfs.cfg file.
5702      attr="coreQuorum"
5703      mmfscfgChange=yes
5704      ;;
5705
5706    #-------------
5707    "diskquorum" )        # Obsolete parameter
5708    #-------------
5709      if [[ $value != DEFAULT ]]
5710      then
5711        # Obsolete attribute.
5712        printErrorMsg 19 $mmcmd $attr
5713        cleanupAndExit
5714      fi
5715
5716      if [[ -n "$arglist" ]]
5717      then
5718        # <nodelist> cannot be used.
5719        printErrorMsg 192 $mmcmd $attr
5720        cleanupAndExit
5721      fi
5722
5723      # Make the change to the work copy of the mmfs.cfg file.
5724      attr="diskQuorum"
5725      mmfscfgChange=yes
5726      ;;
5727
5728    #----------------
5729    "comm_protocol" )  # Obsolete attribute
5730    #----------------
5731      if [[ $value != DEFAULT ]]
5732      then
5733        # Obsolete attribute.
5734        printErrorMsg 19 $mmcmd $attr
5735        cleanupAndExit
5736      fi
5737
5738      if [[ -n "$arglist" ]]
5739      then
5740        # <nodelist> cannot be used.
5741        printErrorMsg 192 $mmcmd $attr
5742        cleanupAndExit
5743      fi
5744
5745      # Make the change to the work copy of the mmfs.cfg file.
5746      attr="comm_protocol"
5747      mmfscfgChange=yes
5748      mmsdrfsModified=yes
5749      ;;
5750
5751    #-------------
5752    "dynmemsize" )  # Obsolete attribute
5753    #-------------
5754      if [[ $value != DEFAULT ]]
5755      then
5756        # Obsolete attribute.
5757        printErrorMsg 19 $mmcmd $attr
5758        cleanupAndExit
5759      fi
5760
5761      if [[ -n "$arglist" ]]
5762      then
5763        # <nodelist> cannot be used.
5764        printErrorMsg 192 $mmcmd $attr
5765        cleanupAndExit
5766      fi
5767
5768      # Make the change to the work copy of the mmfs.cfg file.
5769      attr="dynMemSize"
5770      mmfscfgChange=yes
5771      mmsdrfsModified=yes
5772      ;;
5773
5774    #--------------
5775    "maxpagepool" )  # Obsolete attribute
5776    #--------------
5777      if [[ $value != DEFAULT ]]
5778      then
5779        # Obsolete attribute.
5780        printErrorMsg 19 $mmcmd $attr
5781        cleanupAndExit
5782      fi
5783
5784      if [[ -n "$arglist" ]]
5785      then
5786        # <nodelist> cannot be used.
5787        printErrorMsg 192 $mmcmd $attr
5788        cleanupAndExit
5789      fi
5790
5791      # Make the change to the work copy of the mmfs.cfg file.
5792      attr="maxpagepool"
5793      mmfscfgChange=yes
5794      mmsdrfsModified=yes
5795      ;;
5796
5797    #-------------
5798    "mallocsize" )  # Obsolete attribute
5799    #-------------
5800      if [[ $value != DEFAULT ]]
5801      then
5802        # Obsolete attribute.
5803        printErrorMsg 19 $mmcmd $attr
5804        cleanupAndExit
5805      fi
5806
5807      if [[ -n "$arglist" ]]
5808      then
5809        # <nodelist> cannot be used.
5810        printErrorMsg 192 $mmcmd $attr
5811        cleanupAndExit
5812      fi
5813
5814      # Make the change to the work copy of the mmfs.cfg file.
5815      attr="mallocsize"
5816      mmfscfgChange=yes
5817      mmsdrfsModified=yes
5818      ;;
5819
5820    #-----------------------
5821    "memrebalanceinterval" )  # Obsolete attribute
5822    #-----------------------
5823      if [[ $value != DEFAULT ]]
5824      then
5825        # Obsolete attribute.
5826        printErrorMsg 19 $mmcmd $attr
5827        cleanupAndExit
5828      fi
5829
5830      if [[ -n "$arglist" ]]
5831      then
5832        # <nodelist> cannot be used.
5833        printErrorMsg 192 $mmcmd $attr
5834        cleanupAndExit
5835      fi
5836
5837      # Make the change to the work copy of the mmfs.cfg file.
5838      attr="memrebalanceinterval"
5839      mmfscfgChange=yes
5840      mmsdrfsModified=yes
5841      ;;
5842
5843    #-------------------
5844    "importancefactor" )  # Obsolete attribute
5845    #-------------------
5846      if [[ $value != DEFAULT ]]
5847      then
5848        # Obsolete attribute.
5849        printErrorMsg 19 $mmcmd $attr
5850        cleanupAndExit
5851      fi
5852
5853      if [[ -n "$arglist" ]]
5854      then
5855        # <nodelist> cannot be used.
5856        printErrorMsg 192 $mmcmd $attr
5857        cleanupAndExit
5858      fi
5859
5860      # Make the change to the work copy of the mmfs.cfg file.
5861      attr="importancefactor"
5862      mmfscfgChange=yes
5863      mmsdrfsModified=yes
5864      ;;
5865
5866    #-----------------
5867    "worker2threads" )      # Obsolete parameter
5868    #-----------------
5869      if [[ $value != DEFAULT ]]
5870      then
5871        # Obsolete attribute.
5872        printErrorMsg 19 $mmcmd $attr
5873        cleanupAndExit
5874      fi
5875
5876      if [[ -n "$arglist" ]]
5877      then
5878        # <nodelist> cannot be used.
5879        printErrorMsg 192 $mmcmd $attr
5880        cleanupAndExit
5881      fi
5882
5883      # Make the change to the work copy of the mmfs.cfg file.
5884      attr="worker2Threads"
5885      mmfscfgChange=yes
5886      ;;
5887
5888    #----------------
5889    "usespsecurity" )          # Obsolete parameter
5890    #----------------
5891      if [[ $value != DEFAULT ]]
5892      then
5893        # Obsolete attribute.
5894        printErrorMsg 19 $mmcmd $attr
5895        cleanupAndExit
5896      fi
5897
5898      if [[ -n "$arglist" ]]
5899      then
5900        # <nodelist> cannot be used.
5901        printErrorMsg 192 $mmcmd $attr
5902        cleanupAndExit
5903      fi
5904
5905      # Make the change to the work copy of the mmfs.cfg file.
5906      attr="useSPSecurity"
5907      mmfscfgChange=yes
5908      ;;
5909
5910    #--------------------
5911    "useauthentication" )      # Obsolete attribute
5912    #--------------------
5913      if [[ $value != DEFAULT ]]
5914      then
5915        # Obsolete attribute.
5916        printErrorMsg 19 $mmcmd $attr
5917        cleanupAndExit
5918      fi
5919
5920      if [[ -n "$arglist" ]]
5921      then
5922        # <nodelist> cannot be used.
5923        printErrorMsg 192 $mmcmd $attr
5924        cleanupAndExit
5925      fi
5926
5927      # Make the change to the work copy of the mmfs.cfg file.
5928      attr="useAuthentication"
5929      mmfscfgChange=yes
5930      ;;
5931
5932    #---------------------
5933    "spsecworkerthreads" )     # Obsolete parameter
5934    #---------------------
5935      if [[ $value != DEFAULT ]]
5936      then
5937        # Obsolete attribute.
5938        printErrorMsg 19 $mmcmd $attr
5939        cleanupAndExit
5940      fi
5941
5942      if [[ -n "$arglist" ]]
5943      then
5944        # <nodelist> cannot be used.
5945        printErrorMsg 192 $mmcmd $attr
5946        cleanupAndExit
5947      fi
5948
5949      # Make the change to the work copy of the mmfs.cfg file.
5950      attr="spsecWorkerThreads"
5951      mmfscfgChange=yes
5952      ;;
5953
5954    #---------
5955    "group"  )          # Obsolete parameter
5956    #---------
5957      if [[ $value != DEFAULT ]]
5958      then
5959        # Obsolete attribute.
5960        printErrorMsg 19 $mmcmd $attr
5961        cleanupAndExit
5962      fi
5963
5964      if [[ -n "$arglist" ]]
5965      then
5966        # <nodelist> cannot be used.
5967        printErrorMsg 192 $mmcmd $attr
5968        cleanupAndExit
5969      fi
5970
5971      # Make the change to the work copy of the mmfs.cfg file.
5972      attr="group"
5973      mmfscfgChange=yes
5974      ;;
5975
5976    #------------
5977    "recgroup"  )          # Obsolete parameter
5978    #------------
5979      if [[ $value != DEFAULT ]]
5980      then
5981        # Obsolete attribute.
5982        printErrorMsg 19 $mmcmd $attr
5983        cleanupAndExit
5984      fi
5985
5986      if [[ -n "$arglist" ]]
5987      then
5988        # <nodelist> cannot be used.
5989        printErrorMsg 192 $mmcmd $attr
5990        cleanupAndExit
5991      fi
5992
5993      # Make the change to the work copy of the mmfs.cfg file.
5994      attr="recgroup"
5995      mmfscfgChange=yes
5996      ;;
5997
5998    #-----------
5999    "nodelist" )     # Obsolete parameter
6000    #-----------
6001      if [[ $value != DEFAULT ]]
6002      then
6003        # Obsolete attribute.
6004        printErrorMsg 19 $mmcmd $attr
6005        cleanupAndExit
6006      fi
6007
6008      if [[ -n "$arglist" ]]
6009      then
6010        # <nodelist> cannot be used.
6011        printErrorMsg 192 $mmcmd $attr
6012        cleanupAndExit
6013      fi
6014
6015      # Make the change to the work copy of the mmfs.cfg file.
6016      attr="nodelist"
6017      mmfscfgChange=yes
6018      ;;
6019
6020
6021    #------------
6022    "multinode" )     # Obsolete parameter
6023    #------------
6024      if [[ $value != DEFAULT ]]
6025      then
6026        # Obsolete attribute.
6027        printErrorMsg 19 $mmcmd $attr
6028        cleanupAndExit
6029      fi
6030
6031      if [[ -n "$arglist" ]]
6032      then
6033        # <nodelist> cannot be used.
6034        printErrorMsg 192 $mmcmd $attr
6035        cleanupAndExit
6036      fi
6037
6038      # Make the change to the work copy of the mmfs.cfg file.
6039      attr="multinode"
6040      mmfscfgChange=yes
6041      ;;
6042
6043
6044    #------------
6045    "nodeprefs" )     # Obsolete parameter
6046    #------------
6047      if [[ $value != DEFAULT ]]
6048      then
6049        # Obsolete attribute.
6050        printErrorMsg 19 $mmcmd $attr
6051        cleanupAndExit
6052      fi
6053
6054      if [[ -n "$arglist" ]]
6055      then
6056        # <nodelist> cannot be used.
6057        printErrorMsg 192 $mmcmd $attr
6058        cleanupAndExit
6059      fi
6060
6061      # Make the change to the work copy of the mmfs.cfg file.
6062      attr="nodeprefs"
6063      mmfscfgChange=yes
6064      ;;
6065
6066
6067    #-------------------
6068    "locktableversion" )     # Obsolete parameter
6069    #-------------------
6070      if [[ $value != DEFAULT ]]
6071      then
6072        # Obsolete attribute.
6073        printErrorMsg 19 $mmcmd $attr
6074        cleanupAndExit
6075      fi
6076
6077      if [[ -n "$arglist" ]]
6078      then
6079        # <nodelist> cannot be used.
6080        printErrorMsg 192 $mmcmd $attr
6081        cleanupAndExit
6082      fi
6083
6084      # Make the change to the work copy of the mmfs.cfg file.
6085      attr="lockTableVersion"
6086      mmfscfgChange=yes
6087      ;;
6088
6089
6090    #---------
6091    "logdir" )     # Obsolete parameter
6092    #---------
6093      if [[ $value != DEFAULT ]]
6094      then
6095        # Obsolete attribute.
6096        printErrorMsg 19 $mmcmd $attr
6097        cleanupAndExit
6098      fi
6099
6100      if [[ -n "$arglist" ]]
6101      then
6102        # <nodelist> cannot be used.
6103        printErrorMsg 192 $mmcmd $attr
6104        cleanupAndExit
6105      fi
6106
6107      # Make the change to the work copy of the mmfs.cfg file.
6108      attr="logDir"
6109      mmfscfgChange=yes
6110      ;;
6111
6112
6113    #--------------
6114    "minpagepool" )     # Obsolete parameter
6115    #--------------
6116      if [[ $value != DEFAULT ]]
6117      then
6118        # Obsolete attribute.
6119        printErrorMsg 19 $mmcmd $attr
6120        cleanupAndExit
6121      fi
6122
6123      if [[ -n "$arglist" ]]
6124      then
6125        # <nodelist> cannot be used.
6126        printErrorMsg 192 $mmcmd $attr
6127        cleanupAndExit
6128      fi
6129
6130      # Make the change to the work copy of the mmfs.cfg file.
6131      attr="minpagepool"
6132      mmfscfgChange=yes
6133      ;;
6134
6135
6136    # End of obsolete attribute section.
6137    # Add new attributes above the obsolete section.
6138
6139    #----
6140    *   )    # unknown attribute
6141    #----
6142      # Warning:  unknown attribute.  The user is asked to press the enter key
6143      # to bypass this argument.  If the user enters 999, we assume the guy
6144      # knows what he is doing and we'll put the attribute in the mmfs.cfg file.
6145      printErrorMsg 277 $mmcmd $attr
6146      read response
6147      [[ $response = "999" ]] && mmfscfgChange=yes
6148    ;;
6149
6150  esac
6151
6152
6153  ###################################################################
6154  # If -I (Immediate ONLY) was specified, then do not
6155  # make any change to the work copy of the mmfs.cfg file.
6156  ###################################################################
6157  if [[ -n $immediateOnly ]]
6158  then
6159    mmfscfgChange=no
6160    mmsdrfsModified=no
6161    mmfscfgModified=no
6162    synchronousNotify=no
6163  fi
6164
6165  ###################################################################
6166  # Make the change to the work copy of the mmfs.cfg file.
6167  ###################################################################
6168  if [[ $mmfscfgChange = yes ]]
6169  then
6170    if [[ -n $ignoreNodeList ]]
6171    then
6172      $mmfixcfg "$attr" "$value" <$tmpcfgFile >$newcfg
6173    else
6174      $mmfixcfg "$attr" "$value" $argcust <$tmpcfgFile >$newcfg
6175    fi
6176    checkForMmfixcfgErrors "$attr" $?
6177    mmfscfgModified=yes
6178
6179    # Get ready for the next attribute.
6180    $cp $newcfg $tmpcfgFile
6181    checkForErrors "cp $newcfg $tmpcfgFile" $?
6182    mmfscfgChange=no
6183  fi   #  end of if [[ $mmfscfgChange = yes ]]
6184
6185done  # end of main loop
6186
6187
6188# Remove any back-to-back or unnecessary occurrences of [common]
6189# and/or [node] headers that were created by mmfixcfg.
6190$rm -f $tmpfile
6191awk '                                                            \
6192  BEGIN {   # Initialize state variables.                        \
6193    { headerFound = 0 }                                          \
6194    { oldHeader = null }                                         \
6195  }                                                              \
6196  # Process any [common] or [node] header lines.                 \
6197  # If a header line is encountered, we save it until we         \
6198  # encounter an attribute line, since we may encounter          \
6199  # multiple headers before encountering an attribute.           \
6200  # If a header is immediately followed by a header,             \
6201  # the 1st header is dropped and the 2nd header is saved.       \
6202  # If a new header is encountered and it matches the            \
6203  # last header that was output, it is not printed.              \
6204  # When an attribute line is encountered immediately after      \
6205  # a header, the header and the attribute are printed,          \
6206  # provided the header is different than the header in effect.  \
6207  #                                                              \
6208  /^\[/ {   # A header line was encountered.  Remember it.       \
6209    { headerFound = 1 }                                          \
6210    { newHeader = $0 }                                           \
6211    { next }                                                     \
6212  }                                                              \
6213  {  # A non-header line was encountered.  Do the right thing.   \
6214    if ( headerFound == 1 ) {                                    \
6215      if ( newHeader != oldHeader ) {                            \
6216        { print newHeader >> "'$tmpfile'" }                      \
6217        { oldHeader = newHeader }                                \
6218      }                                                          \
6219      { print $0 >> "'$tmpfile'" }                               \
6220      { headerFound = 0 }                                        \
6221    } else {                                                     \
6222      { print $0 >> "'$tmpfile'" }                               \
6223    }                                                            \
6224  }                                                              \
6225  END { }                                                        \
6226 ' $newcfg
6227checkForErrors awk $?
6228
6229# Use the modified version of the file as the new config file.
6230$mv $tmpfile $newcfg
6231
6232# See if the config file changed as a result of the awk script above.
6233# Note that it is not necessary to do this if we know that the file
6234# has changed as a result of changing a mmfs.cfg attribute.
6235if [[ $mmfscfgModified = no ]]
6236then
6237  $diff $oldcfgFile $newcfg >/dev/null 2>/dev/null
6238  [[ $? -eq 1 ]] && mmfscfgModified=yes
6239fi
6240
6241
6242##########################################################
6243# Put the new mmfs.cfg information in the mmsdrfs file.
6244##########################################################
6245if [[ $mmfscfgModified = yes || $mmsdrfsModified = yes ]]
6246then
6247  # Add the new version of the mmfs.cfg file.  If there were no changes to
6248  # parameters that reside in mmfs.cfg, newcfg is the same as oldcfgFile.
6249  appendCfgFile $nodesetId $newcfg $newsdrfs
6250  checkForErrors "appendCfgFile" $?
6251
6252  # Sort the new version of the mmsdrfs file.
6253  LC_ALL=C $SORT_MMSDRFS $newsdrfs -o $newsdrfs
6254  checkForErrors sort $?
6255
6256  mmsdrfsModified=yes
6257  mmfscfgModified=no
6258fi
6259
6260
6261##########################################################
6262# Put the new mmsdrfs file into the sdr.
6263# This function also updates all local system files.
6264##########################################################
6265trap "" HUP INT QUIT KILL
6266
6267if [[ $mmfscfgModified = yes || $mmsdrfsModified = yes ]]
6268then
6269  gpfsObjectInfo=$(commitChanges  \
6270     $nodesetId $nsId $gpfsObjectInfo $newGenNumber $newsdrfs $primaryServer $commitOption)
6271  rc=$?
6272
6273else
6274  # Nothing changed.  The user entered an unknown attribute
6275  # and bailed out, or maybe it was an immediateOnly command.
6276  rc=0
6277fi
6278
6279if [[ $rc -ne 0 ]]
6280then
6281  # The commit step failed.
6282  printErrorMsg 381 $mmcmd
6283  cleanupAndExit
6284else
6285  # Command was successful.
6286  if [[ $mmfscfgModified = yes || $mmsdrfsModified = yes ]]
6287  then
6288    # Generic success message
6289    printErrorMsg 272 $mmcmd
6290
6291  elif [[ -n $immediateOnly ]]
6292  then
6293    : # Nothing done yet, left for immediate execution
6294
6295  else
6296    # Nothing was changed.
6297    printErrorMsg 323 $mmcmd
6298    cleanupAndExit 0
6299  fi
6300fi
6301
6302# If necessary, update the rest of the nodes while still holding
6303# the sdr lock.  This is needed for the changeNodeState request.
6304if [[ $synchronousNotify = yes ]]
6305then
6306  $mmTRACE "synchronous notify starts"
6307  if [[ -s $allnodes ]]
6308  then
6309    propagateSdrfsFile sync $allnodes $newsdrfs $newGenNumber $propagateOptions
6310    rc=$?
6311  elif [[ -s $nodefile ]]
6312  then
6313    propagateSdrfsFile sync $nodefile $newsdrfs $newGenNumber $propagateOptions
6314    rc=$?
6315  else
6316    : # nothing to update
6317  fi
6318  $mmTRACE "synchronous notify ends rc=$rc"
6319  checkForErrors "mmcommon propagateSdrfsFile" $rc
6320fi
6321
6322
6323###################################################################
6324# Unlock the sdr
6325###################################################################
6326freeLockOnServer $primaryServer $ourNodeNumber >/dev/null
6327sdrLocked=no
6328trap posttrap HUP INT QUIT KILL
6329
6330
6331###########################################################################
6332# If immediate changes requested, make them.  Screen out success messages.
6333###########################################################################
6334if [[ -n $immediate ]]
6335then
6336  if [[ -n $tschpoolParms ]]
6337  then
6338    $mmcommon onall $nodefile $unreachedNodes  \
6339                      tschpool "$tschpoolParms" > $tmpfile 2>&1
6340    rc=$?
6341    $cat $tmpfile 1>&2 |  \
6342    $grep -v -e "6027-749" -e "Pool size changed to"
6343  fi
6344
6345  if [[ $rc -eq 0 && -n $tsctlParms ]]
6346  then
6347    $mmcommon onall $nodefile $unreachedNodes  \
6348                      tsctl "setCfgValue $tsctlParms"
6349    rc=$?
6350  fi
6351
6352  if [[ $rc -eq 0 && -n $tsctlParms_onactive ]]
6353  then
6354    $mmcommon onactive $preferredNode $nodefile                     \
6355                       $NO_FILE_COPY $NO_MOUNT_CHECK NULL $NO_LINK  \
6356                       tsctl "setCfgValue $tsctlParms_onactive"
6357    rc=$?
6358  fi
6359
6360  if [[ $rc -ne 0 ]]
6361  then
6362    # The -i step failed.
6363    printErrorMsg 309 $mmcmd
6364  fi
6365fi  # end of if [[ -n $immediate ]]
6366
6367
6368####################################################################
6369# If not already done, propagate the changes to all affected nodes.
6370####################################################################
6371[[ $synchronousNotify = yes || -n $immediateOnly ]] &&  \
6372  cleanupAndExit 0
6373
6374if [[ -s $allnodes ]]
6375then
6376  propagateSdrfsFile async $allnodes $newsdrfs $newGenNumber $propagateOptions
6377elif [[ -s $nodefile ]]
6378then
6379  propagateSdrfsFile async $nodefile $newsdrfs $newGenNumber $propagateOptions
6380else
6381  :  # nothing to update
6382fi
6383
6384cleanupAndExit 0
6385
Note: See TracBrowser for help on using the repository browser.