Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: sbd-cluster: periodically check corosync-daemon liveness #83

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ PKG_CHECK_MODULES(glib, [glib-2.0])
dnl PKG_CHECK_MODULES(libcoroipcc, [libcoroipcc])

PKG_CHECK_MODULES(cmap, [libcmap], HAVE_cmap=1, HAVE_cmap=0)
PKG_CHECK_MODULES(votequorum, [libvotequorum], HAVE_votequorum=1, HAVE_votequorum=0)

dnl pacemaker > 1.1.8
PKG_CHECK_MODULES(pacemaker, [pacemaker, pacemaker-cib], HAVE_pacemaker=1, HAVE_pacemaker=0)
Expand All @@ -47,9 +48,14 @@ if test $HAVE_pacemaker = 0 -a $HAVE_pcmk = 0; then
elif test $HAVE_pacemaker = 1; then
CPPFLAGS="$CPPFLAGS $glib_CFLAGS $pacemaker_CFLAGS"
if test $HAVE_cmap = 0; then
AC_MSG_NOTICE(No package 'cmap' found)
AC_MSG_NOTICE(No library 'cmap' found)
else
CPPFLAGS="$CPPFLAGS $cmap_CFLAGS"
CPPFLAGS="$CPPFLAGS $cmap_CFLAGS"
fi
if test $HAVE_votequorum = 0; then
AC_MSG_NOTICE(No library 'votequorum' found)
else
CPPFLAGS="$CPPFLAGS $votequorum_CFLAGS"
fi
fi

Expand All @@ -66,6 +72,7 @@ AC_CHECK_LIB(pe_rules, test_rule, , missing="yes")
AC_CHECK_LIB(crmcluster, crm_peer_init, , missing="yes")
AC_CHECK_LIB(uuid, uuid_unparse, , missing="yes")
AC_CHECK_LIB(cmap, cmap_initialize, , HAVE_cmap=0)
AC_CHECK_LIB(votequorum, votequorum_getinfo, , HAVE_votequorum=0)

dnl pacemaker >= 1.1.8
AC_CHECK_HEADERS(pacemaker/crm/cluster.h)
Expand Down Expand Up @@ -107,6 +114,9 @@ fi
AC_DEFINE_UNQUOTED(CHECK_TWO_NODE, $HAVE_cmap, Turn on checking for 2-node cluster)
AM_CONDITIONAL(CHECK_TWO_NODE, test "$HAVE_cmap" = "1")

AC_DEFINE_UNQUOTED(CHECK_VOTEQUORUM_HANDLE, $HAVE_votequorum, Turn on periodic checking of votequorum-handle)
AM_CONDITIONAL(CHECK_VOTEQUORUM_HANDLE, test "$HAVE_votequorum" = "1")

CONFIGDIR=""
AC_ARG_WITH(configdir,
[ --with-configdir=DIR
Expand Down
36 changes: 34 additions & 2 deletions src/sbd-cluster.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ sbd_plugin_membership_dispatch(cpg_handle_t handle,

#if SUPPORT_COROSYNC

#if CHECK_VOTEQUORUM_HANDLE
#include <corosync/votequorum.h>

static votequorum_handle_t votequorum_handle = 0;
#endif

static bool two_node = false;
static bool ever_seen_both = false;
static int cpg_membership_entries = -1;
Expand Down Expand Up @@ -261,12 +267,32 @@ notify_timer_cb(gpointer data)

#endif
case pcmk_cluster_corosync:
do {
#if SUPPORT_COROSYNC && CHECK_VOTEQUORUM_HANDLE
struct votequorum_info info;

if (votequorum_getinfo(votequorum_handle, 0, &info) != CS_OK) {

votequorum_finalize(votequorum_handle);
if (votequorum_initialize(&votequorum_handle, NULL) != CS_OK) {
votequorum_handle = 0;
break;
}
if (votequorum_getinfo(votequorum_handle, 0, &info) != CS_OK) {
break;
}
}
#endif
notify_parent();
} while (0);
break;

#if HAVE_DECL_PCMK_CLUSTER_CMAN
case pcmk_cluster_cman:
#endif
/* TODO - Make a CPG call and only call notify_parent() when we get a reply */

notify_parent();
break;
#endif

default:
break;
Expand Down Expand Up @@ -533,6 +559,12 @@ find_pacemaker_remote(void)
static void
clean_up(int rc)
{
#if CHECK_VOTEQUORUM_HANDLE
votequorum_finalize(votequorum_handle);
votequorum_handle = 0; /* there isn't really an invalid handle value
* just to be back where we started
*/
#endif
return;
}

Expand Down