#!/bin/ksh93 # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # 61haes_r714 src/43haes/usr/lpp/cluster/samples/appsvclabel/cl_execute_chipdev.sh 1.2 # # Licensed Materials - Property of IBM # # COPYRIGHT International Business Machines Corp. 2006 # 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 # @(#)09 1.2 src/43haes/usr/lpp/cluster/samples/appsvclabel/cl_execute_chipdev.sh, hacmp.utils, 61haes_r714 4/10/06 10:01:46 set -x ############################################################################### # # Name: clchipdev # # A sample script to help users configure their service IP label correctly # # Syntax: # cl_chdevip 'SVC_IP_Addr1=Boot_IP_Addr2 SVC_IP_Addr2= BOOT_IP_addr2...' # # # # Arguments: # # Returns: 0 on SUCCESS # 1 on FAILURE # ######################################################################################## NETWORK_NAME=$1 LIST_ADDR=($2) ALT_HW_ADDR=$3 ADAPTER="" #print $NETWORK_NAME $ALT_HW_ADD ${LIST_ADDR[@]} ; # get the network type NETWORK_TYPE=$(odmget -q"name='$NETWORK_NAME'" HACMPnetwork |grep -w alias |cut -d'"' -f2) #print $NETWORK_TYPE ; # get the network mask for alissed networks if [[ $NETWORK_TYPE == 1 ]] ; then NETWORK_MASK=$(odmget -q"name='$NETWORK_NAME'" HACMPnetwork |grep -w netmask |cut -d'"' -f2) fi # go through the list of the addresses and change the configuration for ADDR_CHANGE in ${LIST_ADDR[@]}; do BOOT_ADDR=${ADDR_CHANGE##*=} SVC_ADDR=${ADDR_CHANGE%%=*} #print $SVC_LABEL $BOOT_LABEL SVC_LABEL=$(/usr/es/sbin/cluster/utilities/clgetinterfaces -h|grep -w $SVC_ADDR|cut -d'#' -f3) ## get the boot label BOOT_LABEL=$(/usr/es/sbin/cluster/utilities/clgetinterfaces -h|grep -w $BOOT_ADDR|cut -d'#' -f3) ADAPTER=$(odmget -q"attribute='netaddr' AND value='$SVC_ADDR'" CuAt |grep -w name |cut -d'"' -f2) if [[ $ADAPTER != "" ]]; then #print " Interface is $adapter\n"; BOOT=$(odmget -q"network='$NETWORK_NAME' AND identifier='$SVC_ADDR'" HACMPadapter|grep -w function |cut -d'"' -f2) if [[ $BOOT == "boot" ]]; then echo "HACMPadapter:\n ip_label = \"$BOOT_LABEL\" \n function = \"boot\" \n identifier = \"$BOOT_ADDR\"" >tmpfile #echo "changing the adpter"; # change the CuAt odm /usr/sbin/chdev -l $ADAPTER -a netaddr=$BOOT_ADDR -P odmchange -o HACMPadapter -q"network='$NETWORK_NAME' AND ip_label='$SVC_LABEL'" tmpfile rm -f tmpfile if [[ $NETWORK_TYPE == 2 ]] ; then if [[ $ALT_HW_ADDR == "" ]]; then # create the service ip label with HHW address in HACMP /usr/es/sbin/cluster/utilities/claddnode -Tservice -B$SVC_LABEL -w$NETWORK_NAME else /usr/es/sbin/cluster/utilities/claddnode -Tservice -B$SVC_LABEL -w$NETWORK_NAME -d$ALT_HW_ADDR fi fi if [[ $NETWORK_TYPE == 1 ]] ; then # configure the boot adapter on the interface for aliased networks /usr/es/sbin/cluster/utilities/claddnode -Tservice -B$SVC_LABEL -w$NETWORK_NAME ifconfig $ADAPTER alias $BOOT_ADDR netmask $NETWORK_MASK fi fi else exit 1 fi done exit 0