Udiff ids_register.ksh
--- /workspace/neilga/ohacds-ids/webrev/usr/src/cmd/ha-services/gds-agents/ids/ids_register.ksh- Tue May 27 03:23:10 2008
+++ ids_register.ksh Tue May 27 03:16:22 2008
@@ -20,11 +20,11 @@
# CDDL HEADER END
#
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-#ident "@(#)ids_register.ksh 1.3 08/04/29 SMI"
+#ident "@(#)ids_register.ksh 1.4 08/05/27 SMI"
#
# DO NOT EDIT THIS FILE
IDSDIR=/opt/SUNWscids/
@@ -42,24 +42,21 @@
[ -z "${MYCONFIG}" ] && MYCONFIG=/opt/SUNWscids/util/ids_config
. ${MYCONFIG}
-for variable in RS RG USERID INFORMIXDIR ONCONFIG INFORMIXSERVER INFORMIXSQLHOSTS
+for variable in RS RG LH_RS HAS_RS USERID INFORMIXDIR ONCONFIG INFORMIXSERVER INFORMIXSQLHOSTS
do
if eval [ -z \$${variable} ]
then
- /usr/bin/printf "ids requires a value for ${variable}= within ${MYCONFIG}\n"
+ /usr/bin/printf "IDS requires a value for ${variable}= within ${MYCONFIG}\n"
rc=1
fi
done
[ "${rc}" -ne 0 ] && exit 1
-if [ -z ${RS_ZONE} ]
-then
-
/usr/cluster/bin/clrs create -g ${RG} -t SUNW.gds \
-p Start_command="/opt/SUNWscids/bin/control_ids \
-R '${RS}' -G '${RG}' -U '${USERID}' -D '${INFORMIXDIR}' -C '${ONCONFIG}' \
-S '${INFORMIXSERVER}' -H '${INFORMIXSQLHOSTS}' start ids " \
-p Stop_command="/opt/SUNWscids/bin/control_ids \
@@ -73,105 +70,8 @@
-S '${INFORMIXSERVER}' -H '${INFORMIXSQLHOSTS}' validate ids " \
-p Port_list=23/tcp -p Stop_signal=9 \
-y Resource_dependencies=${HAS_RS},${LH_RS} \
${RS}
-else
- # Process a failover zone registration
- #
- # 1. Validate ${START_TIMEOUT} and ${STOP_TIMEOUT}
- # 2. Get the failover zone's pfile and determine failover zone name
- # 3. Build a temporary sczsmf_config file
- # 4. zlogin to the failover zone execute ids_smf_register
- # - Creates the SMF manifest using parameter values
- # - Validate and import the SMF manifest into the SMF repository
- # 5. Register a SC sczsmf resource to enable/disable the SMF instance
+rc=$?
- RS_STATE=`/usr/cluster/bin/scha_resource_get -O status -R ${RS}`
- rc=$?
-
- if [ "${rc}" -eq 0 ]
- then
- /usr/bin/printf "Sun Cluster resource ${RS} already exists\n"
- /usr/bin/printf "Cleanup resource before retrying\n"
- exit 1
- fi
-
- if ! [ "${START_TIMEOUT}" -ge 0 ] 2> /dev/null
- then
- /usr/bin/printf "START_TIMEOUT value is not an integer\n"
- exit 1
- fi
-
- if ! [ "${STOP_TIMEOUT}" -ge 0 ] 2> /dev/null
- then
- /usr/bin/printf "STOP_TIMEOUT value is not an integer\n"
- exit 1
- fi
-
- ZONEPFILE=`/usr/cluster/bin/clrs show -p Start_command ${RS_ZONE} | /usr/bin/grep -w Start_command | \
- /usr/bin/awk '{ if ($7 == "-P") print $8 }'`
-
- if [ ! -d "${ZONEPFILE}" ]
- then
- /usr/bin/printf "Unable to retrieve zone parameter file directory\n"
- exit 1
- else
- ZONE=`/usr/bin/grep Zonename= ${ZONEPFILE}/sczbt_${RS_ZONE} | /usr/bin/awk -F= '{print $2}' | /usr/xpg4/bin/tr -d '"' `
- fi
-
- # VALIDATE RESOURCE
-
- if /usr/sbin/zlogin ${ZONE} "/opt/SUNWscids/bin/control_ids -R '${RS}' -G '${RG}' -U '${USERID}' -D '${INFORMIXDIR}' -C '${ONCONFIG}' -S '${INFORMIXSERVER}' -H '${INFORMIXSQLHOSTS}' validate ids "
- then
- /usr/bin/printf "Validation of ${RS} succeeded\n"
- else
- /usr/bin/printf "Validation of ${RS} failed\n"
- /usr/bin/printf "Check the syslog for ${ZONE}\n"
- exit 1
- fi
-
- SERVICE_TAG=svc:/application/sczone-agents:${RS}
-
- /usr/bin/cat > /var/tmp/${RS}_smf_config <<-EOF
-RS=${RS}
-RG=${RG}
-SCZBT_RS=${RS_ZONE}
-ZONE=${ZONE}
-SERVICE=${SERVICE_TAG}
-RECURSIVE=true
-STATE=true
-SERVICE_PROBE="/opt/SUNWscids/bin/control_ids probe ids ${SERVICE_TAG}"
-EOF
-
- TMP_WORK_CONFIG=/var/tmp/${RS}_tmp_work_config
- /usr/bin/cat ${MYCONFIG} | /usr/sbin/zlogin ${ZONE} /usr/bin/cat - \> ${TMP_WORK_CONFIG}
-
- # Remove an existing FMRI in the zone if it already exists
- ${IDSDIR}/util/ids_smf_remove -z ${ZONE} -f ${SERVICE_TAG} 2>/dev/null
-
- # Create and register the ${SERVICE_TAG}
- if /usr/sbin/zlogin ${ZONE} ${IDSDIR}/util/ids_smf_register ${TMP_WORK_CONFIG}
- then
- if /opt/SUNWsczone/sczsmf/util/sczsmf_register -f /var/tmp/${RS}_smf_config
- then
- /usr/bin/printf "Registration of ${RS} succeeded\n"
-
- if ! /usr/cluster/bin/clrs set -p Start_timeout=${START_TIMEOUT} ${RS}
- then
- /usr/bin/printf "clrs set -p Start_timeout=${START_TIMEOUT} ${RS} failed\n"
- exit 1
- fi
-
- if ! /usr/cluster/bin/clrs set -p Stop_timeout=${STOP_TIMEOUT} ${RS}
- then
- /usr/bin/printf "clrs set -p Stop_timeout=${STOP_TIMEOUT} ${RS} failed\n"
- exit 1
- fi
- else
- /usr/bin/printf "Registration of ${RS} failed\n"
- exit 1
- fi
- fi
-fi
-
-exit 0
+exit ${rc}