#!/bin/ksh # ALTRAN_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # Copyright (C) Altran ACT S.A.S. 2017,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/events/utils/cl_get_disk_vg_fs_pvids.sh 1.12 # # Licensed Materials - Property of IBM # # COPYRIGHT International Business Machines Corp. 1990,2008 # 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/usr/sbin/cluster/events/utils/cl_get_disk_vg_fs_pvids.sh, 726, 2147A_aha726, Feb 05 2021 09:50 PM ######################################################################### # # # Name: cl_get_disk_vg_fs_pvids # # # # Description: Given filesystems and/or volume groups, this # # function will return a list of the associated # # PVIDs. # # # # Called by: cl_ssa_fence # # reconfig_topology_complete # # # # Calls to: cl_fs2disk # # # # Arguments: filesystem(s) volume-group(s) # # # # Returns: 0 success # # 1 failure # # 2 bad argument # # # ######################################################################### ######################################################################### # # This is the function to take out the duplicates in a list and sort # ######################################################################### rdsort() { typeset PS4_FUNC="rdsort" [[ "$VERBOSE_LOGGING" = "high" ]] && set -x echo $*| sed -e 's/\ /\ /g' | sort -u } ######################################################################### # # Main Starts Here # ######################################################################### typeset PROGNAME=${0##*/} export PATH="$(/usr/es/sbin/cluster/utilities/cl_get_path all)" if [[ $VERBOSE_LOGGING == "high" ]]; then set -x version='%I%' fi STATUS=0 if [ $# -lt 2 -o $# -gt 3 ] then cl_echo 1046 "Usage: $PROGNAME filesystem_list volume-group_list\n" $PROGNAME exit 2 fi FS=$1 VG=$2 ENV_VG=$2 # # If filesystems are given, figure out associated VGs and PVIDs. # for fs in $FS do vg_list=$(cl_fs2disk -v $fs) # # Append to the previous VG list # VG="$VG $vg_list" pvid_list=$(cl_fs2disk -i $fs) # # Append to the previous PVID list. # PVID="$PVID $pvid_list" done # # If volume groups are given, figure out associated PVIDs. # for vg in $ENV_VG do pvid_list=$(cl_fs2disk -i -g $vg) # # Append to the previous PVID list. # PVID="$PVID $pvid_list" done # # Take out any duplicate items in PVID list, VG list, and FS list, # and sort these three lists. # if [ -n "$PVID" ] then PVID=$(rdsort $PVID) RC=$? : exit status of rdsort $PVID is: $RC if [ $RC -ne 0 ] then STATUS=1 fi fi echo $PVID exit $STATUS