source: gpfs_3.1_ker2.6.20/lpp/mmfs/bin/mmcrsnapshot @ 195

Last change on this file since 195 was 16, checked in by rock, 17 years ago
  • Property svn:executable set to *
File size: 4.1 KB
RevLine 
[16]1#!/bin/ksh
2# IBM_PROLOG_BEGIN_TAG
3# This is an automatically generated prolog.
4
5
6
7# Licensed Materials - Property of IBM
8
9# (C) COPYRIGHT International Business Machines Corp. 2000,2004
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# @(#)54 1.17 src/avs/fs/mmfs/ts/admin/mmcrsnapshot.sh, mmfs, avs_rgpfs24, rgpfs240610b 11/15/04 02:34:46
17#######################################################################
18#
19#  Usage:  mmcrsnapshot Device Directory
20#
21#######################################################################
22
23# Include global declarations and service routines.
24. /usr/lpp/mmfs/bin/mmglobfuncs
25. /usr/lpp/mmfs/bin/mmsdrfsdef
26. /usr/lpp/mmfs/bin/mmfsfuncs
27
28sourceFile="mmcrsnapshot.sh"
29[[ -n $DEBUG || -n $DEBUGmmcrsnapshot ]] && set -x
30$mmTRACE_ENTER "$*"
31
32usageMsg=371
33integer rc=0
34integer nodeCount=0
35
36
37#####################################################################
38# Process the command arguments.
39# The detailed syntax checking is left for the ts command.
40# Here we make sure that we have the minimum needed to continue.
41#####################################################################
42[[ $arg1 = '-?' || $arg1 = '-h' || $arg1 = '--help' || $arg1 = '--' ]] && \
43  syntaxError "help" $usageMsg
44
45[[ $argc -lt 1  ]] && \
46  syntaxError "missingArgs" $usageMsg
47
48device=$arg1   # Save the stripe group device (always the first parameter).
49shift 1        # Drop the device name from the parameter list.
50argList=$@     # Save the remainder of the argument list.
51
52
53########################################################################
54# Set up trap exception handling and call the gpfsInit function.
55# It will ensure that the local copy of the mmsdrfs and the rest of the
56# GPFS system files are up-to-date.  There is no need to lock the sdr.
57########################################################################
58trap pretrap2 HUP INT QUIT KILL
59gpfsInitOutput=$(gpfsInit nolock)
60setGlobalVar $? $gpfsInitOutput
61
62
63###########################################################
64# Make sure the specified file system exists and is local.
65###########################################################
66findFSoutput=$(findFS "$device" $mmsdrfsFile)
67[[ -z $findFSoutput ]] && cleanupAndExit
68
69# Parse the output from the findFS function
70set -f ; set -- $findFSoutput ; set +f
71fqDeviceName=$1
72deviceName=$2
73fsHomeCluster=$3
74
75# Exit with a message if the command was invoked for a remote file system.
76if [[ $fsHomeCluster != $HOME_CLUSTER ]]
77then
78  # Command is not allowed for remote file systems.
79  printErrorMsg 106 $mmcmd $device $fsHomeCluster
80  cleanupAndExit 1
81fi
82
83
84############################################################################
85# We come here if this is a local filesystem.  Invoke the command directly.
86############################################################################
87${mmcmdDir}/${links}/mmcrsnapshot $fqDeviceName $argList
88rc=$(remapRC $?)
89
90# If acceptable error (daemon not running, waiting for quorum),
91# try some other node.  Otherwise, get out; either the command worked
92# or the errors are not acceptable.
93if [[ $rc -ne $MM_DaemonDown && $rc -ne $MM_QuorumWait ]]
94then
95  if [[ $rc -eq $MM_ConnectionReset ]]
96  then
97    # An internode connection was reset.
98    printErrorMsg 257 $mmcmd
99  fi
100  cleanupAndExit $rc
101fi
102
103
104###################################################
105# We come here if the daemon was not up.
106# Find an active node and send the command there.
107###################################################
108
109# Create a file with the reliable names that form
110# the cluster to which the file system belongs.
111nodeCount=$(getNodeFile $REL_HOSTNAME_Field $fsHomeCluster $mmsdrfsFile $nodefile)
112if [[ $nodeCount -eq 0 ]]
113then
114  # The cluster is empty; there is nobody to run the command.
115  printErrorMsg 171 $mmcmd "getNodeFile (nodeCount=0)" 1
116  cleanupAndExit
117fi
118
119# Try the nodes one by one until you find a node that can execute the command.
120preferredNode=0     # We have no idea where to go first; let mmcommon decide.
121$mmcommon linkCommand $preferredNode $nodefile mmcrsnapshot $fqDeviceName $argList
122rc=$?
123
124cleanupAndExit $rc
125
Note: See TracBrowser for help on using the repository browser.