#!/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_r714 src/43haes/usr/sbin/cluster/cspoc/utilities/clchshjfs2.sh 1.11 # # Licensed Materials - Property of IBM # # Restricted Materials of IBM # # COPYRIGHT International Business Machines Corp. 2001,2012 # 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 # @(#) 4b64c1a 43haes/usr/sbin/cluster/cspoc/utilities/clchshjfs2.sh, 726, 2147A_aha726, Mar 29 2021 04:40 PM # Function: # # Return the output of cl_showfs2, as saved in /var/hacmp/tmp/chocls.try_out, in a # form that can be used to populate the change/show panel for shared JFS # or JFS2 file systems. # # Arguments: # # File system name # Volume group name # Resource group name # Node list # # Return Values: # 0 success # 1 failure # ############################################################################### [[ $VERBOSE_LOGGING == "high" ]] && set -x [[ $VERBOSE_LOGGING == "high" ]] && version='1.11' export LC_ALL=C PROGNAME=${0##*/} print $* | read FS_name VG_name rest # given file system and volume group Nodelist=${rest##* } # node list is the last time RG_name=${rest% *} # allow for "not in a resource group" # : Headers to identify the variables to SMIT # jfs_header="MountPoint:Device:Vfs:Nodename:Mountgroup:Size:Options:AutoMount:Acct:OtherOptions:LvSize:FsSize:FragSize:Nbpi:Compress:Bf:AgSize:LogLV:" jfs2_header="MountPoint:Device:Vfs:Nodename:Mountgroup:Size:Options:AutoMount:Acct:OtherOptions:LvSize:FsSize:BlockSize:Sparse:InlineLog:InlineLogSz:EAformat:Quota:DMAPI:VIX:LogLV:" jfs2_61_hdr="MountPoint:Device:Vfs:Nodename:Type:Size:Options:AutoMount:Acct:OtherOptions:LvSize:FsSize:BlockSize:Sparse:InlineLog:InlineLogSz:EAformat:Quota:DMAPI:VIX:EFS:ISNAPSHOT:maxext:LogLV:" jfs2_61_hdr_with_MountGaurd="MountPoint:Device:Vfs:Nodename:Type:Size:Options:AutoMount:Acct:OtherOptions:LvSize:FsSize:BlockSize:Sparse:InlineLog:InlineLogSz:EAformat:Quota:DMAPI:VIX:EFS:ISNAPSHOT:maxext:MountGuard:LogLV:" jfs2_size=$(print $jfs2_header | tr ':' '\n' | wc -l) jfs2_61_hdr_with_MountGaurd_size=$(print $jfs2_61_hdr_with_MountGaurd | tr ':' '\n' | wc -l) cache="/var/hacmp/tmp/chocls.try_out" # saved output from cl_showfs2 if [[ ! -s $cache ]] then # : If for some reason we were invoked without a cache, go find the required : information # /usr/es/sbin/cluster/sbin/cl_lsjfs2 -cspoc "-n $Nodelist" $FS_name $VG_name | \ sed "s/: /: ${VG_name}:/" > $cache fi # : Find the line in the cache file that corresponds to the file system : and volume group the user selected # line=$(grep :${FS_name}: $cache | grep " ${VG_name}:" | cut -f3- -d':') # Check for Quota attribute value "userquota,groupquota" which is present in /etc/filesystems for a filesystem # for which user had selected "all" from C-SPOC SMIT menu. While filling-in/displaying field values in SMIT # replace "userquota,groupquota" string with "all" as is the case in AIX SMIT menu. if [[ $line == @(*:userquota,groupquota:*) ]] then line=$(print -- $line | sed 's/userquota,groupquota/all/') fi if [[ -z $line ]] then # : If for some reason we cannot find the given filesystem in the cache, : go fetch it directly # /usr/es/sbin/cluster/sbin/cl_lsjfs2 -cspoc "-n $Nodelist" $FS_name $VG_name | \ sed "s/: /: ${VG_name}:/" > $cache # : Now, try to find the file system again # line=$(grep :${FS_name}: $cache | grep " ${VG_name}:" | cut -f3- -d':') if [[ -z $line ]] then # : Simply cannot find anything about this file system # dspmsg -s 103 csopc.msg 393 "${PROGNAME}: File system $FS_name not found\n" $PROGNAME $FS_name return 1 fi fi # : Common parts of the information, what was passed in, so that : it can be used to populate the SMIT panels # header_prefix="#FS_name:VG_name:RG_name:Nodelist" header_values="${FS_name}:${VG_name}:${RG_name}:${Nodelist}" # : Is this a JFS or JFS2 file system # vfs_type=$(print $line | cut -f3 -d':') if [[ $vfs_type == "jfs" ]] then # : JFS header - fields in a JFS file system definition # print ${header_prefix}:${jfs_header} elif [[ $vfs_type == "jfs2" ]] then line_size=$(print $line | tr ':' '\n' | wc -l) if (( $line_size == $jfs2_61_hdr_with_MountGaurd_size )) then # : JFS2 6.1 header with MountGaurd - fields in a JFS2 file system definition # print ${header_prefix}:${jfs2_61_hdr_with_MountGaurd} elif (( $line_size > $jfs2_size )) then # : JFS2 6.1 header - fields in a JFS2 file system definition # print ${header_prefix}:${jfs2_61_hdr} else # : JFS2 header - fields in a JFS2 file system definition # print ${header_prefix}:${jfs2_header} fi fi # : Print the line of data from the cache, preceeded by the input # print ${header_values}:${line}