#!/bin/ksh93 # ALTRAN_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # Copyright (C) Altran ACT S.A.S. 2020,2021. All rights reserved. # # ALTRAN_PROLOG_END_TAG # # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # 61haes_r721 src/43haes/lib/ksh93/hacmp/KLIB_HACMP_is_known_file_system.sh 1.12 # # Licensed Materials - Property of IBM # # COPYRIGHT International Business Machines Corp. 2010 # All Rights Reserved # # US Government Users Restricted Rights - Use, duplication or # disclosure restricted by GSA ADP Schedule Contract with IBM Corp. # # IBM_PROLOG_END_TAG # @(#) 7d4c34b 43haes/lib/ksh93/hacmp/KLIB_HACMP_is_known_file_system.sh, 726, 2147A_aha726, Feb 05 2021 09:50 PM #================================================ # The following, commented line enforces coding # standards when this file is edited via vim. #================================================ # vim:tabstop=4:shiftwidth=4:expandtab:smarttab #================================================ # Start of POD-formatted documentation. Viewing suggestions: # perldoc # pod2text -c # pod2text -c --code # pod2html function devDoc { : <<'=cut' >/dev/null 2>&1 =head1 NAME KLIB_HACMP_is_known_file_system =head1 VERSION Version Number: 1.9 Last Extracted: 6/13/16 11:34:43 Last Changed: 3/19/15 15:53:46 Path, Component, Release(, Level): src/43haes/lib/ksh93/hacmp/KLIB_HACMP_is_known_file_system.sh, hacmp.assist, 61haes_r720 =head1 SYNOPSIS KLIB_HACMP_is_known_file_system =head1 DESCRIPTION Determines if the specified file system is configured within the cluster. =head1 ARGUMENTS 1. vgname [REQUIRED] [string] The label of the volume group that is to be search for within the cluster. 2. rg [OPTIONAL] [string] A reference to use for returning the resource group for this file system. 3. nodelist [OPTIONAL] [string] A reference to use for returning the nodes for this file system. 4. vg [OPTIONAL] [string] A reference to use for returning the volume group for this file system. =head1 RETURN 0: no errors were detected; the operation appears to have been successful 1: a general error has occurred 2: a specified resource does not exist, or could not be found 3: some required input was missing 4: some detected input was incorrect in some way 5: a required dependency does not exist 6: a specified search failed to match any data =head1 COPYRIGHT COPYRIGHT International Business Machines Corp. 2005,2010 All Rights Reserved =cut } # End of POD-formatted documentation. function KLIB_HACMP_is_known_file_system { LINENO=2 . $HALIBROOT/log_entry "$0()" "$CL" : version=@(#) 7d4c34b 43haes/lib/ksh93/hacmp/KLIB_HACMP_is_known_file_system.sh, 726, 2147A_aha726, Feb 05 2021 09:50 PM : INPUTS: $* typeset fsname=${1//\"/} [[ -n $2 ]] && typeset -n rg=$2 [[ -n $3 ]] && typeset -n nodelist=$3 [[ -n $4 ]] && typeset -n vg=$4 [[ $CLMGR_LOGGING == 'med' ]] && set +x # Only trace param values #=================================== : Declare and initialize variables #=================================== typeset -i rc=$RC_UNKNOWN cmd_rc=$RC_UNKNOWN typeset name="" rem="" FS_FILE="$TMPDIR/clmgr.KHikfs.$$" typeset -i try=0 tries=5 typeset RG="" VG="" #================= : Validate input #================= if [[ -z $fsname ]]; then /usr/bin/dspmsg -s $CLMGR_SET $CLMGR_MSGS 100 "\nERROR: a name/label must be provided.\n\n" 1>&2 rc=$RC_MISSING_INPUT else if [[ $FS_COUNT != +([[:digit:]]) ]] || (( FS_COUNT <= 1 )); then while (( $try < $tries )); do print "$0()[$LINENO]($SECONDS): $HASBIN/cl_showfs2" >>$CLMGR_TMPLOG $HASBIN/cl_showfs2 >$FS_FILE 2>>$CLMGR_TMPLOG cmd_rc=$? print "cl_showfs2 RC: $cmd_rc" >>$CLMGR_TMPLOG # Always log command result if (( $cmd_rc == RC_SUCCESS )) && \ [[ -f $FS_FILE && $(head -1 $FS_FILE) != \#* ]] then cmd_rc=$RC_ERROR # Found unexpected, error output fi (( $cmd_rc == RC_SUCCESS )) && break (( try++ )) if (( $try <= ( $tries - 1 ) )); then sleep $try fi done (( $cmd_rc != RC_SUCCESS )) && rc=$RC_ERROR elif [[ -f /var/hacmp/tmp/chocls.try_out ]]; then cp /var/hacmp/tmp/chocls.try_out $FS_FILE else rc=$RC_ERROR fi if (( rc == RC_UNKNOWN )); then while read name vg rg nodelist rem; do [[ $name == *([[:space:]]) || $name == \#* ]] && continue if [[ $name == $fsname ]]; then if [[ -n $rem ]]; then rem=${rem%%+([[:space:]])} nodelist=${rem##*[[:space:]]} fi RG=$($HAUTILS/clodmget -n -q "name=FILESYSTEM AND value=$fsname" -f group HACMPresource) if [[ -z "$RG" ]]; then VG=$(/usr/es/sbin/cluster/events/utils/cl_fs2disk -v $fsname) RG=$($HAUTILS/clodmget -n -q "name=VOLUME_GROUP AND value=$VG" -f group HACMPresource) fi if [[ -n "$RG" ]]; then rg=$RG fi rc=$RC_SUCCESS break fi done <$FS_FILE fi /usr/bin/rm -f $FS_FILE (( $rc != RC_SUCCESS )) && rc=$RC_ERROR fi log_return_msg "$rc" "$0()" "$LINENO" return $? } # End of "KLIB_HACMP_is_known_file_system()"