Cdiff functions.ksh
*** /workspace/tf84964/oscds-s9-zone/webrev/usr/src/cmd/ha-services/gds-agents/zone/sczbt/functions.ksh- Fri Apr 11 08:32:32 2008
--- functions.ksh Fri Apr 11 08:30:49 2008
*** 261,317 ****
"${Zonename}" "${ZONE_BRAND}"
rc_validate=1
fi
fi;;
! solaris8)
debug_message "Function: validate - Zonebrand configured as ${Zonebrand}"
if [ "`/usr/bin/uname -p`" != "sparc" ]; then
# SCMSGS
# @explanation
! # The solaris8 brand for
# zones is only
# supported on the
# sparc platform.
# @user_action
# Review the components
# configuration file and
# make sure the variable
# Zonebrand defines
! # "solaris8" only on a
# sparc system.
scds_syslog -p daemon.err \
-t $(syslog_tag) -m \
"Function: validate - Zonebrand for zone %s is configured as %s on a non-sparc system. It is only supported on sparc systems." \
"${Zonename}" "${Zonebrand}"
rc_validate=1
else
ZONE_BRAND=`${ZONECFG} -z ${Zonename} info | /bin/grep "^brand:" | /bin/awk '{print $2}'`
! if [ "${ZONE_BRAND}" = "solaris8" ]; then
debug_message "Function: validate - Zonebrand verified as being ${ZONE_BRAND}"
else
# SCMSGS
# @explanation
# Zonebrand is set to
! # "solaris8". But the
# Zone is not configured
# as brand type solaris8
# according to zonecfg
# info.
# @user_action
# Review the components
# configuration file and
# make sure the variable
# Zonebrand defines
! # "solaris8" only for a
# Zone that got really
# setup with brand type
! # "solaris8".
scds_syslog -p daemon.err \
-t $(syslog_tag) -m \
! "Function: validate - Zonebrand for zone %s is configured as solaris8, but the zone is configured as brand type %s." \
! "${Zonename}" "${ZONE_BRAND}"
rc_validate=1
fi
fi;;
*)
--- 261,323 ----
"${Zonename}" "${ZONE_BRAND}"
rc_validate=1
fi
fi;;
! solaris8|solaris9)
debug_message "Function: validate - Zonebrand configured as ${Zonebrand}"
if [ "`/usr/bin/uname -p`" != "sparc" ]; then
# SCMSGS
# @explanation
! # The solaris8 and
! # solaris9 brand for
# zones is only
# supported on the
# sparc platform.
# @user_action
# Review the components
# configuration file and
# make sure the variable
# Zonebrand defines
! # "solaris8" or
! # "solaris9" only on a
# sparc system.
scds_syslog -p daemon.err \
-t $(syslog_tag) -m \
"Function: validate - Zonebrand for zone %s is configured as %s on a non-sparc system. It is only supported on sparc systems." \
"${Zonename}" "${Zonebrand}"
rc_validate=1
else
ZONE_BRAND=`${ZONECFG} -z ${Zonename} info | /bin/grep "^brand:" | /bin/awk '{print $2}'`
! if [ "${ZONE_BRAND}" = "${Zonebrand}" ]; then
debug_message "Function: validate - Zonebrand verified as being ${ZONE_BRAND}"
else
# SCMSGS
# @explanation
# Zonebrand is set to
! # "solaris8" or
! # "solaris9". But the
# Zone is not configured
# as brand type solaris8
+ # or solaris9
# according to zonecfg
# info.
# @user_action
# Review the components
# configuration file and
# make sure the variable
# Zonebrand defines
! # "solaris8" or
! # "solaris9" only for a
# Zone that got really
# setup with brand type
! # "solaris8" or
! # "solaris9".
scds_syslog -p daemon.err \
-t $(syslog_tag) -m \
! "Function: validate - Zonebrand for zone %s is configured as %s, but the zone is configured as brand type %s." \
! "${Zonename}" "${Zonebrand}" "${ZONE_BRAND}"
rc_validate=1
fi
fi;;
*)
*** 326,336 ****
# sure the variable Zonebrand
# defines either "native", "lx"
# or "solaris8".
scds_syslog -p daemon.err \
-t $(syslog_tag) -m \
! "Function: validate - Zonebrand for zone %s is configured as %s. Valid values are native, lx and solaris8." \
"${Zonename}" "${Zonebrand}"
rc_validate=1;;
esac;;
Zonebootopt)
--- 332,342 ----
# sure the variable Zonebrand
# defines either "native", "lx"
# or "solaris8".
scds_syslog -p daemon.err \
-t $(syslog_tag) -m \
! "Function: validate - Zonebrand for zone %s is configured as %s. Valid values are native, lx, solaris8 and solaris9." \
"${Zonename}" "${Zonebrand}"
rc_validate=1;;
esac;;
Zonebootopt)
*** 398,410 ****
debug_message "Function: validate - LXrunlevel (${LXrunlevel}) set"
fi;;
SLrunlevel)
! # verify that SLrunlevel is setup if Zonebrand="solaris8"
! if [ -z "${SLrunlevel}" ] && [ "${Zonebrand}" = "solaris8" ]; then
# SCMSGS
# @explanation
# The SLrunlevel variable is not set in the
# parameter file sczbt_<resource name>.
# @user_action
--- 404,417 ----
debug_message "Function: validate - LXrunlevel (${LXrunlevel}) set"
fi;;
SLrunlevel)
! # verify that SLrunlevel is setup if Zonebrand is set
! # to "solaris8" or "solaris9"
! if [ -z "${SLrunlevel}" ] && [ "${Zonebrand}" = "solaris8" -o "${Zonebrand}" = "solaris9" ]; then
# SCMSGS
# @explanation
# The SLrunlevel variable is not set in the
# parameter file sczbt_<resource name>.
# @user_action
*** 609,619 ****
"Function: validate - LXrunlevel (%s) is invalid with Zonebootopt=%s, needs single-user" \
"${LXrunlevel}" "${Zonebootopt}"
rc_validate=1
fi;;
! solaris8)
if [ "${SLrunlevel}" != "S" ]
then
# SCMSGS
# @explanation
# The Zoneboot variable is set to -s. Every
--- 616,626 ----
"Function: validate - LXrunlevel (%s) is invalid with Zonebootopt=%s, needs single-user" \
"${LXrunlevel}" "${Zonebootopt}"
rc_validate=1
fi;;
! solaris8|solaris9)
if [ "${SLrunlevel}" != "S" ]
then
# SCMSGS
# @explanation
# The Zoneboot variable is set to -s. Every
*** 897,948 ****
#
debug_message "Function: start_sczbt - Begin"
${SET_DEBUG}
! # If the zone is of brand type "solaris8" and if the platform changed
! # from where the zone was previously started, the s8_p2v script needs
! # to get called prior boot to make sure that any platform specific
! # libraries are properly setup within the zone rootpath.
# The script needs to run only once per new platform. The file
! # .platform.orig stores the platform names for which the s8_p2v script
! # had already run. Only if a new platform gets introduced into the
! # cluster, the s8_p2v script gets called on that node again.
! if [ "${Zonebrand}" = "solaris8" ]; then
get_zonepath ${Zonename}
myplatform=`/bin/uname -i`
myplatformfile=${Zonepath}/root/.platform.orig
! need_s8_p2v=true
# if there is no .platform.orig file or if the current
# platform is not contained, s8_p2v needs to run
if [ -f ${myplatformfile} ]; then
if /usr/bin/grep "^${myplatform}$" ${myplatformfile} > /dev/null 2>&1
then
! need_s8_p2v=false
fi
fi
! if [ -x /usr/lib/brand/solaris8/s8_p2v -a "${need_s8_p2v}" = "true" ]; then
! /usr/lib/brand/solaris8/s8_p2v ${Zonename} >${LOGFILE} 2>&1
if [ $? -ne 0 ]; then
# SCMSGS
# @explanation
# Unable to perform platform specific
! # setup for the solaris8 zone.
# @user_action
# Disable the resource and manually run
! # the /usr/lib/brand/solaris8/s8_p2v
! # <zonename> command on the node where
! # the start failed. Correct any errors
! # reported, then restart the resource.
scds_syslog -p daemon.err -t $(syslog_tag) -m \
! "Function: start_sczbt - Running command /usr/lib/brand/solaris8/s8_p2v %s failed. Unable to start zone." \
! "${Zonename}"
rc_start_command=1
return 1
fi
# Only update the file if it is not a symbolic link.
--- 904,968 ----
#
debug_message "Function: start_sczbt - Begin"
${SET_DEBUG}
! # If the zone is of brand type "solaris8" or "solaris9" and if the
! # platform changed from where the zone was previously started,
! # the s8_p2v or s9_p2v script needs to get called prior boot to make
! # sure that any platform specific libraries are properly setup within
! # the zone rootpath.
# The script needs to run only once per new platform. The file
! # .platform.orig stores the platform names for which the s8_p2v or
! # s9_p2v script had already run. Only if a new platform gets introduced
! # into the cluster, the s8_p2v or s9_p2v script gets called on that
! # node again.
! if [ "${Zonebrand}" = "solaris8" -o "${Zonebrand}" = "solaris9" ]; then
+ case ${Zonebrand} in
+ solaris8)
+ P2V_SCRIPT=/usr/lib/brand/solaris8/s8_p2v
+ ;;
+ solaris9)
+ P2V_SCRIPT=/usr/lib/brand/solaris9/s9_p2v
+ ;;
+ esac
+
get_zonepath ${Zonename}
myplatform=`/bin/uname -i`
myplatformfile=${Zonepath}/root/.platform.orig
! need_p2v=true
# if there is no .platform.orig file or if the current
# platform is not contained, s8_p2v needs to run
if [ -f ${myplatformfile} ]; then
if /usr/bin/grep "^${myplatform}$" ${myplatformfile} > /dev/null 2>&1
then
! need_p2v=false
fi
fi
! if [ -x "${P2V_SCRIPT}" -a "${need_p2v}" = "true" ]; then
! ${P2V_SCRIPT} ${Zonename} >${LOGFILE} 2>&1
if [ $? -ne 0 ]; then
# SCMSGS
# @explanation
# Unable to perform platform specific
! # setup for the solaris8 or solaris9 zone.
# @user_action
# Disable the resource and manually run
! # '/usr/lib/brand/solaris8/s8_p2v
! # <zonename>' for solaris8 or
! # '/usr/lib/brand/solaris9/s9_p2v <zonename>'
! # for solaris9 on the node where the start
! # failed. Correct any errors reported, then
! # restart the resource.
scds_syslog -p daemon.err -t $(syslog_tag) -m \
! "Function: start_sczbt - Running command %s %s failed. Unable to start zone." \
! "${P2V_SCRIPT}" "${Zonename}"
rc_start_command=1
return 1
fi
# Only update the file if it is not a symbolic link.
*** 955,966 ****
# Only update the file if it is not a symbolic link.
# Otherwise it would be a security issue.
if [ ! -h ${Zonepath}/root/.host.orig ]; then
# This update is necessary to make sure the
! # solaris8 zone can get booted without manual
! # intervention.
/usr/bin/hostid > ${Zonepath}/root/.host.orig
fi
fi
# boot the zone
--- 975,986 ----
# Only update the file if it is not a symbolic link.
# Otherwise it would be a security issue.
if [ ! -h ${Zonepath}/root/.host.orig ]; then
# This update is necessary to make sure the
! # solaris8 or solaris9 zone can get booted without
! # manual intervention.
/usr/bin/hostid > ${Zonepath}/root/.host.orig
fi
fi
# boot the zone
*** 1123,1138 ****
done
fi
# bring down the zone
debug_message "Function: stop_sczbt - Shuting down non-global zone ${Zonename}"
! if [ "${Zonebrand}" = "native" -o "${Zonebrand}" = "solaris8" ]; then
${ZLOGIN} ${Zonename} /usr/sbin/shutdown -y -g0 -i0 >${LOGFILE} 2>&1
! else
! # we must be an "lx" brand
${ZLOGIN} ${Zonename} /sbin/shutdown -h now >${LOGFILE} 2>&1
! fi
#
# run a test loop to determine if the zone reached state "installed"
# or if the timeout for proper shutdown is exceeded
#
--- 1143,1160 ----
done
fi
# bring down the zone
debug_message "Function: stop_sczbt - Shuting down non-global zone ${Zonename}"
! case ${Zonebrand} in
! native|solaris8|solaris9)
${ZLOGIN} ${Zonename} /usr/sbin/shutdown -y -g0 -i0 >${LOGFILE} 2>&1
! ;;
! lx)
${ZLOGIN} ${Zonename} /sbin/shutdown -h now >${LOGFILE} 2>&1
! ;;
! esac
#
# run a test loop to determine if the zone reached state "installed"
# or if the timeout for proper shutdown is exceeded
#
*** 1300,1310 ****
rc_check_sczbt=100
debug_message "Function: check_sczbt - runlevel did not return successfully (return code ${rc_get_lx_state}) for the non-global zone {Zonename}"
return ${rc_check_sczbt}
fi;;
! solaris8)
if get_solaris_legacy_state ${Zonename}
then
if [ "${SOLARIS_LEGACY_STATE}" != "${SLrunlevel}" ]
then
rc_check_sczbt=100
--- 1322,1332 ----
rc_check_sczbt=100
debug_message "Function: check_sczbt - runlevel did not return successfully (return code ${rc_get_lx_state}) for the non-global zone {Zonename}"
return ${rc_check_sczbt}
fi;;
! solaris8|solaris9)
if get_solaris_legacy_state ${Zonename}
then
if [ "${SOLARIS_LEGACY_STATE}" != "${SLrunlevel}" ]
then
rc_check_sczbt=100
*** 1451,1461 ****
rc_check_sczbt=100
sleep 5
fi
done;;
! solaris8)
while [ ${SECONDS} -lt ${MAX_PROBE_TIMEOUT} ]
do
if get_solaris_legacy_state ${Zonename}
then
if [ "${SOLARIS_LEGACY_STATE}" != "${SLrunlevel}" ]
--- 1473,1483 ----
rc_check_sczbt=100
sleep 5
fi
done;;
! solaris8|solaris9)
while [ ${SECONDS} -lt ${MAX_PROBE_TIMEOUT} ]
do
if get_solaris_legacy_state ${Zonename}
then
if [ "${SOLARIS_LEGACY_STATE}" != "${SLrunlevel}" ]