#
#
# 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
#
#
#
#
typeset -r OVS_CLEAN=ovs-clean.py
echo $1 >&2
}
if [[ ! -d ${OVS_TMP_DIR} ]]; then
${PFEXEC} ${MKDIR} -m 775 ${OVS_TMP_DIR} || exit $SMF_EXIT_ERR_CONFIG
${PFEXEC} ${CHOWN} ${OVS_USER}:${OVS_GROUP} ${OVS_TMP_DIR}
fi
}
typeset -i OVSDB_INIT=0
typeset -r OVSDB_DATABASE=${OVS_VARLIB_DIR}/etc/conf.db
if [[ ! -f ${OVSDB_DATABASE} ]]; then
typeset -r OVSDB_SCHEMA=${OVS_USRLIB_DIR}/share/vswitch.ovsschema
echo "Creating ${OVSDB_DATABASE} from ${OVSDB_SCHEMA}"
${OVSDB_TOOL} create ${OVSDB_DATABASE} ${OVSDB_SCHEMA}
if [ $? -ne 0 ]; then
errlog "Error creating database, exiting"
return 1
fi
fi
typeset -r OVSDB_LOGFILE=${OVS_LOG_DIR}/ovsdb-server.log
typeset -r OVSDB_PIDFILE=${OVS_TMP_DIR}/ovsdb-server.pid
${OVSDB_SERVER_PATH} ${OVSDB_DATABASE} \
--remote=punix:${OVSDB_REMOTE} \
--no-chdir --log-file=${OVSDB_LOGFILE} \
--pidfile=${OVSDB_PIDFILE} \
--detach
if [ $? -ne 0 ]; then
errlog "${OVSDB_SERVER_PATH} failed with $?"
exit $SMF_EXIT_ERR_FATAL
fi
if [ ${OVSDB_INIT} -ne 0 ]; then
echo "Initializing OVSDB database"
if [ $? -ne 0 ]; then
errlog "${OVSDB_VSCTL} failed with $?"
exit $SMF_EXIT_ERR_FATAL
fi
fi
}
typeset BRIDGENAME
SVC_METHOD=$1
while read BRIDGENAME; do
${OVS_CLEAN_PATH} delete-vnic ${BRIDGENAME} >/dev/null 2>&1
errlog "Error $? removing ${BRIDGENAME} VNIC"
fi
done
if [ $? -ne 0 ]; then
errlog "Error $? resetting OF ports"
fi
if [ $? -ne 0 ]; then
errlog "Error $? removing OF flows"
fi
if [ $? -ne 0 ]; then
errlog "Error $? deleting the OVS etherstub"
fi
}
typeset BRIDGENAME
errlog "pkill of ${OVS_VSWITCHD} failed with $?"
fi
clean_vswitch stop
}
typeset -r VSWITCHD_LOGFILE=${OVS_LOG_DIR}/ovs-vswitchd.log
typeset -r VSWITCHD_PIDFILE=${OVS_TMP_DIR}/ovs-vswitchd.pid
${PFEXEC} ${OVS_VSWITCHD_PATH} unix:${OVSDB_REMOTE} \
--log-file=${VSWITCHD_LOGFILE} \
--pidfile=${VSWITCHD_PIDFILE} \
--detach
if [ $? -ne 0 ]; then
errlog "${OVS_VSWITCHD} failed with $?"
exit $SMF_EXIT_ERR_FATAL
fi
while read BRIDGENAME; do
done
}
case "$1" in
'start')
"${OVS_OVSDB_FMRI}")
;;
"${OVS_VSWITCHD_FMRI}")
;;
*)
echo "$SMF_FMRI does not support start method"
exit $SMF_EXIT_ERR_FATAL
;;
esac
;;
'stop')
"${OVS_VSWITCHD_FMRI}")
;;
*)
echo "$SMF_FMRI does not support stop method"
exit $SMF_EXIT_ERR_FATAL
;;
esac
;;
*)
echo "Service must be invoked from within SMF"
exit $SMF_EXIT_ERR_FATAL
;;
esac
exit $SMF_EXIT_OK