# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#######################################################################
#
# This file contains system setup requirements for scm.
#
# directory with the following links:
#
#
# For Solaris 10 or later systems this script is run as part of SVC by
# svc.startd and should be located in /lib/svc/method
#
#USAGE="Usage: $0 { start | stop }
#
#######################################################################
DSCFG_DEPEND_NOCHK="/tmp/.dscfgadm_pid"
# Make sure prior SMF dependents are not 'online'
# $1 = name of SMF service to validate dependents
#
{
times=0
count=1
then
return 0
elif [ -f $DSCFG_DEPEND_NOCHK ]
then
do
then
return 0
fi
done
then
return 0
fi
do
then
# Output banner after waiting first 5 seconds
#
then
echo "Waiting for $1 dependents to be 'offline'"
fi
# Has it been longer then 5 minutes? (60 * 5 secs.)
#
then
echo "Error: Failed waiting for $1 dependents to be 'offline'"
exit $SMF_EXIT_ERR_FATAL
fi
# Now sleep, giving other services time to stop
#
sleep 5
fi
done
return 0
}
{
}
{
then
return
fi
if [ $? -ne 0 ] ; then
# If the disable failed that means we have pinned data.
echo "Cache Not Deconfigured"
fi
}
{
if [ $? -eq 0 ] ; then
# make sure that all data services are unloaded before stopping
# nskernd - cannot stop nskernd when its threads could be in use
# Note: sv is unloadable, but its threadset is shutdown in the
# final close(9e) call.
stop=1
continue # not loaded
fi
if [ $? -ne 0 ] ; then
stop=0
break
fi
done
# kill nskernd if we can
kill -15 $pid
fi
fi
fi
if [ -r /dev/ncall -a -x $ESMSCMLIB/ncalladm ]
then
fi
}
{
kill -15 $pid
fi
}
{
}
{
if [ -x $ESMSCMLIB/ncalladm ]
then
fi
if [ $? -ne 0 ] ; then
if [ $? -ne 0 ] ; then
echo "Error: Unable to start nskernd"
exit $SMF_EXIT_ERR_FATAL
fi
fi
}
{
if [ $? -ne 0 ]
then
rm -f /var/tmp/.cfglockd.pid
else
# dscfglockd already running
return
fi
if ${CLINFO}
then
#
# create or update the dscfg_lockdb file
#
# create clean tmpnodelist
then
# get valid names in cluster
if [ ! -f $DSCFG_LOCKDB ]
then
printf "In clustered environment.\n"
printf "creating per node dscfg_lockdb database"
printf " with following nodenames:\n"
else
# check if there are any changes
if [ $? != 0 ]
then
printf "The cluster node names have "
printf "changed. Updating dscfg_lockdb "
printf "database.\n"
printf "Previous node names:\n"
printf "New node names:\n"
rm -f $DSCFG_LOCKDB
fi
fi
else
# we're in a cluster, but scstat is not available
printf "In clustered environment.\n"
printf "Required configuration file, $DSCFG_LOCKDB\n"
printf "was not properly populated with the cluster "
printf "nodenames.\nThis file needs to be manually"
printf "updated with the cluster\nnodenames before "
printf "reboot. Refer to Sun Storage Availability\n"
printf "Suite Installation Guide for details.\n"
fi
# clustered start of dscfglockd
if [ -f $DSCFG_LOCKDB ]
then
printf "Starting dscfglockd\n"
${SCMLIB}/dscfglockd -f $DSCFG_LOCKDB
else
printf "WARNING: Mis-Configuration of Availability "
printf "Suite for Sun Cluster\n"
printf "WARNING: Can't find configuration file for "
printf "dscfglockd\n"
fi
fi
}
{
}
{
# do nothing if we do not have a dscfg
if [ ! -f /etc/dscfg_local ]
then
echo "Cannot find Availability Suite configuration location"
exit $SMF_EXIT_ERR_NOSMF
fi
#
# Ordering:
# dscfglockd -- locking must be present before any dscfg access
# nskernd -- starts infrastructure (nskernd, ncall).
# sdbc -- start the cache itself
#
}
{
echo "Usage: $0"
echo " start"
echo " stop"
exit 1
}
USED=0
case $# in
'0')
;;
'1')
ACTION=$1
USED=1
;;
'2')
ACTION=$1
CLUSTERTAG="$2"
USED=1
exit 0
;;
'*')
;;
esac
if [ $USED = 0 ] ; then
fi
if [ $ACTION = "start" ] ; then
elif [ $ACTION = "stop" ] ; then
else
fi
exit $SMF_EXIT_OK