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

Convert to using libpacemaker for managing tickets #144

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
8 changes: 7 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,12 @@ AC_DEFINE_UNQUOTED(CRM_DAEMON_USER,"$CRM_DAEMON_USER", User to run Booth daemon
BOOTH_PKG_CHECK_VAR([CRM_DAEMON_GROUP], [pacemaker], [daemon_group], [haclient])
AC_DEFINE_UNQUOTED(CRM_DAEMON_GROUP,"$CRM_DAEMON_GROUP", Group to run Booth daemon as)

# If libpacemaker is available, use it
PKG_CHECK_MODULES([LIBPACEMAKER], [libpacemaker >= 2.1.7])
if test "x$LIBPACEMAKER_CFLAGS" != "xno"; then
AC_DEFINE([LIBPACEMAKER], [1], [use libpacemaker for ticket manipulation])
fi

# *FLAGS handling goes here

ENV_CFLAGS="$CFLAGS"
Expand Down Expand Up @@ -455,7 +461,7 @@ CFLAGS="$ENV_CFLAGS $OPT_CFLAGS $GDB_FLAGS $OS_CFLAGS \
$COVERAGE_CFLAGS $EXTRA_WARNINGS $WERROR_CFLAGS $LIBGNUTLS_CFLAGS"
CPPFLAGS="$ENV_CPPFLAGS $OS_CPPFLAGS $GLIB_CFLAGS $RESMON_CFLAGS $XML_CFLAGS"
LDFLAGS="$ENV_LDFLAGS $COVERAGE_LDFLAGS $OS_LDFLAGS"
LIBS="$LIBS $XML_LIBS $LIBGNUTLS_LIBS"
LIBS="$LIBS $XML_LIBS $LIBGNUTLS_LIBS $LIBPACEMAKER_LIBS"

# substitute what we need:
AC_SUBST([INITDDIR])
Expand Down
4 changes: 2 additions & 2 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ AM_CPPFLAGS = -I$(top_builddir)/include
sbin_PROGRAMS = boothd

boothd_SOURCES = config.c main.c raft.c ticket.c transport.c \
pacemaker.c handler.c request.c attr.c manual.c
pcmk.c handler.c request.c attr.c manual.c

noinst_HEADERS = \
attr.h booth.h handler.h log.h pacemaker.h request.h timer.h \
attr.h booth.h handler.h log.h pcmk.h request.h timer.h \
auth.h config.h inline-fn.h manual.h raft.h ticket.h transport.h

if BUILD_TIMER_C
Expand Down
2 changes: 1 addition & 1 deletion src/attr.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "attr.h"
#include "booth.h"
#include "ticket.h"
#include "pacemaker.h"
#include "pcmk.h"

void print_geostore_usage(void)
{
Expand Down
4 changes: 2 additions & 2 deletions src/handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include "config.h"
#include "inline-fn.h"
#include "log.h"
#include "pacemaker.h"
#include "pcmk.h"
#include "booth.h"
#include "handler.h"

Expand Down Expand Up @@ -131,7 +131,7 @@ void wait_child(int sig)
struct ticket_config *tk;

/* use waitpid(2) and not wait(2) in order not to interfere
* with popen(2)/pclose(2) and system(2) used in pacemaker.c
* with popen(2)/pclose(2) and system(2) used in pcmk.c
*/
_FOREACH_TICKET(i, tk) {
if (tk_test.path && tk_test.pid > 0 &&
Expand Down
9 changes: 8 additions & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,15 @@
#include <sys/prctl.h>
#include <clplumbing/coredumps.h>
#endif
#ifdef LIBPACEMAKER
#include <pacemaker.h>
#endif
#include "log.h"
#include "booth.h"
#include "config.h"
#include "transport.h"
#include "inline-fn.h"
#include "pacemaker.h"
#include "pcmk.h"
#include "ticket.h"
#include "request.h"
#include "attr.h"
Expand Down Expand Up @@ -1633,6 +1636,10 @@ int main(int argc, char *argv[], char *envp[])
enum qb_log_target_slot i;
#endif

#ifdef LIBPACEMAKER
pcmk_api_init();
#endif

init_set_proc_title(argc, argv, envp);
get_time(&start_time);

Expand Down
Loading