configure.ac | 11 +- opensaf.spec.in | 18 +- osaf/libs/core/mds/mds_main.c | 43 +- osaf/services/infrastructure/dtms/dtm/dtm_main.c | 6 +- osaf/services/infrastructure/dtms/scripts/Makefile.am | 3 +- osaf/services/infrastructure/dtms/scripts/dh_monitoring.in | 28 - osaf/services/infrastructure/dtms/scripts/osaf-dtm.in | 7 +- osaf/services/infrastructure/dtms/scripts/osaf-transport-monitor.in | 87 +++ osaf/services/infrastructure/dtms/scripts/osaf-transport.in | 173 +++++++ osaf/services/infrastructure/nid/config/Makefile.am | 5 - osaf/services/infrastructure/nid/config/nid.conf | 10 +- osaf/services/infrastructure/nid/config/nodeinit.conf.controller | 3 +- osaf/services/infrastructure/nid/config/nodeinit.conf.payload | 3 +- osaf/services/infrastructure/nid/scripts/Makefile.am | 2 +- osaf/services/infrastructure/nid/scripts/configure_tipc.in | 211 +++++++++ osaf/services/infrastructure/nid/scripts/nid_tipc.in | 225 ---------- osaf/services/infrastructure/nid/scripts/opensafd.in | 30 +- 17 files changed, 527 insertions(+), 338 deletions(-)
diff --git a/configure.ac b/configure.ac --- a/configure.ac +++ b/configure.ac @@ -229,10 +229,10 @@ AC_SUBST([AM4J_ENABLED], ["$enable_am4j" # AC_MSG_CHECKING([whether to use TIPC as the transport]) AC_ARG_ENABLE([tipc], - [AS_HELP_STRING([--disable-tipc], - [disable building the TIPC [default=no]])], + [AS_HELP_STRING([--enable-tipc], + [enable building the TIPC [default=no]])], [], - [enable_tipc=yes]) + [enable_tipc=no]) AC_MSG_RESULT([$enable_tipc]) if test "$enable_tipc" = yes; then @@ -757,7 +757,8 @@ AC_CONFIG_FILES([ osaf/services/infrastructure/dtms/dtm/Makefile osaf/services/infrastructure/dtms/scripts/Makefile osaf/services/infrastructure/dtms/scripts/osaf-dtm - osaf/services/infrastructure/dtms/scripts/dh_monitoring + osaf/services/infrastructure/dtms/scripts/osaf-transport + osaf/services/infrastructure/dtms/scripts/osaf-transport-monitor osaf/services/infrastructure/dtms/config/Makefile osaf/services/infrastructure/dtms/include/Makefile osaf/services/infrastructure/fm/Makefile @@ -768,7 +769,7 @@ AC_CONFIG_FILES([ osaf/services/infrastructure/nid/Makefile osaf/services/infrastructure/nid/config/Makefile osaf/services/infrastructure/nid/scripts/Makefile - osaf/services/infrastructure/nid/scripts/nid_tipc + osaf/services/infrastructure/nid/scripts/configure_tipc osaf/services/infrastructure/nid/scripts/opensafd osaf/services/infrastructure/rde/Makefile osaf/services/infrastructure/rde/include/Makefile diff --git a/opensaf.spec.in b/opensaf.spec.in --- a/opensaf.spec.in +++ b/opensaf.spec.in @@ -14,7 +14,6 @@ %define is_ais_lck %(test "@AIS_LCK_ENABLED@" = "yes" && echo 1 || echo 0) %define is_ais_msg %(test "@AIS_MSG_ENABLED@" = "yes" && echo 1 || echo 0) %define is_ais_smf %(test "@AIS_SMF_ENABLED@" = "yes" && echo 1 || echo 0) -%define is_tipc_trans %(test "@TIPC_TRANSPORT_ENABLED@" = "yes" && echo 1 || echo 0) %define _pkglibdir %{_libdir}/%{name} %define _pkgsysconfdir %{_sysconfdir}/%{name} @@ -850,10 +849,6 @@ sed -i '/isHpiSupported/{N;s|<value>0</v sed -i '/plmd/d' %{_pkgsysconfdir}/nodeinit.conf.controller %endif -%if !%is_tipc_trans -sed -i '/TIPC/d' %{_pkgsysconfdir}/nodeinit.conf.controller -sed -i 's/MDS_TRANSPORT=TIPC/MDS_TRANSPORT=TCP/g' %{_pkgsysconfdir}/nid.conf -%endif # $1 == 1 (install), $1 == 2 (upgrade) if [ $1 = 1 ] || [ $1 = 2 ]; then @@ -869,10 +864,6 @@ fi %postun controller -p /sbin/ldconfig %post payload -%if !%is_tipc_trans -sed -i '/TIPC/d' %{_pkgsysconfdir}/nodeinit.conf.payload -sed -i 's/MDS_TRANSPORT=TIPC/MDS_TRANSPORT=TCP/g' %{_pkgsysconfdir}/nid.conf -%endif # $1 == 1 (install), $1 == 2 (upgrade) if [ $1 = 1 ] || [ $1 = 2 ]; then @@ -907,7 +898,7 @@ fi %config %{_initddir}/opensafd %{_pkglibdir}/opensafd %{_pkglibdir}/opensaf_reboot -%{_pkglibdir}/nid_tipc +%{_pkglibdir}/configure_tipc %files amf-libs @@ -1337,7 +1328,8 @@ fi %{_pkgclcclidir}/osaf-fmd %{_pkglibdir}/osafdtmd %{_pkgclcclidir}/osaf-dtm -%{_pkgclcclidir}/dh_monitoring +%{_pkgclcclidir}/osaf-transport +%{_pkgclcclidir}/osaf-transport-monitor %{_bindir}/rdegetrole %if %is_immxml %{_pkgimmxml_svcdir}/common_pl_template.xml @@ -1356,8 +1348,8 @@ fi %config(noreplace) %{_pkgsysconfdir}/dtmd.conf %{_pkglibdir}/osafdtmd %{_pkgclcclidir}/osaf-dtm -%{_pkgclcclidir}/dh_monitoring - +%{_pkgclcclidir}/osaf-transport +%{_pkgclcclidir}/osaf-transport-monitor %files libs %defattr(-,root,root) diff --git a/osaf/libs/core/mds/mds_main.c b/osaf/libs/core/mds/mds_main.c --- a/osaf/libs/core/mds/mds_main.c +++ b/osaf/libs/core/mds/mds_main.c @@ -43,12 +43,12 @@ #include "mds_dt_tcp_trans.h" #include <netdb.h> #include <config.h> +#include "osaf_utility.h" #ifdef ENABLE_TIPC_TRANSPORT #include "mds_dt_tipc.h" -#endif -#include "osaf_utility.h" #include <configmake.h> #define MDS_MDTM_CONNECT_PATH PKGLOCALSTATEDIR "/osaf_dtm_intra_server" +#endif extern uint32_t mds_socket_domain; void mds_init_transport(void); @@ -362,6 +362,7 @@ uint32_t mds_lib_req(NCS_LIB_REQ_INFO *r void mds_init_transport(void) { +#ifdef ENABLE_TIPC_TRANSPORT char *tipc_or_tcp = NULL; int rc; struct stat sockStat; @@ -372,8 +373,26 @@ void mds_init_transport(void) else tipc_or_tcp = "TIPC"; + if (strcmp(tipc_or_tcp, "TIPC") == 0) { + mds_mdtm_init = mdtm_tipc_init; + mds_mdtm_destroy = mdtm_tipc_destroy; + mds_mdtm_svc_subscribe = mds_mdtm_svc_subscribe_tipc; + mds_mdtm_svc_unsubscribe = mds_mdtm_svc_unsubscribe_tipc; + mds_mdtm_svc_install = mds_mdtm_svc_install_tipc; + mds_mdtm_svc_uninstall = mds_mdtm_svc_uninstall_tipc; + mds_mdtm_vdest_install = mds_mdtm_vdest_install_tipc; + mds_mdtm_vdest_uninstall = mds_mdtm_vdest_uninstall_tipc; + mds_mdtm_vdest_subscribe = mds_mdtm_vdest_subscribe_tipc; + mds_mdtm_vdest_unsubscribe = mds_mdtm_vdest_unsubscribe_tipc; + mds_mdtm_tx_hdl_register = mds_mdtm_tx_hdl_register_tipc; + mds_mdtm_tx_hdl_unregister = mds_mdtm_tx_hdl_unregister_tipc; + mds_mdtm_send = mds_mdtm_send_tipc; + mds_mdtm_node_subscribe = mds_mdtm_node_subscribe_tipc; + mds_mdtm_node_unsubscribe = mds_mdtm_node_unsubscribe_tipc; + return; - if (strcmp(tipc_or_tcp, "TCP") == 0) { + } else { +#endif mds_mdtm_init = mds_mdtm_init_tcp; mds_mdtm_destroy = mds_mdtm_destroy_tcp; mds_mdtm_svc_subscribe = mds_mdtm_svc_subscribe_tcp; @@ -394,25 +413,9 @@ void mds_init_transport(void) mds_socket_domain = AF_UNIX; return; - } #ifdef ENABLE_TIPC_TRANSPORT - mds_mdtm_init = mdtm_tipc_init; - mds_mdtm_destroy = mdtm_tipc_destroy; - mds_mdtm_svc_subscribe = mds_mdtm_svc_subscribe_tipc; - mds_mdtm_svc_unsubscribe = mds_mdtm_svc_unsubscribe_tipc; - mds_mdtm_svc_install = mds_mdtm_svc_install_tipc; - mds_mdtm_svc_uninstall = mds_mdtm_svc_uninstall_tipc; - mds_mdtm_vdest_install = mds_mdtm_vdest_install_tipc; - mds_mdtm_vdest_uninstall = mds_mdtm_vdest_uninstall_tipc; - mds_mdtm_vdest_subscribe = mds_mdtm_vdest_subscribe_tipc; - mds_mdtm_vdest_unsubscribe = mds_mdtm_vdest_unsubscribe_tipc; - mds_mdtm_tx_hdl_register = mds_mdtm_tx_hdl_register_tipc; - mds_mdtm_tx_hdl_unregister = mds_mdtm_tx_hdl_unregister_tipc; - mds_mdtm_send = mds_mdtm_send_tipc; - mds_mdtm_node_subscribe = mds_mdtm_node_subscribe_tipc; - mds_mdtm_node_unsubscribe = mds_mdtm_node_unsubscribe_tipc; - return; + } #endif /* Should never come here */ abort(); diff --git a/osaf/services/infrastructure/dtms/dtm/dtm_main.c b/osaf/services/infrastructure/dtms/dtm/dtm_main.c --- a/osaf/services/infrastructure/dtms/dtm/dtm_main.c +++ b/osaf/services/infrastructure/dtms/dtm/dtm_main.c @@ -328,9 +328,9 @@ int main(int argc, char *argv[]) goto done1; } - rc = nid_notify("DTM", NCSCC_RC_SUCCESS, NULL); + rc = nid_notify("TRANSPORT", NCSCC_RC_SUCCESS, NULL); if (NCSCC_RC_SUCCESS != rc) { - LOG_ER("DTM: nid_notify failed rc : %d ", rc); + LOG_ER("TRANSPORT: nid_notify failed rc : %d ", rc); goto done1; } dis_time_out_usec = (dtms_cb->initial_dis_timeout * 1000000); @@ -393,7 +393,7 @@ int main(int argc, char *argv[]) done3: TRACE_LEAVE(); - (void)nid_notify("DTM", NCSCC_RC_FAILURE, NULL); + (void)nid_notify("TRANSPORT", NCSCC_RC_FAILURE, NULL); exit(1); } diff --git a/osaf/services/infrastructure/dtms/scripts/Makefile.am b/osaf/services/infrastructure/dtms/scripts/Makefile.am --- a/osaf/services/infrastructure/dtms/scripts/Makefile.am +++ b/osaf/services/infrastructure/dtms/scripts/Makefile.am @@ -20,4 +20,5 @@ MAINTAINERCLEANFILES = Makefile.in nodist_pkgclccli_SCRIPTS = \ $(top_builddir)/osaf/services/infrastructure/dtms/scripts/osaf-dtm \ - $(top_builddir)/osaf/services/infrastructure/dtms/scripts/dh_monitoring + $(top_builddir)/osaf/services/infrastructure/dtms/scripts/osaf-transport \ + $(top_builddir)/osaf/services/infrastructure/dtms/scripts/osaf-transport-monitor diff --git a/osaf/services/infrastructure/dtms/scripts/dh_monitoring.in b/osaf/services/infrastructure/dtms/scripts/dh_monitoring.in deleted file mode 100644 --- a/osaf/services/infrastructure/dtms/scripts/dh_monitoring.in +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh - -osafdirfile=@sysconfdir@/@PACKAGE_NAME@/osafdir.conf -prog="osafdtmd" - -# Source LSB functions library -. /lib/lsb/init-functions - - -if [ ! -r $osafdirfile ]; then - logger -s -t $prog "can't read $osafdirfile, exiting." - exit 6 -else - . $osafdirfile -fi - -pidval=`cat $pkgpiddir/$prog.pid` -while true -do - if ! test -d /proc/$pidval ; then - logger -s -t $prog "$prog Process down, Rebooting the node" - $pkglibdir/opensaf_reboot 0 - exit 0 - fi - sleep 1 -done - - diff --git a/osaf/services/infrastructure/dtms/scripts/osaf-dtm.in b/osaf/services/infrastructure/dtms/scripts/osaf-dtm.in --- a/osaf/services/infrastructure/dtms/scripts/osaf-dtm.in +++ b/osaf/services/infrastructure/dtms/scripts/osaf-dtm.in @@ -34,14 +34,11 @@ pidfile=$pkgpiddir/$prog.pid lockfile=$lockdir/$initscript RETVAL=0 -NID_SVC_NAME=DTM start() { export LD_LIBRARY_PATH=$pkglibdir:$LD_LIBRARY_PATH - [ -p $NIDFIFO ] || exit 1 if ! [ -x $binary ] ; then - echo "$NID_MAGIC:$NID_SVC_NAME:$DAEMON_NOT_FND" > $NIDFIFO - exit 5 + return 5 fi echo -n "Starting $prog: " @@ -50,10 +47,8 @@ start() { if [ $RETVAL -eq 0 ]; then touch $lockfile log_success_msg - $pkgclcclidir/dh_monitoring & > /dev/null else log_failure_msg - echo "$NID_MAGIC:$NID_SVC_NAME:$DAEMON_START_FAILED" > $NIDFIFO fi return $RETVAL } diff --git a/osaf/services/infrastructure/dtms/scripts/osaf-transport-monitor.in b/osaf/services/infrastructure/dtms/scripts/osaf-transport-monitor.in new file mode 100644 --- /dev/null +++ b/osaf/services/infrastructure/dtms/scripts/osaf-transport-monitor.in @@ -0,0 +1,87 @@ +#!/bin/sh +# +### BEGIN INIT INFO +# Provides: osafdtmd +# Required-Start: $local_fs $remote_fs $network $syslog +# Required-Stop: $local_fs $remote_fs $network $syslog +# Should-Start: +# Should-Stop: +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: starts/stops the osafdtmd daemon +# Description: starts/stops the osafdtmd daemon +### END INIT INFO + +osafdirfile=/etc/opensaf/osafdir.conf + +# Source LSB functions library +. /lib/lsb/init-functions + +if [ ! -r $osafdirfile ]; then + logger -t $prog "can't read $osafdirfile, exiting." + exit 6 +else + . $osafdirfile + . $pkgsysconfdir/nid.conf +fi + +if [ ! "$MDS_TRANSPORT" = "TIPC" ] ; then + prog="osafdtmd" +fi + +RETVAL=0 + +start() { + echo "Running Permanent loop to clean MDS Logs..." + while true + do + MDS_LOG_FILE=$pkglogdir/mds.log + FILESIZE=`du -sk "$MDS_LOG_FILE" 2>/dev/null | cut -f1` + if [ 5000 -lt 0$FILESIZE ]; then + rm -f "$MDS_LOG_FILE.old" + mv -f "$MDS_LOG_FILE" "$MDS_LOG_FILE.old" + fi + + if [ ! "$MDS_TRANSPORT" = "TIPC" ] ; then + COUNT=0 + while ((COUNT < 15)) + do + pidval=`cat $pkgpiddir/$prog.pid` + if ! test -d /proc/$pidval ; then + logger -s -t $prog "$prog Process down, Rebooting the node" + $pkglibdir/opensaf_reboot 0 + exit 0; + fi + #logger "osafdtmd PID : $pidval monitor COUNT = $COUNT" + sleep 1 + ((COUNT=COUNT+1)) + done + else + sleep 15 + fi + done +} + +stop() { + if [ ! "$MDS_TRANSPORT" = "TIPC" ]; then + exit 0; + fi + RETVAL=$? + return $RETVAL +} + +case "$1" in + start) + start + RETVAL=$? + ;; + stop) + stop + RETVAL=$? + ;; + *) + echo "Usage: $0 {start|stop}" + RETVAL=2 +esac + +exit $RETVAL diff --git a/osaf/services/infrastructure/dtms/scripts/osaf-transport.in b/osaf/services/infrastructure/dtms/scripts/osaf-transport.in new file mode 100644 --- /dev/null +++ b/osaf/services/infrastructure/dtms/scripts/osaf-transport.in @@ -0,0 +1,173 @@ +#!/bin/sh +# +### BEGIN INIT INFO +# Provides: osafdtmd +# Required-Start: $local_fs $remote_fs $network $syslog +# Required-Stop: $local_fs $remote_fs $network $syslog +# Should-Start: +# Should-Stop: +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: starts/stops the osafdtmd daemon +# Description: starts/stops the osafdtmd daemon +### END INIT INFO + +osafdirfile=/etc/opensaf/osafdir.conf + +# Source LSB functions library +. /lib/lsb/init-functions + +if [ ! -r $osafdirfile ]; then + logger -t $prog "can't read $osafdirfile, exiting." + exit 6 +else + . $osafdirfile + . $pkgsysconfdir/nid.conf +fi + +NIDSERV=TRANSPORT +MANAGE_TIPC=${OPENSAF_MANAGE_TIPC:="yes"} +RETVAL=0 + +if [ ! "$MDS_TRANSPORT" = "TIPC" ] ; then + prog="osafdtmd" +fi + +start() { + [ -p $NIDFIFO ] || return 1 + if [ "$MDS_TRANSPORT" = "TIPC" ]; then + if [ $MANAGE_TIPC = "yes" ]; then + $pkglibdir/configure_tipc start $TIPC_ETH_IF $TIPC_NET_ID + RETVAL=$? + if [ $RETVAL -ne 0 ]; then + echo "$NID_MAGIC:$NIDSERV:$DAEMON_START_FAILED" > $NIDFIFO + return $RETVAL + fi + else + lsmod | grep tipc + RETVAL=$? + if [ $RETVAL -ne 0 ]; then + logger -t osaf-transport -s "TIPC module not loaded to OpenSAF requirements, returning..." + echo "$NID_MAGIC:$NIDSERV:$DAEMON_START_FAILED" > $NIDFIFO + return $RETVAL + else + ls $pkglocalstatedir/node_id + RETVAL=$? + if [ $RETVAL -ne 0 ]; then + logger -t osaf-transport -s "$pkglocalstatedir/node_id not available whic is OpenSAF requirements, returning..." + echo "$NID_MAGIC:$NIDSERV:$DAEMON_START_FAILED" > $NIDFIFO + return $RETVAL + fi + fi + fi + + RETVAL=0 + echo "$NID_MAGIC:$NIDSERV:$DAEMON_STARTED" > $NIDFIFO + + $pkgclcclidir/osaf-transport-monitor start & + RETVAL=$? + if [ $RETVAL -ne 0 ]; then + echo "Unable to start running Permanent loop to clean MDS Logs..." + fi + + else + $pkgclcclidir/osaf-dtm start + RETVAL=$? + if [ $RETVAL -ne 0 ]; then + echo "$NID_MAGIC:$NIDSERV:$DAEMON_START_FAILED" > $NIDFIFO + fi + #Fot TCP osaf-transport-monitor start will be moved to osaf-dtm process to make this script restart on fault + $pkgclcclidir/osaf-transport-monitor start & + RETVAL=$? + if [ $RETVAL -ne 0 ]; then + echo "Unable to start running Permanent loop to clean MDS Logs..." + fi + fi + +} + +stop() { + if [ ! "$MDS_TRANSPORT" = "TIPC" ]; then + $pkgclcclidir/osaf-dtm stop + fi + RETVAL=$? + return $RETVAL +} + +restart() { + if [ ! "$MDS_TRANSPORT" = "TIPC" ]; then + $pkgclcclidir/osaf-dtm stop + $pkgclcclidir/osaf-dtm start + fi + RETVAL=$? + return $RETVAL +} + +tryrestart() { + if [ ! "$MDS_TRANSPORT" = "TIPC" ]; then + $pkgclcclidir/osaf-dtm tryrestart + fi + RETVAL=$? + return $RETVAL +} + +reload() { + if [ ! "$MDS_TRANSPORT" = "TIPC" ]; then + $pkgclcclidir/osaf-dtm reload + fi + RETVAL=$? + return $RETVAL +} + +forcereload() { + if [ ! "$MDS_TRANSPORT" = "TIPC" ]; then + $pkgclcclidir/osaf-dtm reload + $pkgclcclidir/osaf-dtm restart + fi + RETVAL=$? + return $RETVAL +} + +status() { + if [ ! "$MDS_TRANSPORT" = "TIPC" ]; then + $pkgclcclidir/osaf-dtm status + fi + RETVAL=$? + return $RETVAL +} + +case "$1" in + start) + start + RETVAL=$? + ;; + stop) + stop + RETVAL=$? + ;; + restart) + restart + RETVAL=$? + ;; + try-restart|condrestart) + tryrestart + RETVAL=$? + ;; + reload) + reload + RETVAL=$? + ;; + force-reload) + forcereload + RETVAL=$? + ;; + status) + status + RETVAL=$? + ;; + *) + echo "Usage: $0 {start|stop|restart|try-restart|reload|force-reload|status}" + RETVAL=2 +esac + +exit $RETVAL diff --git a/osaf/services/infrastructure/nid/config/Makefile.am b/osaf/services/infrastructure/nid/config/Makefile.am --- a/osaf/services/infrastructure/nid/config/Makefile.am +++ b/osaf/services/infrastructure/nid/config/Makefile.am @@ -34,8 +34,3 @@ install-data-hook: set-default-node-conf if !ENABLE_AIS_PLM sed -i '/plmd/d' $(DESTDIR)$(pkgsysconfdir)/nodeinit.conf.controller endif -if !ENABLE_TIPC_TRANSPORT - sed -i '/TIPC/d' $(DESTDIR)$(pkgsysconfdir)/nodeinit.conf.controller - sed -i '/TIPC/d' $(DESTDIR)$(pkgsysconfdir)/nodeinit.conf.payload - sed -i 's/MDS_TRANSPORT=TIPC/MDS_TRANSPORT=TCP/g' $(DESTDIR)$(pkgsysconfdir)/nid.conf -endif diff --git a/osaf/services/infrastructure/nid/config/nid.conf b/osaf/services/infrastructure/nid/config/nid.conf --- a/osaf/services/infrastructure/nid/config/nid.conf +++ b/osaf/services/infrastructure/nid/config/nid.conf @@ -14,12 +14,20 @@ DAEMON_NOT_FND=$DAEMON_START_FAILED REBOOT_ON_FAIL_TIMEOUT=0 # MDS transport protocol, values supported are TIPC or TCP -export MDS_TRANSPORT=TIPC +export MDS_TRANSPORT=TCP # This is valid when above MDS_TRANSPORT is set to TIPC # Should OpenSAF manage (load kernel module and initialize) TIPC or not OPENSAF_MANAGE_TIPC="yes" +# This is valid when above MDS_TRANSPORT is set to TIPC and OPENSAF_MANAGE_TIPC is set to "yes" , +# values supported is the network interface name, e.g. eth3 +TIPC_ETH_IF=eth0 + +# This is valid when above MDS_TRANSPORT is set to TIPC, nd OPENSAF_MANAGE_TIPC is set to "yes", +# values supported is TIPC netid ,e.g 4711 +TIPC_NET_ID=1234 + # Specifies how long "opensafd stop" should wait before stop has considered to fail OPENSAF_TERMTIMEOUT=60 diff --git a/osaf/services/infrastructure/nid/config/nodeinit.conf.controller b/osaf/services/infrastructure/nid/config/nodeinit.conf.controller --- a/osaf/services/infrastructure/nid/config/nodeinit.conf.controller +++ b/osaf/services/infrastructure/nid/config/nodeinit.conf.controller @@ -53,8 +53,7 @@ # processes. # ############################################################################# -xxLIBDIRxx/nid_tipc:TIPC:S:xxLIBDIRxx/nid_tipc:4000::2:1:start eth0 1234:stop -xxCLCCLIDIRxx/osaf-dtm:DTM:S:xxCLCCLIDIRxx/osaf-dtm:6000:-6:2:1:start:stop +xxCLCCLIDIRxx/osaf-transport:TRANSPORT:S:xxLIBDIRxx/osaf-transport:6000:-6:2:1:start:stop xxCLCCLIDIRxx/osaf-rded:RDE:S:xxCLCCLIDIRxx/osaf-rded:12000:-6:2:1:start:stop xxCLCCLIDIRxx/osaf-fmd:HLFM:S:xxCLCCLIDIRxx/osaf-fmd:12000:-6:2:1:start:stop xxCLCCLIDIRxx/osaf-immd:IMMD:S:xxCLCCLIDIRxx/osaf-immd:4000:4:2:1:start:stop diff --git a/osaf/services/infrastructure/nid/config/nodeinit.conf.payload b/osaf/services/infrastructure/nid/config/nodeinit.conf.payload --- a/osaf/services/infrastructure/nid/config/nodeinit.conf.payload +++ b/osaf/services/infrastructure/nid/config/nodeinit.conf.payload @@ -53,8 +53,7 @@ # processes. # ############################################################################# -xxLIBDIRxx/nid_tipc:TIPC:S:xxLIBDIRxx/nid_tipc:4000::2:1:start eth0 1234:stop -xxCLCCLIDIRxx/osaf-dtm:DTM:S:xxCLCCLIDIRxx/osaf-dtm:6000:-6:2:1:start:stop +xxCLCCLIDIRxx/osaf-transport:TRANSPORT:S:xxLIBDIRxx/osaf-transport:6000:-6:2:1:start:stop xxCLCCLIDIRxx/osaf-immnd:IMMND:S:xxCLCCLIDIRxx/osaf-immnd:48000:4:2:1:start:stop xxCLCCLIDIRxx/osaf-noded:CLMNA:S:xxCLCCLIDIRxx/osaf-noded:4000::2:1:start:stop xxCLCCLIDIRxx/osaf-amfnd:AMFND:S:xxCLCCLIDIRxx/osaf-amfnd:99000::0:1:start:stop diff --git a/osaf/services/infrastructure/nid/scripts/Makefile.am b/osaf/services/infrastructure/nid/scripts/Makefile.am --- a/osaf/services/infrastructure/nid/scripts/Makefile.am +++ b/osaf/services/infrastructure/nid/scripts/Makefile.am @@ -20,7 +20,7 @@ MAINTAINERCLEANFILES = Makefile.in osaf_execbindir = $(pkglibdir) nodist_osaf_execbin_SCRIPTS = \ - $(top_builddir)/osaf/services/infrastructure/nid/scripts/nid_tipc + $(top_builddir)/osaf/services/infrastructure/nid/scripts/configure_tipc dist_lsbinit_SCRIPTS = \ $(top_builddir)/osaf/services/infrastructure/nid/scripts/opensafd diff --git a/osaf/services/infrastructure/nid/scripts/configure_tipc.in b/osaf/services/infrastructure/nid/scripts/configure_tipc.in new file mode 100644 --- /dev/null +++ b/osaf/services/infrastructure/nid/scripts/configure_tipc.in @@ -0,0 +1,211 @@ +#!/bin/bash +# +# -*- OpenSAF -*- +# +# (C) Copyright 2008 The OpenSAF Foundation +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. This file and program are licensed +# under the GNU Lesser General Public License Version 2.1, February 1999. +# The complete license can be accessed from the following location: +# http://opensource.org/licenses/lgpl-license.php +# See the Copying file included with the OpenSAF distribution for full +# licensing terms. +# +# Author(s): Emerson Network Power +# + +. @sysconfdir@/@PACKAGE_NAME@/osafdir.conf +. $pkgsysconfdir/nid.conf + +TIPC_MODULE=/lib/modules/$(uname -r)/kernel/net/tipc.ko +CHASSIS_ID_FILE=$pkgsysconfdir/chassis_id +SLOT_ID_FILE=$pkgsysconfdir/slot_id +SUBSLOT_ID_FILE=$pkgsysconfdir/subslot_id + +# Configure TIPC in network mode. If the variable TIPC_MODULE points to a file, +# 'insmod' is used else 'modprobe'. 'tipc-config' needs to be in the path. + +# Support for using subslot ID as part the TIPC network address. +# When TIPC_USE_SUBSLOT_ID is set to "NO" (the default), the subslot ID is +# not included in the address and slot ID is not shifted thus producing +# TIPC addresses like 1.1.1, 1.1.2, 1.1.3 etc. +# When TIPC_USE_SUBSLOT_ID is set to "YES", the subslot ID becomes the last 4 bits +# of the address and the slot ID is shifted up 4 bits. +USE_SUBSLOT_ID=${TIPC_USE_SUBSLOT_ID:-"NO"} + +# constants +SHIFT4=4 + +# Make sure tipc-config is available, either in path or in default location +tipc_config=$(which tipc-config 2> /dev/null) +if ! [ -x ${tipc_config} ]; then + echo "error: tipc-config is not available" + exit 1 +fi +# Get the Chassis Id and Slot Id from @sysconfdir@/@PACKAGE_NAME@/chassis_id and @sysconfdir@/@PACKAGE_NAME@/slot_id +if ! test -f "$CHASSIS_ID_FILE"; then + echo "$CHASSIS_ID_FILE doesnt exists, exiting ...." + exit 1 +fi +CHASSIS_ID=`cat "$CHASSIS_ID_FILE"` +if [ "$CHASSIS_ID" -gt "16" ] || [ "$CHASSIS_ID" -lt "1" ] + then + echo "CHASSIS ID Should be in the range of 1 to 16" + echo "Quitting......" + exit 1 +fi +if ! test -f "$SLOT_ID_FILE"; then + echo "$SLOT_ID_FILE doesnt exists, exiting ...." + exit 1 +fi +SLOT_ID=`cat "$SLOT_ID_FILE"` +if [ "$SLOT_ID" -gt "255" ] || [ "$SLOT_ID" -lt "1" ] + then + echo "SLOT ID Should be in the range of 1 to 255" + echo "Quitting......" + exit 1 +fi +if ! test -f $SUBSLOT_ID_FILE; then + echo "$SLOT_ID_FILE doesnt exist, exiting ...." + exit 1 +fi +SUBSLOT_ID=`cat $SUBSLOT_ID_FILE` +if [ "$SUBSLOT_ID" -gt "15" ] || [ "$SUBSLOT_ID" -lt "0" ]; then + echo "SUBSLOT ID Should be in the range of 0 to 15" + echo "Quitting......" + exit 1 +fi + +if [ "$#" -lt "1" ] || [ "$#" -gt "4" ] + then + echo " If you want to use TIPC in Non Networking mode" + echo " Usage: $0 start &" + echo " If you want to use TIPC in Networking mode" + echo " Usage: $0 start ifname[,ifname] <netid[1-9999]>" + echo " Example: interface eth0 and netid 7777" + echo " $0 start eth0 7777 &" + echo " Example: interface eth0 and eth1 and netid 9999" + echo " $0 start eth0,eth1 9999" + exit 1 +fi + +ETH_NAME=$2 +TIPC_NETID=$3 + +if [ $# -gt 1 ] ; then + if [ "$TIPC_NETID" -gt "9999" ] || [ "$TIPC_NETID" -lt "1" ] + then + echo "CORE ID Should be in the range of 1 to 9999" + echo "Quitting......" + exit 1 + fi +fi + +printf "00%02x%02x%02x\n" $CHASSIS_ID $SLOT_ID $SUBSLOT_ID > $pkglocalstatedir/node_id +chmod 744 $pkglocalstatedir/node_id +if [ "$USE_SUBSLOT_ID" = "YES" ]; then + TIPC_NODEID=$(($SLOT_ID << $SHIFT4)) + TIPC_NODEID=$(($TIPC_NODEID + $SUBSLOT_ID)) +else + TIPC_NODEID=$SLOT_ID +fi + +function tipc_configure () +{ + echo "Inserting TIPC mdoule..." + + if ! test -f "$TIPC_MODULE" ; then + modprobe tipc + else + insmod "$TIPC_MODULE" + fi + + ret_val=$? + if [ $ret_val -ne 0 ] ; then + logger -p user.err " TIPC Module could not be loaded " + exit 1 + fi + + # max_nodes is not supported in TIPC 2.0 + if ${tipc_config} -max_nodes 2> /dev/null; then + ${tipc_config} -max_nodes=2000 + ret_val=$? + if [ $ret_val -ne 0 ] ; then + echo "Unable to set the Max_nodes to 2000, exiting ....." + modprobe -r tipc + exit 1 + fi + fi + + if [ $# -eq 1 ] ; then + echo "Configuring TIPC in Non-Networking Mode..." + ################ Address config and check ######### + ${tipc_config} -a=1.1.$TIPC_NODEID + ret_z1=$? + if [ $ret_z1 -ne 0 ] ; then + echo "Unable to Configure TIPC address, Please try again, exiting" + echo "Removing TIPC module ...." + modprobe -r tipc + exit 1 + fi + else + echo "Configuring TIPC in Networking Mode..." + ################ Address config and check ######### + ${tipc_config} -netid=$TIPC_NETID -a=1.1.$TIPC_NODEID + ret_z2=$? + if [ $ret_z2 -ne 0 ] ; then + echo "Unable to Configure TIPC address, Please try again, exiting" + echo "Removing TIPC module ...." + modprobe -r tipc + exit 1 + fi + ################ Interface config and check ######### + ${tipc_config} -be=$(echo $ETH_NAME | sed 's/^/eth:/;s/,/,eth:/g') + ret_z3=$? + if [ $ret_z3 -ne 0 ] ; then + echo "Unable to Configure TIPC bearer interface, Please try again, exiting" + echo "Removing TIPC module ...." + modprobe -r tipc + exit 1 + fi + fi + + echo " TIPC Module is Present and Configured Success in network mode " +} + +# Consider that TIPC could be statically linked +if ! grep TIPC /proc/net/protocols >& /dev/null; then + tipc_configure +else + # TIPC is already present, is it configured properly? + configured_tipc_addr=`tipc-config -addr | tr -s '<>' % | cut -d% -f2` + opensaf_tipc_addr=1.1.$TIPC_NODEID + if [ $configured_tipc_addr != $opensaf_tipc_addr ]; then + logger -t opensaf -s "TIPC node address not configured to OpenSAF requirements, exiting..." + exit 1 + fi + + configured_net_id=`tipc-config -netid | cut -d: -f2` + opensaf_net_id=$TIPC_NETID + if [ $configured_net_id != $opensaf_net_id ]; then + logger -t opensaf -s "TIPC network ID not configured to OpenSAF requirements, exiting..." + exit 1 + fi + configured_net_id=`tipc-config -netid | cut -d: -f2` + opensaf_net_id=$CORE_ID + if [ $configured_net_id != $opensaf_net_id ]; then + logger -t opensaf -s "TIPC network ID not configured to OpenSAF requirements, exiting..." + exit 1 + fi + + configured_bearer=`tipc-config -b | grep -v Bearer | cut -d: -f2` + opensaf_bearer=$ETH_NAME + if [ $configured_bearer != $opensaf_bearer ]; then + logger -t opensaf -s "TIPC bearer not configured to OpenSAF requirements, exiting..." + exit 1 + fi +fi + + diff --git a/osaf/services/infrastructure/nid/scripts/nid_tipc.in b/osaf/services/infrastructure/nid/scripts/nid_tipc.in deleted file mode 100644 --- a/osaf/services/infrastructure/nid/scripts/nid_tipc.in +++ /dev/null @@ -1,225 +0,0 @@ -#!/bin/bash -# -# -*- OpenSAF -*- -# -# (C) Copyright 2008 The OpenSAF Foundation -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -# or FITNESS FOR A PARTICULAR PURPOSE. This file and program are licensed -# under the GNU Lesser General Public License Version 2.1, February 1999. -# The complete license can be accessed from the following location: -# http://opensource.org/licenses/lgpl-license.php -# See the Copying file included with the OpenSAF distribution for full -# licensing terms. -# -# Author(s): Emerson Network Power -# - -. @sysconfdir@/@PACKAGE_NAME@/osafdir.conf -. $pkgsysconfdir/nid.conf - -TIPC_MODULE=/lib/modules/$(uname -r)/kernel/net/tipc.ko -CHASSIS_ID_FILE=$pkgsysconfdir/chassis_id -SLOT_ID_FILE=$pkgsysconfdir/slot_id -SUBSLOT_ID_FILE=$pkgsysconfdir/subslot_id - -# Configure TIPC in network mode. If the variable TIPC_MODULE points to a file, -# 'insmod' is used else 'modprobe'. 'tipc-config' needs to be in the path. - -# Support for using subslot ID as part the TIPC network address. -# When TIPC_USE_SUBSLOT_ID is set to "NO" (the default), the subslot ID is -# not included in the address and slot ID is not shifted thus producing -# TIPC addresses like 1.1.1, 1.1.2, 1.1.3 etc. -# When TIPC_USE_SUBSLOT_ID is set to "YES", the subslot ID becomes the last 4 bits -# of the address and the slot ID is shifted up 4 bits. -USE_SUBSLOT_ID=${TIPC_USE_SUBSLOT_ID:-"NO"} - -# constants -SHIFT4=4 -NID_SVC_NAME=TIPC - -# Make sure tipc-config is available, either in path or in default location -tipc_config=$(which tipc-config 2> /dev/null) -if ! [ -x ${tipc_config} ]; then - echo "error: tipc-config is not available" - exit 1 -fi -# Get the Chassis Id and Slot Id from @sysconfdir@/@PACKAGE_NAME@/chassis_id and @sysconfdir@/@PACKAGE_NAME@/slot_id -if ! test -f "$CHASSIS_ID_FILE"; then - echo "$CHASSIS_ID_FILE doesnt exists, exiting ...." - exit 1 -fi -CHASSIS_ID=`cat "$CHASSIS_ID_FILE"` -if [ "$CHASSIS_ID" -gt "16" ] || [ "$CHASSIS_ID" -lt "1" ] - then - echo "CHASSIS ID Should be in the range of 1 to 16" - echo "Quitting......" - exit 1 -fi -if ! test -f "$SLOT_ID_FILE"; then - echo "$SLOT_ID_FILE doesnt exists, exiting ...." - exit 1 -fi -SLOT_ID=`cat "$SLOT_ID_FILE"` -if [ "$SLOT_ID" -gt "255" ] || [ "$SLOT_ID" -lt "1" ] - then - echo "SLOT ID Should be in the range of 1 to 255" - echo "Quitting......" - exit 1 -fi -if ! test -f $SUBSLOT_ID_FILE; then - echo "$SLOT_ID_FILE doesnt exist, exiting ...." - exit 1 -fi -SUBSLOT_ID=`cat $SUBSLOT_ID_FILE` -if [ "$SUBSLOT_ID" -gt "15" ] || [ "$SUBSLOT_ID" -lt "0" ]; then - echo "SUBSLOT ID Should be in the range of 0 to 15" - echo "Quitting......" - exit 1 -fi - -if [ "$#" -lt "1" ] || [ "$#" -gt "4" ] - then - echo " If you want to use TIPC in Non Networking mode" - echo " Usage: $0 start &" - echo " If you want to use TIPC in Networking mode" - echo " Usage: $0 start ifname[,ifname] <netid[1-9999]>" - echo " Example: interface eth0 and netid 7777" - echo " $0 start eth0 7777 &" - echo " Example: interface eth0 and eth1 and netid 9999" - echo " $0 start eth0,eth1 9999" - exit 1 -fi - -ETH_NAME=$2 -TIPC_NETID=$3 - -if [ $# -gt 1 ] ; then - if [ "$TIPC_NETID" -gt "9999" ] || [ "$TIPC_NETID" -lt "1" ] - then - echo "CORE ID Should be in the range of 1 to 9999" - echo "Quitting......" - exit 1 - fi -fi - -printf "00%02x%02x%02x\n" $CHASSIS_ID $SLOT_ID $SUBSLOT_ID > $pkglocalstatedir/node_id -chmod 744 $pkglocalstatedir/node_id -if [ "$USE_SUBSLOT_ID" = "YES" ]; then - TIPC_NODEID=$(($SLOT_ID << $SHIFT4)) - TIPC_NODEID=$(($TIPC_NODEID + $SUBSLOT_ID)) -else - TIPC_NODEID=$SLOT_ID -fi - -function tipc_configure () -{ - echo "Inserting TIPC mdoule..." - - if ! test -f "$TIPC_MODULE" ; then - modprobe tipc - else - insmod "$TIPC_MODULE" - fi - - ret_val=$? - if [ $ret_val -ne 0 ] ; then - logger -p user.err " TIPC Module could not be loaded " - echo "$NID_MAGIC:$NID_SVC_NAME:$DAEMON_START_FAILED" > $NIDFIFO - exit 1 - fi - - # max_nodes is not supported in TIPC 2.0 - if ${tipc_config} -max_nodes 2> /dev/null; then - ${tipc_config} -max_nodes=2000 - ret_val=$? - if [ $ret_val -ne 0 ] ; then - echo "Unable to set the Max_nodes to 2000, exiting ....." - modprobe -r tipc - exit 1 - fi - fi - - if [ $# -eq 1 ] ; then - echo "Configuring TIPC in Non-Networking Mode..." - ################ Address config and check ######### - ${tipc_config} -a=1.1.$TIPC_NODEID - ret_z1=$? - if [ $ret_z1 -ne 0 ] ; then - echo "Unable to Configure TIPC address, Please try again, exiting" - echo "Removing TIPC module ...." - modprobe -r tipc - exit 1 - fi - else - echo "Configuring TIPC in Networking Mode..." - ################ Address config and check ######### - ${tipc_config} -netid=$TIPC_NETID -a=1.1.$TIPC_NODEID - ret_z2=$? - if [ $ret_z2 -ne 0 ] ; then - echo "Unable to Configure TIPC address, Please try again, exiting" - echo "Removing TIPC module ...." - modprobe -r tipc - exit 1 - fi - ################ Interface config and check ######### - ${tipc_config} -be=$(echo $ETH_NAME | sed 's/^/eth:/;s/,/,eth:/g') - ret_z3=$? - if [ $ret_z3 -ne 0 ] ; then - echo "Unable to Configure TIPC bearer interface, Please try again, exiting" - echo "Removing TIPC module ...." - modprobe -r tipc - exit 1 - fi - fi - - echo " TIPC Module is Present and Configured Success in network mode " -} - -# Consider that TIPC could be statically linked -if ! grep TIPC /proc/net/protocols >& /dev/null; then - tipc_configure -else - # TIPC is already present, is it configured properly? - configured_tipc_addr=`tipc-config -addr | tr -s '<>' % | cut -d% -f2` - opensaf_tipc_addr=1.1.$TIPC_NODEID - if [ $configured_tipc_addr != $opensaf_tipc_addr ]; then - logger -t opensaf -s "TIPC node address not configured to OpenSAF requirements, exiting..." - exit 1 - fi - - configured_net_id=`tipc-config -netid | cut -d: -f2` - opensaf_net_id=$TIPC_NETID - if [ $configured_net_id != $opensaf_net_id ]; then - logger -t opensaf -s "TIPC network ID not configured to OpenSAF requirements, exiting..." - exit 1 - fi - configured_net_id=`tipc-config -netid | cut -d: -f2` - opensaf_net_id=$CORE_ID - if [ $configured_net_id != $opensaf_net_id ]; then - logger -t opensaf -s "TIPC network ID not configured to OpenSAF requirements, exiting..." - exit 1 - fi - - configured_bearer=`tipc-config -b | grep -v Bearer | cut -d: -f2` - opensaf_bearer=$ETH_NAME - if [ $configured_bearer != $opensaf_bearer ]; then - logger -t opensaf -s "TIPC bearer not configured to OpenSAF requirements, exiting..." - exit 1 - fi -fi - -echo "$NID_MAGIC:$NID_SVC_NAME:$DAEMON_STARTED" > $NIDFIFO - -echo "Running Permanent loop to clean MDS Logs..." -while true -do - MDS_LOG_FILE=$pkglogdir/mds.log - FILESIZE=`du -sk "$MDS_LOG_FILE" 2>/dev/null | cut -f1` - if [ 5000 -lt 0$FILESIZE ]; then - rm -f "$MDS_LOG_FILE.old" - mv -f "$MDS_LOG_FILE" "$MDS_LOG_FILE.old" - fi - sleep 15 -done diff --git a/osaf/services/infrastructure/nid/scripts/opensafd.in b/osaf/services/infrastructure/nid/scripts/opensafd.in --- a/osaf/services/infrastructure/nid/scripts/opensafd.in +++ b/osaf/services/infrastructure/nid/scripts/opensafd.in @@ -45,8 +45,6 @@ if [ $osafversion = "1" ] ; then fi unload_tipc() { - # FIXME: Once tipc scripts are cleaned - pkill -9 nid_tipc* # Unload TIPC if already loaded if [ $MANAGE_TIPC = "yes" ] && grep tipc /proc/modules >/dev/null 2>&1; then @@ -116,9 +114,7 @@ enable_coredump() { final_clean() { # Loop throught all the OpenSAF LSB CLC-CLI scripts to clean staling pid/lock - if [ "$MDS_TRANSPORT" = "TCP" ] ; then - pkill -9 dh_monitoring* >/dev/null 2>&1 - fi + pkill -9 osaf-transport >/dev/null 2>&1 for cmd in `ls $pkgclcclidir/osaf-*`; do # skip dtm here to allow shutdown of other services (e.g. amfd) @@ -127,7 +123,7 @@ final_clean() { fi done - if [ "$MDS_TRANSPORT" = "TIPC" ] ; then + if [ "$MDS_TRANSPORT" = "TIPC" ]; then unload_tipc else # stop dtm, now all dependent services should be stopped @@ -184,27 +180,11 @@ generate_nodeid() { } check_transport() { - if [ "$MDS_TRANSPORT" = "TIPC" ] ; then + if [ "$MDS_TRANSPORT" = "TIPC" ]; then # Transport TIPC check_tipc - sed -i 's/#*\(.*nid_tipc*\)/\1/gI' $nodeinitdotconf - #Now comment the line in the nodeinit.conf for TIPC - grep "osaf-dtm:DTM" $nodeinitdotconf | grep "#" > /dev/null - ret_val=$? - if [ $ret_val -ne 0 ] ; then - #comment the line - sed -i 's/\(.*osaf-dtm:DTM*\)/#\1/gI' $nodeinitdotconf - fi else # Transport TCP - #Now comment the line in the nodeinit.conf for TCP - sed -i 's/#*\(.*osaf-dtm:DTM*\)/\1/gI' $nodeinitdotconf - grep "nid_tipc" $nodeinitdotconf | grep "#" > /dev/null - ret_val=$? - if [ $ret_val -ne 0 ] ; then - #comment the line - sed -i 's/\(.*nid_tipc*\)/#\1/gI' $nodeinitdotconf - fi generate_nodeid fi } @@ -253,9 +233,7 @@ start() { stop() { logger -t $prog "Stopping OpenSAF Services" - if [ "$MDS_TRANSPORT" = "TCP" ] ; then - pkill -9 dh_monitoring* >/dev/null 2>&1 - fi + pkill -9 osaf-transport >/dev/null 2>&1 amfpid=`pidofproc -p $amfnd_pid $amfnd_bin` echo -n "Stopping OpenSAF Services: " ------------------------------------------------------------------------------ October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk _______________________________________________ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel