#!/bin/ksh93 # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # 61haes_r714 src/43haes/lib/ksh93/db2/vg/KLIB_DB2_VG_get_state.sh 1.4 # # Licensed Materials - Property of IBM # # Restricted Materials of IBM # # COPYRIGHT International Business Machines Corp. 2005,2011 # 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 # @(#)79 1.4 src/43haes/lib/ksh93/db2/vg/KLIB_DB2_VG_get_state.sh, hacmp, 61haes_r714 11/28/11 15:00:50 # #=head1 NAME # # KLIB_DB2_VG_get_state - Get the volume group state, active or inactive # #=head1 SYNOPSIS # # . /usr/es/sbin/cluster/sa/db2/etc/db2.disc # state=$(KLIB_DB2_VG_get_state "nodeA" "vg1") # #=head1 DESCRIPTION # # Obtain the state of a volume group for a particular cluster node # and volume group using the discovery information gathered during # DB2 discovery. # # This function assumes the discovery information has already been # sourced into the local environment prior to invoking this function. # #=head1 ARGUMENTS # # 1: [scalar] node name of where to get state # 2: [scalar] name of the volume group # #=head1 RETURN # # 0 if the volume group state is obtained, active or inactive is # reported for the VG # 1 if the volume group state does not exist (nonexistant is reported) # #=head1 COPYRIGHT # #(C) COPYRIGHT International Business Machines Corp. 2005 #All Rights Reserved # #=cut # function KLIB_DB2_VG_get_state { . /usr/es/lib/ksh93/func_include node=$1 vg=$2 if [[ -z ${AIX_DISKS[PVIDS_"$node"_"$vg"]} ]]; then echo "nonexistant" return 1 fi state=${AIX_DISKS[STATE_"$node"_"$vg"]} if [[ -z $state ]]; then echo "inactive" else echo $state fi return 0 }