Compare commits
62 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4822172123 | ||
|
|
676cc02d31 | ||
|
|
59251abe21 | ||
|
|
b67eb9fd30 | ||
|
|
940a961071 | ||
|
|
a5992c0c6e | ||
|
|
9cfe41e4cb | ||
|
|
10f558600c | ||
|
|
9bab0b3594 | ||
|
|
30c181b1bf | ||
|
|
aa5db6bc10 | ||
|
|
3838e60516 | ||
|
|
d1dc7ab52b | ||
|
|
4e2392507f | ||
|
|
60703dfc8c | ||
|
|
7d7721ffa5 | ||
|
|
157c0b0f88 | ||
|
|
57a42bb54e | ||
|
|
e383d1fdf8 | ||
|
|
654dae39a9 | ||
|
|
b5637a2724 | ||
|
|
19c989016e | ||
|
|
908d7749f7 | ||
|
|
167afa01db | ||
|
|
f7cd75460a | ||
|
|
4bf848b913 | ||
|
|
2605755c8c | ||
|
|
f4d70ccf2b | ||
|
|
9919f4ac31 | ||
|
|
bf4f3fab1d | ||
|
|
68d77bbd5e | ||
|
|
5b583f7517 | ||
|
|
f47046a5af | ||
|
|
d68c8368e6 | ||
|
|
da88b3aa00 | ||
|
|
e5a92625e9 | ||
|
|
7052067601 | ||
|
|
5b57687bf6 | ||
|
|
5149534389 | ||
|
|
6513e1ad33 | ||
|
|
e9097d2ad0 | ||
|
|
79f959b02c | ||
|
|
3ab82c1595 | ||
|
|
f5edfe7d50 | ||
|
|
fc8cacb111 | ||
|
|
0c5606ae99 | ||
|
|
de6dfc5984 | ||
|
|
af206bf199 | ||
|
|
c6749637d0 | ||
|
|
1c033bd3f0 | ||
|
|
6754bd09f1 | ||
|
|
fb556c2564 | ||
|
|
c4b1800b74 | ||
|
|
7b56628eba | ||
|
|
0e519515be | ||
|
|
19b5c9e14e | ||
|
|
47534c0cc0 | ||
|
|
9fb9198f67 |
||
|
|
e9372d6798 | ||
|
|
c4f539e6ee | ||
|
|
295fea95c5 | ||
|
|
3d0d8ea768 |
15 changed files with 311 additions and 1276 deletions
1
.fmf/version
Normal file
1
.fmf/version
Normal file
|
|
@ -0,0 +1 @@
|
|||
1
|
||||
|
|
@ -1,112 +0,0 @@
|
|||
From d44c03a264dc10715c197b1160a7fcdaf7b52a5c Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jan=20Pokorn=C3=BD?= <jpokorny@redhat.com>
|
||||
Date: Tue, 26 Apr 2016 16:43:50 +0200
|
||||
Subject: [PATCH 1/6] Feature: offer alternatives to libraries from
|
||||
(cluster-)glue
|
||||
|
||||
This revision is a preparation work establishing --without-glue switch
|
||||
to configure that will eventually allow non-glue alternatives.
|
||||
|
||||
The analogous conditional is added to the spec file, based on premise
|
||||
that cluster-glue will not be re-introduced into Fedora, RHEL, etc.
|
||||
---
|
||||
booth.spec | 20 +++++++++++++++++---
|
||||
configure.ac | 5 +++++
|
||||
src/Makefile.am | 6 +++---
|
||||
3 files changed, 25 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/booth.spec b/booth.spec
|
||||
index cd54ab1..f73d2d8 100644
|
||||
--- a/booth.spec
|
||||
+++ b/booth.spec
|
||||
@@ -1,5 +1,11 @@
|
||||
%bcond_with html_man
|
||||
|
||||
+%if 0%{?fedora} > 18 || 0%{?centos} > 6 || 0%{?rhel} > 6
|
||||
+%bcond_with glue
|
||||
+%else
|
||||
+%bcond_without glue
|
||||
+%endif
|
||||
+
|
||||
%if 0%{?suse_version}
|
||||
%global booth_docdir %{_defaultdocdir}/%{name}
|
||||
%else
|
||||
@@ -50,17 +56,24 @@ BuildRequires: pkgconfig(glib-2.0)
|
||||
%endif
|
||||
BuildRequires: libgcrypt-devel
|
||||
%if 0%{?fedora} || 0%{?centos} || 0%{?rhel}
|
||||
-BuildRequires: cluster-glue-libs-devel
|
||||
BuildRequires: pacemaker-libs-devel
|
||||
%else
|
||||
-BuildRequires: libglue-devel
|
||||
BuildRequires: libpacemaker-devel
|
||||
%endif
|
||||
+%if 0%{?with_glue}
|
||||
+%if 0%{?fedora} || 0%{?centos} || 0%{?rhel}
|
||||
+BuildRequires: cluster-glue-libs-devel
|
||||
+%else
|
||||
+BuildRequires: libglue-devel
|
||||
+%endif
|
||||
+%endif
|
||||
BuildRequires: libxml2-devel
|
||||
BuildRequires: zlib-devel
|
||||
%if 0%{?fedora} || 0%{?centos} || 0%{?rhel}
|
||||
Requires: pacemaker >= 1.1.8
|
||||
+%if 0%{?with_glue}
|
||||
Requires: cluster-glue-libs >= 1.0.6
|
||||
+%endif
|
||||
%else
|
||||
Requires: pacemaker-ticket-support >= 2.0
|
||||
%endif
|
||||
@@ -79,7 +92,8 @@ Pacemaker.
|
||||
%configure \
|
||||
--with-initddir=%{_initrddir} \
|
||||
--docdir=%{booth_docdir} \
|
||||
- %{!?with_html_man:--without-html_man}
|
||||
+ %{!?with_html_man:--without-html_man} \
|
||||
+ %{!?with_glue:--without-glue}
|
||||
|
||||
make
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index ab2ad43..1a8ed4c 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -215,6 +215,11 @@ AC_ARG_WITH([html_man],
|
||||
[],
|
||||
[with_html_man=yes])
|
||||
|
||||
+AC_ARG_WITH([glue],
|
||||
+ [ --without-glue : Avoid libraries from (cluster-)glue project.],
|
||||
+ [],
|
||||
+ [with_glue=yes])
|
||||
+
|
||||
# OS detection
|
||||
# THIS SECTION MUST DIE!
|
||||
CP=cp
|
||||
diff --git a/src/Makefile.am b/src/Makefile.am
|
||||
index 7d05d76..e7f5aa2 100644
|
||||
--- a/src/Makefile.am
|
||||
+++ b/src/Makefile.am
|
||||
@@ -10,6 +10,9 @@ sbin_PROGRAMS = boothd
|
||||
boothd_SOURCES = config.c main.c raft.c ticket.c transport.c \
|
||||
pacemaker.c handler.c request.c attr.c
|
||||
|
||||
+noinst_HEADERS = booth.h pacemaker.h \
|
||||
+ config.h log.h raft.h ticket.h transport.h handler.h request.h attr.h
|
||||
+
|
||||
if BUILD_TIMER_C
|
||||
boothd_SOURCES += timer.c
|
||||
endif
|
||||
@@ -22,8 +25,5 @@ boothd_LDFLAGS = $(OS_DYFLAGS) -L./
|
||||
boothd_LDADD = -lplumb -lplumbgpl -lm $(GLIB_LIBS) $(ZLIB_LIBS)
|
||||
boothd_CFLAGS = $(GLIB_CFLAGS)
|
||||
|
||||
-noinst_HEADERS = booth.h pacemaker.h \
|
||||
- config.h log.h raft.h ticket.h transport.h handler.h request.h attr.h
|
||||
-
|
||||
lint:
|
||||
-splint $(INCLUDES) $(LINT_FLAGS) $(CFLAGS) *.c
|
||||
--
|
||||
2.4.11
|
||||
|
||||
|
|
@ -1,373 +0,0 @@
|
|||
From c1211c0d47fb510fbd659d9165dc584a9181ec22 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jan=20Pokorn=C3=BD?= <jpokorny@redhat.com>
|
||||
Date: Tue, 26 Apr 2016 16:44:48 +0200
|
||||
Subject: [PATCH 2/6] Feature: alternative logging provider: libqb
|
||||
|
||||
---
|
||||
booth.spec | 3 ++
|
||||
configure.ac | 28 ++++++++++++++++-
|
||||
src/Makefile.am | 8 +++++
|
||||
src/alt/logging_libqb.c | 84 +++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
src/alt/logging_libqb.h | 70 +++++++++++++++++++++++++++++++++++++++++
|
||||
src/log.h | 22 +++++++++----
|
||||
src/main.c | 26 ++++++++++++---
|
||||
7 files changed, 229 insertions(+), 12 deletions(-)
|
||||
create mode 100644 src/alt/logging_libqb.c
|
||||
create mode 100644 src/alt/logging_libqb.h
|
||||
|
||||
diff --git a/booth.spec b/booth.spec
|
||||
index f73d2d8..cc73af2 100644
|
||||
--- a/booth.spec
|
||||
+++ b/booth.spec
|
||||
@@ -66,6 +66,9 @@ BuildRequires: cluster-glue-libs-devel
|
||||
%else
|
||||
BuildRequires: libglue-devel
|
||||
%endif
|
||||
+%else
|
||||
+# logging provider
|
||||
+BuildRequires: pkgconfig(libqb)
|
||||
%endif
|
||||
BuildRequires: libxml2-devel
|
||||
BuildRequires: zlib-devel
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 1a8ed4c..32a7dd1 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -6,7 +6,7 @@ AC_PREREQ([2.61])
|
||||
|
||||
AC_INIT([booth], [1.0], [users@clusterlabs.org])
|
||||
|
||||
-AM_INIT_AUTOMAKE([-Wno-portability])
|
||||
+AM_INIT_AUTOMAKE([-Wno-portability subdir-objects])
|
||||
|
||||
AC_CONFIG_SRCDIR([src/main.c])
|
||||
AC_CONFIG_HEADER([src/b_config.h src/booth_config.h])
|
||||
@@ -220,6 +220,31 @@ AC_ARG_WITH([glue],
|
||||
[],
|
||||
[with_glue=yes])
|
||||
|
||||
+# figure out logging provider
|
||||
+logging_provider=""
|
||||
+if test "x$logging_provider" = "x" && test "x$with_glue" = "xyes"; then
|
||||
+ AC_CHECK_LIB([plumb], [cl_log], [logging_provider="libplumb"])
|
||||
+fi
|
||||
+if test "x$logging_provider" = "x" && test "x$with_glue" = "xno"; then
|
||||
+ AC_CHECK_LIB([qb], [qb_log_real_], [logging_provider="libqb"])
|
||||
+fi
|
||||
+case "$logging_provider" in
|
||||
+libplumb)
|
||||
+ ;;
|
||||
+libqb)
|
||||
+ PKG_CHECK_MODULES([LIBQB], [libqb])
|
||||
+ AC_DEFINE([LOGGING_LIBQB], [], [use libqb as a logging provider])
|
||||
+ PKG_CHECK_MODULES([LIBQB1], [libqb >= 1.0],
|
||||
+ [AC_DEFINE([LOGGING_LIBQB_MAJOR], [1],
|
||||
+ [libqb major version lower bound])],
|
||||
+ [AC_MSG_WARN([[syslog identifier will not get changed]])])
|
||||
+ ;;
|
||||
+*)
|
||||
+ AC_MSG_ERROR([logging provider required (libplumb, or libqb when --without-glue)])
|
||||
+ ;;
|
||||
+esac
|
||||
+AM_CONDITIONAL([LOGGING_LIBQB], [test "x$logging_provider" = "xlibqb"])
|
||||
+
|
||||
# OS detection
|
||||
# THIS SECTION MUST DIE!
|
||||
CP=cp
|
||||
@@ -448,6 +473,7 @@ AC_MSG_RESULT([ System init.d directory = ${INITDDIR}])
|
||||
AC_MSG_RESULT([ booth config dir = ${BOOTHSYSCONFDIR}])
|
||||
AC_MSG_RESULT([ SOCKETDIR = ${SOCKETDIR}])
|
||||
AC_MSG_RESULT([ Features = ${PACKAGE_FEATURES}])
|
||||
+AC_MSG_RESULT([ Logging provider = ${logging_provider}])
|
||||
AC_MSG_RESULT([])
|
||||
AC_MSG_RESULT([$PACKAGE build info:])
|
||||
AC_MSG_RESULT([ Library SONAME = ${SONAME}])
|
||||
diff --git a/src/Makefile.am b/src/Makefile.am
|
||||
index e7f5aa2..49c3ac4 100644
|
||||
--- a/src/Makefile.am
|
||||
+++ b/src/Makefile.am
|
||||
@@ -25,5 +25,13 @@ boothd_LDFLAGS = $(OS_DYFLAGS) -L./
|
||||
boothd_LDADD = -lplumb -lplumbgpl -lm $(GLIB_LIBS) $(ZLIB_LIBS)
|
||||
boothd_CFLAGS = $(GLIB_CFLAGS)
|
||||
|
||||
+if !LOGGING_LIBQB
|
||||
+boothd_LDADD += -lplumb
|
||||
+else
|
||||
+boothd_LDADD += $(LIBQB_LIBS)
|
||||
+boothd_SOURCES += alt/logging_libqb.c
|
||||
+noinst_HEADERS += alt/logging_libqb.h
|
||||
+endif
|
||||
+
|
||||
lint:
|
||||
-splint $(INCLUDES) $(LINT_FLAGS) $(CFLAGS) *.c
|
||||
diff --git a/src/alt/logging_libqb.c b/src/alt/logging_libqb.c
|
||||
new file mode 100644
|
||||
index 0000000..34cf97c
|
||||
--- /dev/null
|
||||
+++ b/src/alt/logging_libqb.c
|
||||
@@ -0,0 +1,84 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2016 Jan Pokorny <jpokorny@redhat.com>
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU General Public
|
||||
+ * License as published by the Free Software Foundation; either
|
||||
+ * version 2.1 of the License, or (at your option) any later version.
|
||||
+ *
|
||||
+ * This software 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. See the GNU
|
||||
+ * General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public
|
||||
+ * License along with this library; if not, write to the Free Software
|
||||
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
+ */
|
||||
+
|
||||
+#include <stdint.h>
|
||||
+#include <stdlib.h>
|
||||
+
|
||||
+#include <qb/qblog.h>
|
||||
+
|
||||
+#include "logging_libqb.h"
|
||||
+
|
||||
+int debug_level = 0;
|
||||
+
|
||||
+/* ENV_X definitions based on glue/lib/clplumbing/cl_log.c of glue project:
|
||||
+ http://hg.linux-ha.org/glue */
|
||||
+#define ENV_HADEBUGVAL "HA_debug"
|
||||
+#define ENV_LOGFENV "HA_logfile" /* well-formed log file :-) */
|
||||
+#define ENV_DEBUGFENV "HA_debugfile" /* Debug log file */
|
||||
+#define ENV_LOGFACILITY "HA_logfacility"/* Facility to use for logger */
|
||||
+#define ENV_SYSLOGFMT "HA_syslogmsgfmt"/* TRUE if we should use syslog message formatting */
|
||||
+
|
||||
+void
|
||||
+alt_qb_inherit_logging_environment(void)
|
||||
+{
|
||||
+ char *inherit_env;
|
||||
+
|
||||
+ /* Don't need to free the return pointer from getenv */
|
||||
+ inherit_env = getenv(ENV_HADEBUGVAL);
|
||||
+ if (inherit_env != NULL && atoi(inherit_env) != 0 )
|
||||
+ debug_level = atoi(inherit_env);
|
||||
+
|
||||
+ inherit_env = getenv(ENV_LOGFENV);
|
||||
+ if (inherit_env != NULL && *inherit_env != '\0') {
|
||||
+ int32_t log_fd = qb_log_file_open(inherit_env);
|
||||
+ qb_log_ctl(log_fd, QB_LOG_CONF_ENABLED, QB_TRUE);
|
||||
+ /* do not log debug info even if debug_level non-zero */
|
||||
+ qb_log_filter_ctl(log_fd, QB_LOG_FILTER_ADD,
|
||||
+ QB_LOG_FILTER_FILE, "*", LOG_INFO);
|
||||
+ }
|
||||
+
|
||||
+ inherit_env = getenv(ENV_DEBUGFENV);
|
||||
+ if (inherit_env != NULL && *inherit_env != '\0') {
|
||||
+ int32_t log_fd = qb_log_file_open(inherit_env);
|
||||
+ qb_log_ctl(log_fd, QB_LOG_CONF_ENABLED, QB_TRUE);
|
||||
+ }
|
||||
+
|
||||
+ inherit_env = getenv(ENV_LOGFACILITY);
|
||||
+ if (inherit_env != NULL && *inherit_env != '\0') {
|
||||
+ int fac = qb_log_facility2int(inherit_env);
|
||||
+ if (fac > 0)
|
||||
+ qb_log_ctl(QB_LOG_SYSLOG, QB_LOG_CONF_FACILITY, fac);
|
||||
+ else
|
||||
+ qb_log_ctl(QB_LOG_SYSLOG, QB_LOG_CONF_ENABLED, QB_FALSE);
|
||||
+ }
|
||||
+
|
||||
+ inherit_env = getenv(ENV_SYSLOGFMT);
|
||||
+ if (inherit_env != NULL && *inherit_env != '\0'
|
||||
+ && ( !strcasecmp(inherit_env, "false")
|
||||
+ || !strcasecmp(inherit_env, "off")
|
||||
+ || !strcasecmp(inherit_env, "no")
|
||||
+ || !strcasecmp(inherit_env, "n")
|
||||
+ || !strcasecmp(inherit_env, "0"))){
|
||||
+ enum qb_log_target_slot i;
|
||||
+ for (i = QB_LOG_TARGET_START; i < QB_LOG_TARGET_MAX; i++) {
|
||||
+ if (i == QB_LOG_SYSLOG || i == QB_LOG_BLACKBOX)
|
||||
+ continue;
|
||||
+ qb_log_format_set(i, NULL);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/alt/logging_libqb.h b/src/alt/logging_libqb.h
|
||||
new file mode 100644
|
||||
index 0000000..76592d4
|
||||
--- /dev/null
|
||||
+++ b/src/alt/logging_libqb.h
|
||||
@@ -0,0 +1,70 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2016 Jan Pokorny <jpokorny@redhat.com>
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU General Public
|
||||
+ * License as published by the Free Software Foundation; either
|
||||
+ * version 2.1 of the License, or (at your option) any later version.
|
||||
+ *
|
||||
+ * This software 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. See the GNU
|
||||
+ * General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public
|
||||
+ * License along with this library; if not, write to the Free Software
|
||||
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
+ */
|
||||
+
|
||||
+#include <qb/qblog.h>
|
||||
+
|
||||
+#include "b_config.h"
|
||||
+
|
||||
+/* qb logging compat definitions */
|
||||
+#if (!defined LOGGING_LIBQB_MAJOR || (LOGGING_LIBQB_MAJOR < 1))
|
||||
+enum tmp_log_target_slot {
|
||||
+ TMP_LOG_SYSLOG = QB_LOG_SYSLOG,
|
||||
+ TMP_LOG_STDERR = QB_LOG_STDERR,
|
||||
+ TMP_LOG_BLACKBOX = QB_LOG_BLACKBOX,
|
||||
+ TMP_LOG_TARGET_MAX = QB_LOG_TARGET_MAX,
|
||||
+};
|
||||
+
|
||||
+#undef QB_LOG_SYSLOG
|
||||
+#undef QB_LOG_STDERR
|
||||
+#undef QB_LOG_BLACKBOX
|
||||
+#undef QB_LOG_TARGET_MAX
|
||||
+
|
||||
+enum qb_log_target_slot {
|
||||
+ QB_LOG_TARGET_START,
|
||||
+ QB_LOG_SYSLOG = TMP_LOG_SYSLOG,
|
||||
+ QB_LOG_STDERR = TMP_LOG_STDERR,
|
||||
+ QB_LOG_BLACKBOX = TMP_LOG_BLACKBOX,
|
||||
+ QB_LOG_TARGET_MAX = TMP_LOG_TARGET_MAX,
|
||||
+};
|
||||
+
|
||||
+#define QB_LOG_CTL2_S(a) (a)
|
||||
+#define qb_log_ctl2(t, s, a) ((void) 0)
|
||||
+#endif
|
||||
+
|
||||
+
|
||||
+#ifndef HA_LOG_FACILITY
|
||||
+/* based on glue/configure.ac of glue project: http://hg.linux-ha.org/glue */
|
||||
+#define HA_LOG_FACILITY LOG_DAEMON
|
||||
+#endif
|
||||
+
|
||||
+extern int debug_level;
|
||||
+#define ANYDEBUG (debug_level)
|
||||
+
|
||||
+void alt_qb_inherit_logging_environment(void);
|
||||
+
|
||||
+#define cl_log_set_entity(ent) \
|
||||
+ (void) qb_log_ctl2(QB_LOG_SYSLOG, QB_LOG_CONF_IDENT, QB_LOG_CTL2_S(ent))
|
||||
+
|
||||
+#define cl_log_enable_stderr(b) \
|
||||
+ (void) qb_log_ctl(QB_LOG_STDERR, QB_LOG_CONF_ENABLED, b ? QB_TRUE : QB_FALSE)
|
||||
+
|
||||
+#define cl_log_set_facility(f) \
|
||||
+ (void) qb_log_ctl(QB_LOG_SYSLOG, QB_LOG_CONF_FACILITY, f)
|
||||
+
|
||||
+#define cl_inherit_logging_environment(logqueuemax) \
|
||||
+ alt_qb_inherit_logging_environment()
|
||||
diff --git a/src/log.h b/src/log.h
|
||||
index 0be4066..e570a8d 100644
|
||||
--- a/src/log.h
|
||||
+++ b/src/log.h
|
||||
@@ -21,26 +21,36 @@
|
||||
#ifndef _LOG_H
|
||||
#define _LOG_H
|
||||
|
||||
+#include "b_config.h"
|
||||
+
|
||||
+#ifndef LOGGING_LIBQB
|
||||
#include <heartbeat/glue_config.h>
|
||||
#include <clplumbing/cl_log.h>
|
||||
+#define priv_log(prio, ...) cl_log(prio, __VA_ARGS__)
|
||||
+#else
|
||||
+#include "alt/logging_libqb.h"
|
||||
+#define priv_log(prio, ...) qb_log(prio, __VA_ARGS__)
|
||||
+#endif
|
||||
+
|
||||
#include "inline-fn.h"
|
||||
|
||||
+
|
||||
#define log_debug(fmt, args...) do { \
|
||||
- if (ANYDEBUG) cl_log(LOG_DEBUG, fmt, ##args); } \
|
||||
+ if (ANYDEBUG) priv_log(LOG_DEBUG, fmt, ##args); } \
|
||||
while (0)
|
||||
-#define log_info(fmt, args...) cl_log(LOG_INFO, fmt, ##args)
|
||||
-#define log_warn(fmt, args...) cl_log(LOG_WARNING, fmt, ##args)
|
||||
-#define log_error(fmt, args...) cl_log(LOG_ERR, fmt, ##args)
|
||||
+#define log_info(fmt, args...) priv_log(LOG_INFO, fmt, ##args)
|
||||
+#define log_warn(fmt, args...) priv_log(LOG_WARNING, fmt, ##args)
|
||||
+#define log_error(fmt, args...) priv_log(LOG_ERR, fmt, ##args)
|
||||
|
||||
/* all tk_* macros prepend "%(tk->name): " (the caller needs to
|
||||
* have the ticket named tk!)
|
||||
*/
|
||||
#define tk_cl_log(sev, fmt, args...) \
|
||||
- cl_log(sev, "%s (%s/%d/%d): " fmt, \
|
||||
+ priv_log(sev, "%s (%s/%d/%d): " fmt, \
|
||||
tk->name, state_to_string(tk->state), tk->current_term, term_time_left(tk), \
|
||||
##args)
|
||||
#define tk_cl_log_src(sev, fmt, args...) \
|
||||
- cl_log(sev, "%s:%d: %s (%s/%d/%d): " fmt, \
|
||||
+ priv_log(sev, "%s:%d: %s (%s/%d/%d): " fmt, \
|
||||
__FUNCTION__, __LINE__, \
|
||||
tk->name, state_to_string(tk->state), tk->current_term, term_time_left(tk), \
|
||||
##args)
|
||||
diff --git a/src/main.c b/src/main.c
|
||||
index c377392..498718b 100644
|
||||
--- a/src/main.c
|
||||
+++ b/src/main.c
|
||||
@@ -1536,6 +1536,9 @@ int main(int argc, char *argv[], char *envp[])
|
||||
{
|
||||
int rv;
|
||||
const char *cp;
|
||||
+#ifdef LOGGING_LIBQB
|
||||
+ enum qb_log_target_slot i;
|
||||
+#endif
|
||||
|
||||
init_set_proc_title(argc, argv, envp);
|
||||
get_time(&start_time);
|
||||
@@ -1546,15 +1549,25 @@ int main(int argc, char *argv[], char *envp[])
|
||||
cl.lockfile[0] = 0;
|
||||
debug_level = 0;
|
||||
|
||||
- cl_log_set_entity(
|
||||
- (cp = strstr(argv[0], ATTR_PROG)) && !strcmp(cp, ATTR_PROG)
|
||||
+
|
||||
+ cp = ((cp = strstr(argv[0], ATTR_PROG)) && !strcmp(cp, ATTR_PROG)
|
||||
? ATTR_PROG
|
||||
- : "booth"
|
||||
- );
|
||||
+ : "booth");
|
||||
+#ifndef LOGGING_LIBQB
|
||||
+ cl_log_set_entity(cp);
|
||||
+#else
|
||||
+ qb_log_init(cp, LOG_USER, LOG_DEBUG); /* prio driven by debug_level */
|
||||
+ for (i = QB_LOG_TARGET_START; i < QB_LOG_TARGET_MAX; i++) {
|
||||
+ if (i == QB_LOG_SYSLOG || i == QB_LOG_BLACKBOX)
|
||||
+ continue;
|
||||
+ qb_log_format_set(i, "%t %H %N: [%P]: %p: %b");
|
||||
+ }
|
||||
+ (void) qb_log_filter_ctl(QB_LOG_STDERR, QB_LOG_FILTER_ADD,
|
||||
+ QB_LOG_FILTER_FILE, "*", LOG_DEBUG);
|
||||
+#endif
|
||||
cl_log_enable_stderr(TRUE);
|
||||
cl_log_set_facility(0);
|
||||
|
||||
-
|
||||
rv = read_arguments(argc, argv);
|
||||
if (rv < 0)
|
||||
goto out;
|
||||
@@ -1581,6 +1594,9 @@ int main(int argc, char *argv[], char *envp[])
|
||||
}
|
||||
|
||||
out:
|
||||
+#ifdef LOGGING_LIBQB
|
||||
+ qb_log_fini();
|
||||
+#endif
|
||||
/* Normalize values. 0x100 would be seen as "OK" by waitpid(). */
|
||||
return (rv >= 0 && rv < 0x70) ? rv : 1;
|
||||
}
|
||||
--
|
||||
2.4.11
|
||||
|
||||
|
|
@ -1,179 +0,0 @@
|
|||
From cd8c7245e4f50269ec62b36cb56ef21e659c7578 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jan=20Pokorn=C3=BD?= <jpokorny@redhat.com>
|
||||
Date: Wed, 24 Feb 2016 02:12:34 +0100
|
||||
Subject: [PATCH 3/6] Feature: alternative range2random provider: glib
|
||||
|
||||
Also check if cl_rand_from_interval is actually defined in
|
||||
<clplumbing/cl_random.h> (not the case with older glue/plumb lib).
|
||||
---
|
||||
booth.spec | 2 ++
|
||||
configure.ac | 24 ++++++++++++++++++++++++
|
||||
src/Makefile.am | 8 ++++++++
|
||||
src/alt/range2random_glib.c | 33 +++++++++++++++++++++++++++++++++
|
||||
src/alt/range2random_glib.h | 22 ++++++++++++++++++++++
|
||||
src/ticket.c | 6 +++++-
|
||||
6 files changed, 94 insertions(+), 1 deletion(-)
|
||||
create mode 100644 src/alt/range2random_glib.c
|
||||
create mode 100644 src/alt/range2random_glib.h
|
||||
|
||||
diff --git a/booth.spec b/booth.spec
|
||||
index cc73af2..b88ff4c 100644
|
||||
--- a/booth.spec
|
||||
+++ b/booth.spec
|
||||
@@ -69,6 +69,8 @@ BuildRequires: libglue-devel
|
||||
%else
|
||||
# logging provider
|
||||
BuildRequires: pkgconfig(libqb)
|
||||
+# random2range provider
|
||||
+BuildRequires: pkgconfig(glib-2.0)
|
||||
%endif
|
||||
BuildRequires: libxml2-devel
|
||||
BuildRequires: zlib-devel
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 32a7dd1..10e131d 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -245,6 +245,29 @@ libqb)
|
||||
esac
|
||||
AM_CONDITIONAL([LOGGING_LIBQB], [test "x$logging_provider" = "xlibqb"])
|
||||
|
||||
+# figure out range2random provider
|
||||
+range2random_provider=""
|
||||
+if test "x$range2random_provider" = "x" && test "x$with_glue" = "xyes"; then
|
||||
+ AC_CHECK_LIB([plumb], [get_next_random], [range2random_provider="libplumb"])
|
||||
+ AC_CHECK_DECL([cl_rand_from_interval], [], [range2random_provider=""],
|
||||
+ [#include <clplumbing/cl_random.h>])
|
||||
+fi
|
||||
+if test "x$range2random_provider" = "x" && test "x$with_glue" = "xno"; then
|
||||
+ AC_CHECK_LIB([glib-2.0], [g_random_int_range], [range2random_provider="glib"])
|
||||
+fi
|
||||
+case "$range2random_provider" in
|
||||
+libplumb)
|
||||
+ ;;
|
||||
+glib)
|
||||
+ PKG_CHECK_MODULES([GLIB], [glib-2.0])
|
||||
+ AC_DEFINE([RANGE2RANDOM_GLIB], [], [use glib as a range2random provider])
|
||||
+ ;;
|
||||
+*)
|
||||
+ AC_MSG_ERROR([range2random provider required (libplumb, or glib when --without-glue)])
|
||||
+ ;;
|
||||
+esac
|
||||
+AM_CONDITIONAL([RANGE2RANDOM_GLIB], [test "x$range2random_provider" = "xglib"])
|
||||
+
|
||||
# OS detection
|
||||
# THIS SECTION MUST DIE!
|
||||
CP=cp
|
||||
@@ -474,6 +497,7 @@ AC_MSG_RESULT([ booth config dir = ${BOOTHSYSCONFDIR}])
|
||||
AC_MSG_RESULT([ SOCKETDIR = ${SOCKETDIR}])
|
||||
AC_MSG_RESULT([ Features = ${PACKAGE_FEATURES}])
|
||||
AC_MSG_RESULT([ Logging provider = ${logging_provider}])
|
||||
+AC_MSG_RESULT([ Range2random provider = ${range2random_provider}])
|
||||
AC_MSG_RESULT([])
|
||||
AC_MSG_RESULT([$PACKAGE build info:])
|
||||
AC_MSG_RESULT([ Library SONAME = ${SONAME}])
|
||||
diff --git a/src/Makefile.am b/src/Makefile.am
|
||||
index 49c3ac4..317710e 100644
|
||||
--- a/src/Makefile.am
|
||||
+++ b/src/Makefile.am
|
||||
@@ -33,5 +33,13 @@ boothd_SOURCES += alt/logging_libqb.c
|
||||
noinst_HEADERS += alt/logging_libqb.h
|
||||
endif
|
||||
|
||||
+if !RANGE2RANDOM_GLIB
|
||||
+boothd_LDADD += -lplumb
|
||||
+else
|
||||
+boothd_LDADD += $(GLIB_LIBS)
|
||||
+boothd_SOURCES += alt/range2random_glib.c
|
||||
+noinst_HEADERS += alt/range2random_glib.h
|
||||
+endif
|
||||
+
|
||||
lint:
|
||||
-splint $(INCLUDES) $(LINT_FLAGS) $(CFLAGS) *.c
|
||||
diff --git a/src/alt/range2random_glib.c b/src/alt/range2random_glib.c
|
||||
new file mode 100644
|
||||
index 0000000..8363559
|
||||
--- /dev/null
|
||||
+++ b/src/alt/range2random_glib.c
|
||||
@@ -0,0 +1,33 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2016 Jan Pokorny <jpokorny@redhat.com>
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU General Public
|
||||
+ * License as published by the Free Software Foundation; either
|
||||
+ * version 2.1 of the License, or (at your option) any later version.
|
||||
+ *
|
||||
+ * This software 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. See the GNU
|
||||
+ * General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public
|
||||
+ * License along with this library; if not, write to the Free Software
|
||||
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
+ */
|
||||
+
|
||||
+#include <assert.h>
|
||||
+#include <stdlib.h>
|
||||
+
|
||||
+#include <glib.h>
|
||||
+
|
||||
+#include "range2random_glib.h"
|
||||
+#include "ticket.h"
|
||||
+
|
||||
+int
|
||||
+alt_glib_rand_from_interval(int from, int to)
|
||||
+{
|
||||
+ assert(from >= 0 && from < to);
|
||||
+ assert(sizeof(to) <= sizeof(gint32) || (to < 0x7fffffff));
|
||||
+ return (int) g_random_int_range(from, to);
|
||||
+}
|
||||
diff --git a/src/alt/range2random_glib.h b/src/alt/range2random_glib.h
|
||||
new file mode 100644
|
||||
index 0000000..4b87c46
|
||||
--- /dev/null
|
||||
+++ b/src/alt/range2random_glib.h
|
||||
@@ -0,0 +1,22 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2016 Jan Pokorny <jpokorny@redhat.com>
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU General Public
|
||||
+ * License as published by the Free Software Foundation; either
|
||||
+ * version 2.1 of the License, or (at your option) any later version.
|
||||
+ *
|
||||
+ * This software 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. See the GNU
|
||||
+ * General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public
|
||||
+ * License along with this library; if not, write to the Free Software
|
||||
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
+ */
|
||||
+
|
||||
+int alt_glib_rand_from_interval(int from, int to);
|
||||
+
|
||||
+#define cl_rand_from_interval(from, to) \
|
||||
+ alt_glib_rand_from_interval(from, to)
|
||||
diff --git a/src/ticket.c b/src/ticket.c
|
||||
index 09743f7..8d4cc12 100644
|
||||
--- a/src/ticket.c
|
||||
+++ b/src/ticket.c
|
||||
@@ -25,8 +25,12 @@
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <time.h>
|
||||
-#include <clplumbing/cl_random.h>
|
||||
#include "b_config.h"
|
||||
+#ifndef RANGE2RANDOM_GLIB
|
||||
+#include <clplumbing/cl_random.h>
|
||||
+#else
|
||||
+#include "alt/range2random_glib.h"
|
||||
+#endif
|
||||
#include "ticket.h"
|
||||
#include "config.h"
|
||||
#include "pacemaker.h"
|
||||
--
|
||||
2.4.11
|
||||
|
||||
|
|
@ -1,239 +0,0 @@
|
|||
From 6b9e9cd87e41bc07cfbfd5a607a739cfebb2e2ac Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jan=20Pokorn=C3=BD?= <jpokorny@redhat.com>
|
||||
Date: Wed, 24 Feb 2016 02:15:47 +0100
|
||||
Subject: [PATCH 4/6] Feature: alternative "nametag" provider: libsystemd
|
||||
|
||||
---
|
||||
booth.spec | 2 ++
|
||||
configure.ac | 22 ++++++++++++
|
||||
src/Makefile.am | 10 +++++-
|
||||
src/alt/nametag_libsystemd.c | 81 ++++++++++++++++++++++++++++++++++++++++++++
|
||||
src/alt/nametag_libsystemd.h | 23 +++++++++++++
|
||||
src/main.c | 6 +++-
|
||||
6 files changed, 142 insertions(+), 2 deletions(-)
|
||||
create mode 100644 src/alt/nametag_libsystemd.c
|
||||
create mode 100644 src/alt/nametag_libsystemd.h
|
||||
|
||||
diff --git a/booth.spec b/booth.spec
|
||||
index b88ff4c..18387f7 100644
|
||||
--- a/booth.spec
|
||||
+++ b/booth.spec
|
||||
@@ -71,6 +71,8 @@ BuildRequires: libglue-devel
|
||||
BuildRequires: pkgconfig(libqb)
|
||||
# random2range provider
|
||||
BuildRequires: pkgconfig(glib-2.0)
|
||||
+# nametag provider
|
||||
+BuildRequires: pkgconfig(libsystemd)
|
||||
%endif
|
||||
BuildRequires: libxml2-devel
|
||||
BuildRequires: zlib-devel
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 10e131d..bb2e3a8 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -268,6 +268,27 @@ glib)
|
||||
esac
|
||||
AM_CONDITIONAL([RANGE2RANDOM_GLIB], [test "x$range2random_provider" = "xglib"])
|
||||
|
||||
+# figure out nametag/distinguished-role provider
|
||||
+nametag_provider=""
|
||||
+if test "x$nametag_provider" = "x" && test "x$with_glue" != "xno"; then
|
||||
+ AC_CHECK_LIB([plumbgpl], [set_proc_title], [nametag_provider="libplumbgpl"])
|
||||
+fi
|
||||
+if test "x$nametag_provider" = "x" && test "x$with_glue" = "xno"; then
|
||||
+ AC_CHECK_LIB([systemd], [sd_notify], [nametag_provider="libsystemd"])
|
||||
+fi
|
||||
+case "$nametag_provider" in
|
||||
+libplumbgpl)
|
||||
+ ;;
|
||||
+libsystemd)
|
||||
+ PKG_CHECK_MODULES([LIBSYSTEMD], [libsystemd])
|
||||
+ AC_DEFINE([NAMETAG_LIBSYSTEMD], [], [use libsystemd as a nametag provider])
|
||||
+ ;;
|
||||
+*)
|
||||
+ AC_MSG_ERROR([nametag provider required (libplumbgpl, or libsystemd when --without-glue)])
|
||||
+ ;;
|
||||
+esac
|
||||
+AM_CONDITIONAL([NAMETAG_LIBSYSTEMD], [test "x$nametag_provider" = "xlibsystemd"])
|
||||
+
|
||||
# OS detection
|
||||
# THIS SECTION MUST DIE!
|
||||
CP=cp
|
||||
@@ -498,6 +519,7 @@ AC_MSG_RESULT([ SOCKETDIR = ${SOCKETDIR}])
|
||||
AC_MSG_RESULT([ Features = ${PACKAGE_FEATURES}])
|
||||
AC_MSG_RESULT([ Logging provider = ${logging_provider}])
|
||||
AC_MSG_RESULT([ Range2random provider = ${range2random_provider}])
|
||||
+AC_MSG_RESULT([ Nametag provider = ${nametag_provider}])
|
||||
AC_MSG_RESULT([])
|
||||
AC_MSG_RESULT([$PACKAGE build info:])
|
||||
AC_MSG_RESULT([ Library SONAME = ${SONAME}])
|
||||
diff --git a/src/Makefile.am b/src/Makefile.am
|
||||
index 317710e..69b7b48 100644
|
||||
--- a/src/Makefile.am
|
||||
+++ b/src/Makefile.am
|
||||
@@ -22,7 +22,7 @@ boothd_SOURCES += auth.c
|
||||
endif
|
||||
|
||||
boothd_LDFLAGS = $(OS_DYFLAGS) -L./
|
||||
-boothd_LDADD = -lplumb -lplumbgpl -lm $(GLIB_LIBS) $(ZLIB_LIBS)
|
||||
+boothd_LDADD = -lplumb -lm $(GLIB_LIBS) $(ZLIB_LIBS)
|
||||
boothd_CFLAGS = $(GLIB_CFLAGS)
|
||||
|
||||
if !LOGGING_LIBQB
|
||||
@@ -41,5 +41,13 @@ boothd_SOURCES += alt/range2random_glib.c
|
||||
noinst_HEADERS += alt/range2random_glib.h
|
||||
endif
|
||||
|
||||
+if !NAMETAG_LIBSYSTEMD
|
||||
+boothd_LDADD += -lplumbgpl
|
||||
+else
|
||||
+boothd_LDADD += $(LIBSYSTEMD_LIBS)
|
||||
+boothd_SOURCES += alt/nametag_libsystemd.c
|
||||
+noinst_HEADERS += alt/nametag_libsystemd.h
|
||||
+endif
|
||||
+
|
||||
lint:
|
||||
-splint $(INCLUDES) $(LINT_FLAGS) $(CFLAGS) *.c
|
||||
diff --git a/src/alt/nametag_libsystemd.c b/src/alt/nametag_libsystemd.c
|
||||
new file mode 100644
|
||||
index 0000000..1fb9ffa
|
||||
--- /dev/null
|
||||
+++ b/src/alt/nametag_libsystemd.c
|
||||
@@ -0,0 +1,81 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2016 Jan Pokorny <jpokorny@redhat.com>
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU General Public
|
||||
+ * License as published by the Free Software Foundation; either
|
||||
+ * version 2.1 of the License, or (at your option) any later version.
|
||||
+ *
|
||||
+ * This software 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. See the GNU
|
||||
+ * General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public
|
||||
+ * License along with this library; if not, write to the Free Software
|
||||
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
+ */
|
||||
+
|
||||
+#include <assert.h>
|
||||
+#include <ctype.h>
|
||||
+#include <stdarg.h>
|
||||
+#include <string.h>
|
||||
+
|
||||
+#include <systemd/sd-daemon.h>
|
||||
+
|
||||
+#include "nametag_libsystemd.h"
|
||||
+#include "booth.h"
|
||||
+#include "log.h"
|
||||
+#include "transport.h"
|
||||
+
|
||||
+/* assume first argument after "fmt" is for DAEMON_NAME, that is
|
||||
+ really not of interest in our "nametag" function based on
|
||||
+ sd_notify (that very data point is provided implicitly) */
|
||||
+void sd_notify_wrapper(const char *fmt, ...)
|
||||
+{
|
||||
+ /* assume that first %s in fmt is intended for DAEMON_NAME,
|
||||
+ i.e., for first argument following fmt in original
|
||||
+ set_proc_title invocation, which has already been dropped
|
||||
+ before it boils down here (using the wrapping macro trick);
|
||||
+ we now simply append the reset after that first %s
|
||||
+ (with whitespace stripped) to the "Running: " prefix */
|
||||
+ int rv;
|
||||
+ char buffer[255];
|
||||
+ char *fmt_iter;
|
||||
+ char *suffix = NULL;
|
||||
+ va_list ap;
|
||||
+
|
||||
+ switch (local->type) {
|
||||
+ case ARBITRATOR:
|
||||
+ case GEOSTORE:
|
||||
+ break;
|
||||
+ default:
|
||||
+ return; /* not expected to be run as system service */
|
||||
+ }
|
||||
+
|
||||
+ fmt_iter = strchr(fmt, '%');
|
||||
+ while (fmt_iter) {
|
||||
+ switch (*++fmt_iter) {
|
||||
+ case 's': suffix = fmt_iter;
|
||||
+ /* fall through */
|
||||
+ default: fmt_iter = NULL;
|
||||
+ }
|
||||
+ }
|
||||
+ if (!suffix) {
|
||||
+ log_warn("%s:%d: invalid format: %s", __FILE__, __LINE__, fmt);
|
||||
+ return;
|
||||
+ }
|
||||
+ while (isspace(*++suffix)) /* noop */ ;
|
||||
+
|
||||
+ va_start(ap, fmt);
|
||||
+ fmt_iter = va_arg(ap, char *); /* just shift by one */
|
||||
+ assert(!strcmp(fmt_iter, DAEMON_NAME));
|
||||
+ rv = vsnprintf(buffer, sizeof(buffer), suffix, ap);
|
||||
+ va_end(ap);
|
||||
+
|
||||
+ rv = sd_notifyf(0, "READY=1\n"
|
||||
+ "STATUS=Running: %s",
|
||||
+ buffer);
|
||||
+ if (rv < 0)
|
||||
+ log_warn("%s:%d: sd_notifyf fail", __FILE__, __LINE__);
|
||||
+}
|
||||
diff --git a/src/alt/nametag_libsystemd.h b/src/alt/nametag_libsystemd.h
|
||||
new file mode 100644
|
||||
index 0000000..2c1dc1e
|
||||
--- /dev/null
|
||||
+++ b/src/alt/nametag_libsystemd.h
|
||||
@@ -0,0 +1,23 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2016 Jan Pokorny <jpokorny@redhat.com>
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU General Public
|
||||
+ * License as published by the Free Software Foundation; either
|
||||
+ * version 2.1 of the License, or (at your option) any later version.
|
||||
+ *
|
||||
+ * This software 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. See the GNU
|
||||
+ * General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public
|
||||
+ * License along with this library; if not, write to the Free Software
|
||||
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
+ */
|
||||
+
|
||||
+void
|
||||
+sd_notify_wrapper(const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
|
||||
+
|
||||
+#define init_set_proc_title(c, a, e) /* omitted */
|
||||
+#define set_proc_title sd_notify_wrapper
|
||||
diff --git a/src/main.c b/src/main.c
|
||||
index 498718b..27d285c 100644
|
||||
--- a/src/main.c
|
||||
+++ b/src/main.c
|
||||
@@ -34,7 +34,6 @@
|
||||
#include <sys/poll.h>
|
||||
#include <sys/wait.h>
|
||||
#include <pacemaker/crm/services.h>
|
||||
-#include <clplumbing/setproctitle.h>
|
||||
#include <sys/prctl.h>
|
||||
#include <clplumbing/coredumps.h>
|
||||
#include <fcntl.h>
|
||||
@@ -49,6 +48,11 @@
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/types.h>
|
||||
#include "b_config.h"
|
||||
+#ifndef NAMETAG_LIBSYSTEMD
|
||||
+#include <clplumbing/setproctitle.h>
|
||||
+#else
|
||||
+#include "alt/nametag_libsystemd.h"
|
||||
+#endif
|
||||
#include "log.h"
|
||||
#include "booth.h"
|
||||
#include "config.h"
|
||||
--
|
||||
2.4.11
|
||||
|
||||
|
|
@ -1,115 +0,0 @@
|
|||
From b0eee73d593b0d8c884b01d5691857506f24daba Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jan=20Pokorn=C3=BD?= <jpokorny@redhat.com>
|
||||
Date: Tue, 26 Apr 2016 16:50:50 +0200
|
||||
Subject: [PATCH 5/6] Feature: allow skipping "coredump nursing" phase
|
||||
|
||||
This effectively eliminates the last dependency on glue libraries.
|
||||
---
|
||||
configure.ac | 11 +++++++++++
|
||||
src/Makefile.am | 6 +++++-
|
||||
src/main.c | 12 +++++++++---
|
||||
3 files changed, 25 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index bb2e3a8..cb4eeb1 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -289,6 +289,16 @@ libsystemd)
|
||||
esac
|
||||
AM_CONDITIONAL([NAMETAG_LIBSYSTEMD], [test "x$nametag_provider" = "xlibsystemd"])
|
||||
|
||||
+# figure out if "coredump nursing" supported and desired
|
||||
+coredump_nursing="no"
|
||||
+if test "x$with_glue" != "xno"; then
|
||||
+ AC_CHECK_LIB([plumb], [cl_enable_coredumps], [coredump_nursing="libplumb"])
|
||||
+fi
|
||||
+if test "x$coredump_nursing" != "xno"; then
|
||||
+ AC_DEFINE(COREDUMP_NURSING, [], [eligible for coredump nursing])
|
||||
+fi
|
||||
+AM_CONDITIONAL([COREDUMP_NURSING], [test "x$coredump_nursing" != "xno"])
|
||||
+
|
||||
# OS detection
|
||||
# THIS SECTION MUST DIE!
|
||||
CP=cp
|
||||
@@ -520,6 +530,7 @@ AC_MSG_RESULT([ Features = ${PACKAGE_FEATURES}])
|
||||
AC_MSG_RESULT([ Logging provider = ${logging_provider}])
|
||||
AC_MSG_RESULT([ Range2random provider = ${range2random_provider}])
|
||||
AC_MSG_RESULT([ Nametag provider = ${nametag_provider}])
|
||||
+AC_MSG_RESULT([ Coredump nursing = ${coredump_nursing}])
|
||||
AC_MSG_RESULT([])
|
||||
AC_MSG_RESULT([$PACKAGE build info:])
|
||||
AC_MSG_RESULT([ Library SONAME = ${SONAME}])
|
||||
diff --git a/src/Makefile.am b/src/Makefile.am
|
||||
index 69b7b48..2a985ae 100644
|
||||
--- a/src/Makefile.am
|
||||
+++ b/src/Makefile.am
|
||||
@@ -22,7 +22,7 @@ boothd_SOURCES += auth.c
|
||||
endif
|
||||
|
||||
boothd_LDFLAGS = $(OS_DYFLAGS) -L./
|
||||
-boothd_LDADD = -lplumb -lm $(GLIB_LIBS) $(ZLIB_LIBS)
|
||||
+boothd_LDADD = -lm $(GLIB_LIBS) $(ZLIB_LIBS)
|
||||
boothd_CFLAGS = $(GLIB_CFLAGS)
|
||||
|
||||
if !LOGGING_LIBQB
|
||||
@@ -49,5 +49,9 @@ boothd_SOURCES += alt/nametag_libsystemd.c
|
||||
noinst_HEADERS += alt/nametag_libsystemd.h
|
||||
endif
|
||||
|
||||
+if COREDUMP_NURSING
|
||||
+boothd_LDADD += -lplumb
|
||||
+endif
|
||||
+
|
||||
lint:
|
||||
-splint $(INCLUDES) $(LINT_FLAGS) $(CFLAGS) *.c
|
||||
diff --git a/src/main.c b/src/main.c
|
||||
index 27d285c..0693f18 100644
|
||||
--- a/src/main.c
|
||||
+++ b/src/main.c
|
||||
@@ -33,9 +33,6 @@
|
||||
#include <sys/un.h>
|
||||
#include <sys/poll.h>
|
||||
#include <sys/wait.h>
|
||||
-#include <pacemaker/crm/services.h>
|
||||
-#include <sys/prctl.h>
|
||||
-#include <clplumbing/coredumps.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
@@ -47,12 +44,19 @@
|
||||
#include <netdb.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/types.h>
|
||||
+
|
||||
+#include <pacemaker/crm/services.h>
|
||||
+
|
||||
#include "b_config.h"
|
||||
#ifndef NAMETAG_LIBSYSTEMD
|
||||
#include <clplumbing/setproctitle.h>
|
||||
#else
|
||||
#include "alt/nametag_libsystemd.h"
|
||||
#endif
|
||||
+#ifdef COREDUMP_NURSING
|
||||
+#include <sys/prctl.h>
|
||||
+#include <clplumbing/coredumps.h>
|
||||
+#endif
|
||||
#include "log.h"
|
||||
#include "booth.h"
|
||||
#include "config.h"
|
||||
@@ -1457,11 +1461,13 @@ static int do_server(int type)
|
||||
if (rv)
|
||||
return rv;
|
||||
|
||||
+#ifdef COREDUMP_NURSING
|
||||
if (cl_enable_coredumps(TRUE) < 0){
|
||||
log_error("enabling core dump failed");
|
||||
}
|
||||
cl_cdtocoredir();
|
||||
prctl(PR_SET_DUMPABLE, (unsigned long)TRUE, 0UL, 0UL, 0UL);
|
||||
+#endif
|
||||
|
||||
signal(SIGCHLD, (__sighandler_t)wait_child);
|
||||
rv = loop(lock_fd);
|
||||
--
|
||||
2.4.11
|
||||
|
||||
|
|
@ -1,202 +0,0 @@
|
|||
From 2531e70e3014ae80d1799478b1cd95aa2076a484 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jan=20Pokorn=C3=BD?= <jpokorny@redhat.com>
|
||||
Date: Wed, 2 Mar 2016 19:38:46 +0100
|
||||
Subject: [PATCH 6/6] Feature: alternative logger (in service-runnable script)
|
||||
|
||||
This effectively eliminates the last dependency on glue project as such.
|
||||
---
|
||||
Makefile.am | 2 +-
|
||||
configure.ac | 5 ++++
|
||||
script/service-runnable | 62 ----------------------------------------------
|
||||
script/service-runnable.in | 61 +++++++++++++++++++++++++++++++++++++++++++++
|
||||
4 files changed, 67 insertions(+), 63 deletions(-)
|
||||
delete mode 100755 script/service-runnable
|
||||
create mode 100755 script/service-runnable.in
|
||||
|
||||
diff --git a/Makefile.am b/Makefile.am
|
||||
index 5f360c4..076d461 100644
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -66,7 +66,7 @@ bootharbitrator_SCRIPTS = script/lsb/booth-arbitrator
|
||||
|
||||
boothnoarchdir = $(datadir)/$(PACKAGE_NAME)
|
||||
|
||||
-boothnoarch_SCRIPTS = script/service-runnable
|
||||
+nodist_boothnoarch_SCRIPTS = script/service-runnable
|
||||
|
||||
sbin_SCRIPTS = script/booth-keygen
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index cb4eeb1..f67c972 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -147,6 +147,8 @@ AC_CONFIG_FILES([Makefile
|
||||
src/Makefile
|
||||
docs/Makefile])
|
||||
|
||||
+AC_CONFIG_FILES([script/service-runnable], [chmod +x script/service-runnable])
|
||||
+
|
||||
# ===============================================
|
||||
# Helpers
|
||||
# ===============================================
|
||||
@@ -230,6 +232,7 @@ if test "x$logging_provider" = "x" && test "x$with_glue" = "xno"; then
|
||||
fi
|
||||
case "$logging_provider" in
|
||||
libplumb)
|
||||
+ LOGGER="ha_logger"
|
||||
;;
|
||||
libqb)
|
||||
PKG_CHECK_MODULES([LIBQB], [libqb])
|
||||
@@ -238,12 +241,14 @@ libqb)
|
||||
[AC_DEFINE([LOGGING_LIBQB_MAJOR], [1],
|
||||
[libqb major version lower bound])],
|
||||
[AC_MSG_WARN([[syslog identifier will not get changed]])])
|
||||
+ LOGGER="logger -t booth-script"
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([logging provider required (libplumb, or libqb when --without-glue)])
|
||||
;;
|
||||
esac
|
||||
AM_CONDITIONAL([LOGGING_LIBQB], [test "x$logging_provider" = "xlibqb"])
|
||||
+AC_SUBST([LOGGER])
|
||||
|
||||
# figure out range2random provider
|
||||
range2random_provider=""
|
||||
diff --git a/script/service-runnable b/script/service-runnable
|
||||
deleted file mode 100755
|
||||
index ed90c5e..0000000
|
||||
--- a/script/service-runnable
|
||||
+++ /dev/null
|
||||
@@ -1,62 +0,0 @@
|
||||
-#!/bin/bash
|
||||
-# This script is part of Booth.
|
||||
-# It checks whether the given resource (service) still has a chance
|
||||
-# to run on the local cluster, so that booth knows whether to
|
||||
-# acquire the ticket here.
|
||||
-
|
||||
-service="${1:?Need a resource name as first argument.}"
|
||||
-if [ -z "$service" ]; then
|
||||
- ha_logger "$0: bad usage: no resource name"
|
||||
- exit 1
|
||||
-fi
|
||||
-tmpshadow=`mktemp booth-check.XXXXXX`
|
||||
-if [ $? -ne 0 -o ! -f "$tmpshadow" ]; then
|
||||
- ha_logger "$0: mktemp failed"
|
||||
- exit 1
|
||||
-fi
|
||||
-
|
||||
-trap "rm -f $tmpshadow" EXIT
|
||||
-
|
||||
-
|
||||
-# We expect an output like
|
||||
-# p_dummy (ocf::pacemaker:Dummy): Started geo-rz2-a
|
||||
-
|
||||
-status=`crm_simulate -O $tmpshadow --ticket-grant "$BOOTH_TICKET" --simulate --live-check 2>&1`
|
||||
-if [ $? -ne 0 ]; then
|
||||
- ha_logger "$0: crm_simulate failed"
|
||||
- ha_logger "$0: crm_simulate: $status"
|
||||
- exit 1
|
||||
-fi
|
||||
-
|
||||
-if echo "$status" |
|
||||
- sed -n '/^Revised cluster status:/,$p' |
|
||||
- egrep "^[[:space:]]+$service[[:space:]]+\(.*\):[[:space:]]+Started ([^[:space:]]+) *$" >/dev/null
|
||||
-then
|
||||
- # can be started - we're done.
|
||||
- exit 0
|
||||
-fi
|
||||
-
|
||||
-# If target-role is Stopped, it judges with being stopped explicitly.
|
||||
-output=$(crm_resource --meta --get-parameter="target-role" --resource=$service 2>/dev/null)
|
||||
-rc=$?
|
||||
-if [ $rc -eq 0 -a "$output" = "Stopped" ]; then
|
||||
- exit 0
|
||||
-fi
|
||||
-
|
||||
-# is ticket in standby?
|
||||
-output=$(crm_ticket --ticket "$BOOTH_TICKET" --get-attr standby)
|
||||
-rc=$?
|
||||
-if [ $rc -eq 0 -a "$output" = true ]; then
|
||||
- exit 0
|
||||
-fi
|
||||
-
|
||||
-# Some error occured.
|
||||
-# Try to help the admin with a bit of diagnostic.
|
||||
-#
|
||||
-# disallow ms-resources, ie. only primitives wanted here
|
||||
-if ! crm_resource -l | grep -v ":" | grep "$service" ; then
|
||||
- ha_logger "Defined resource '$service' in $BOOTH_CONF_PATH is not a primitive??"
|
||||
-fi
|
||||
-
|
||||
-exit 1
|
||||
-
|
||||
diff --git a/script/service-runnable.in b/script/service-runnable.in
|
||||
new file mode 100755
|
||||
index 0000000..9ea33d4
|
||||
--- /dev/null
|
||||
+++ b/script/service-runnable.in
|
||||
@@ -0,0 +1,61 @@
|
||||
+#!/bin/bash
|
||||
+# This script is part of Booth.
|
||||
+# It checks whether the given resource (service) still has a chance
|
||||
+# to run on the local cluster, so that booth knows whether to
|
||||
+# acquire the ticket here.
|
||||
+
|
||||
+service="${1:?Need a resource name as first argument.}"
|
||||
+if [ -z "$service" ]; then
|
||||
+ @LOGGER@ "$0: bad usage: no resource name"
|
||||
+ exit 1
|
||||
+fi
|
||||
+tmpshadow=`mktemp booth-check.XXXXXX`
|
||||
+if [ $? -ne 0 -o ! -f "$tmpshadow" ]; then
|
||||
+ @LOGGER@ "$0: mktemp failed"
|
||||
+ exit 1
|
||||
+fi
|
||||
+
|
||||
+trap "rm -f $tmpshadow" EXIT
|
||||
+
|
||||
+
|
||||
+# We expect an output like
|
||||
+# p_dummy (ocf::pacemaker:Dummy): Started geo-rz2-a
|
||||
+
|
||||
+status=`crm_simulate -O $tmpshadow --ticket-grant "$BOOTH_TICKET" --simulate --live-check 2>&1`
|
||||
+if [ $? -ne 0 ]; then
|
||||
+ @LOGGER@ "$0: crm_simulate failed"
|
||||
+ @LOGGER@ "$0: crm_simulate: $status"
|
||||
+ exit 1
|
||||
+fi
|
||||
+
|
||||
+if echo "$status" |
|
||||
+ sed -n '/^Revised cluster status:/,$p' |
|
||||
+ egrep "^[[:space:]]+$service[[:space:]]+\(.*\):[[:space:]]+Started ([^[:space:]]+) *$" >/dev/null
|
||||
+then
|
||||
+ # can be started - we're done.
|
||||
+ exit 0
|
||||
+fi
|
||||
+
|
||||
+# If target-role is Stopped, it judges with being stopped explicitly.
|
||||
+output=$(crm_resource --meta --get-parameter="target-role" --resource=$service 2>/dev/null)
|
||||
+rc=$?
|
||||
+if [ $rc -eq 0 -a "$output" = "Stopped" ]; then
|
||||
+ exit 0
|
||||
+fi
|
||||
+
|
||||
+# is ticket in standby?
|
||||
+output=$(crm_ticket --ticket "$BOOTH_TICKET" --get-attr standby)
|
||||
+rc=$?
|
||||
+if [ $rc -eq 0 -a "$output" = true ]; then
|
||||
+ exit 0
|
||||
+fi
|
||||
+
|
||||
+# Some error occured.
|
||||
+# Try to help the admin with a bit of diagnostic.
|
||||
+#
|
||||
+# disallow ms-resources, ie. only primitives wanted here
|
||||
+if ! crm_resource -l | grep -v ":" | grep "$service" ; then
|
||||
+ @LOGGER@ "Defined resource '$service' in $BOOTH_CONF_PATH is not a primitive??"
|
||||
+fi
|
||||
+
|
||||
+exit 1
|
||||
--
|
||||
2.4.11
|
||||
|
||||
27
booth.rpmlintrc
Normal file
27
booth.rpmlintrc
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
# no-documentation is fine for booth-arbitrator and booth (virtual package) and debug packages
|
||||
addFilter(r'booth-arbitrator\.[^:]+: W: no-documentation')
|
||||
addFilter(r'booth\.[^:]+: W: no-documentation')
|
||||
addFilter(r'booth-debugsource\.[^:]+: W: no-documentation')
|
||||
|
||||
# permissions for chroot
|
||||
addFilter(r'booth-core\.[^:]+: (E|W): non-standard-dir-perm /var/lib/booth 750')
|
||||
addFilter(r'booth-core\.[^:]+: (E|W): non-standard-dir-perm /var/lib/booth/cores 750')
|
||||
|
||||
# booth is just metapackage
|
||||
addFilter(r'booth\.[^:]+: (W|E): no-binary')
|
||||
|
||||
# pc should be in devel but it is not really devel file
|
||||
addFilter(r'booth\.[^:]+: W: devel-file-in-non-devel-package /usr/share/pkgconfig/booth.pc')
|
||||
|
||||
# booth-(site|test) installs just scripts in /usr/lib
|
||||
addFilter(r'booth-(site|test)\.[^:]+: (W|E): only-non-binary-in-usr-lib')
|
||||
|
||||
# dangling symlink is ok for geostore and boothd (they actually points to booth binary)
|
||||
addFilter(r'booth-site\.[^:]+: (W|E): dangling-symlink /usr/sbin/geostore /usr/sbin/boothd')
|
||||
addFilter(r'booth-test\.[^:]+: (W|E): dangling-symlink /usr/share/booth/tests/src/boothd /usr/sbin/boothd')
|
||||
|
||||
# Ignore all errors in debuginfo packages
|
||||
addFilter(r'booth-core-debuginfo\.[^:]+: (W|E):')
|
||||
|
||||
# booth-arbitrator contains just unit files
|
||||
addFilter(r'booth-arbitrator\.[^:]+: (W|E): only-non-binary-in-usr-lib')
|
||||
297
booth.spec
297
booth.spec
|
|
@ -21,31 +21,17 @@
|
|||
|
||||
%bcond_with html_man
|
||||
%bcond_with glue
|
||||
%bcond_with run_build_tests
|
||||
|
||||
## User and group to use for nonprivileged services (should be in sync with pacemaker)
|
||||
%global uname hacluster
|
||||
%global gname haclient
|
||||
|
||||
# Disable automatic compilation of Python files in extra directories
|
||||
%global _python_bytecompile_extra 0
|
||||
|
||||
%global specver 2
|
||||
%global boothver 1.0
|
||||
# set following to the actual commit or, for final release, concatenate
|
||||
# "boothver" macro to "v" (will yield a tag per the convention)
|
||||
%global commit 570876d74c47a93bcdededd1c192a13610eb1d18
|
||||
%global lparen (
|
||||
%global rparen )
|
||||
%global shortcommit %(c=%{commit}; case ${c} in
|
||||
v*%{rparen} echo ${c:1};;
|
||||
*%{rparen} echo ${c:0:7};; esac)
|
||||
%global pre_release %(s=%{shortcommit}; [ ${s: -3:2} != rc ]; echo $?)
|
||||
%global post_release %([ %{commit} = v%{shortcommit} ]; echo $?)
|
||||
%global github_owner ClusterLabs
|
||||
|
||||
%if 0%{pre_release}
|
||||
%global boothrel 0.%{specver}.%(s=%{shortcommit}; echo ${s: -3})
|
||||
%else
|
||||
%if 0%{post_release}
|
||||
%global boothrel %{specver}.%{shortcommit}.git
|
||||
%else
|
||||
%global boothrel %{specver}
|
||||
%endif
|
||||
%endif
|
||||
|
||||
%{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{name}}
|
||||
# https://fedoraproject.org/wiki/EPEL:Packaging?rd=Packaging:EPEL#The_.25license_tag
|
||||
%{!?_licensedir:%global license %doc}
|
||||
|
|
@ -53,19 +39,12 @@
|
|||
%global test_path %{_datadir}/booth/tests
|
||||
|
||||
Name: booth
|
||||
Version: %{boothver}
|
||||
Release: %{boothrel}%{dist}.2
|
||||
Version: 1.2
|
||||
Release: 6%{?dist}
|
||||
Summary: Ticket Manager for Multi-site Clusters
|
||||
Group: System Environment/Daemons
|
||||
License: GPLv2+
|
||||
License: GPL-2.0-or-later
|
||||
Url: https://github.com/%{github_owner}/%{name}
|
||||
Source0: https://github.com/%{github_owner}/%{name}/archive/%{commit}/%{name}-%{shortcommit}.tar.gz
|
||||
Patch0: 0001-Feature-offer-alternatives-to-libraries-from-cluster.patch
|
||||
Patch1: 0002-Feature-alternative-logging-provider-libqb.patch
|
||||
Patch2: 0003-Feature-alternative-range2random-provider-glib.patch
|
||||
Patch3: 0004-Feature-alternative-nametag-provider-libsystemd.patch
|
||||
Patch4: 0005-Feature-allow-skipping-coredump-nursing-phase.patch
|
||||
Patch5: 0006-Feature-alternative-logger-in-service-runnable-scrip.patch
|
||||
Source0: https://github.com/%{github_owner}/%{name}/releases/download/v%{version}/%{name}-%{version}.tar.gz
|
||||
|
||||
# direct build process dependencies
|
||||
BuildRequires: autoconf
|
||||
|
|
@ -75,11 +54,11 @@ BuildRequires: make
|
|||
## ./autogen.sh
|
||||
BuildRequires: /bin/sh
|
||||
# general build dependencies
|
||||
BuildRequires: asciidoc
|
||||
BuildRequires: asciidoctor
|
||||
BuildRequires: gcc
|
||||
BuildRequires: pkgconfig
|
||||
# linking dependencies
|
||||
BuildRequires: libgcrypt-devel
|
||||
BuildRequires: gnutls-devel
|
||||
BuildRequires: libxml2-devel
|
||||
## just for <pacemaker/crm/services.h> include
|
||||
BuildRequires: pacemaker-libs-devel
|
||||
|
|
@ -93,12 +72,18 @@ BuildRequires: pkgconfig(glib-2.0)
|
|||
BuildRequires: pkgconfig(libsystemd)
|
||||
# check scriptlet (for hostname and killall respectively)
|
||||
BuildRequires: hostname psmisc
|
||||
BuildRequires: python2-devel
|
||||
BuildRequires: python3-devel
|
||||
# For generating tests
|
||||
BuildRequires: sed
|
||||
# spec file specifics
|
||||
## for _unitdir, systemd_requires and specific scriptlet macros
|
||||
BuildRequires: systemd
|
||||
## for autosetup
|
||||
BuildRequires: git
|
||||
%if 0%{?with_run_build_tests}
|
||||
# check scriptlet (for perl and ss)
|
||||
BuildRequires: perl-interpreter iproute
|
||||
%endif
|
||||
|
||||
# this is for a composite-requiring-its-components arranged
|
||||
# as an empty package (empty files section) requiring subpackages
|
||||
|
|
@ -106,7 +91,9 @@ BuildRequires: git
|
|||
Requires: %{name}-core%{?_isa}
|
||||
Requires: %{name}-site
|
||||
%files
|
||||
# intentionally empty
|
||||
%license COPYING
|
||||
%dir %{_datadir}/pkgconfig
|
||||
%{_datadir}/pkgconfig/booth.pc
|
||||
|
||||
%description
|
||||
Booth manages tickets which authorize cluster sites located
|
||||
|
|
@ -118,7 +105,6 @@ clustering in Pacemaker.
|
|||
|
||||
%package core
|
||||
Summary: Booth core files (executables, etc.)
|
||||
Group: System Environment/Daemons
|
||||
# for booth-keygen (chown, dd)
|
||||
Requires: coreutils
|
||||
# deal with pre-split arrangement
|
||||
|
|
@ -130,7 +116,6 @@ multi-site clusters.
|
|||
|
||||
%package arbitrator
|
||||
Summary: Booth support for running as an arbitrator
|
||||
Group: System Environment/Daemons
|
||||
BuildArch: noarch
|
||||
Requires: %{name}-core = %{version}-%{release}
|
||||
%{?systemd_requires}
|
||||
|
|
@ -142,17 +127,16 @@ Support for running Booth, ticket manager for multi-site clusters,
|
|||
as an arbitrator.
|
||||
|
||||
%post arbitrator
|
||||
%systemd_post booth@.service booth-arbitrator.service
|
||||
%systemd_post booth-arbitrator.service
|
||||
|
||||
%preun arbitrator
|
||||
%systemd_preun booth@.service booth-arbitrator.service
|
||||
%systemd_preun booth-arbitrator.service
|
||||
|
||||
%postun arbitrator
|
||||
%systemd_postun_with_restart booth@.service booth-arbitrator.service
|
||||
%systemd_postun_with_restart booth-arbitrator.service
|
||||
|
||||
%package site
|
||||
Summary: Booth support for running as a full-fledged site
|
||||
Group: System Environment/Daemons
|
||||
BuildArch: noarch
|
||||
Requires: %{name}-core = %{version}-%{release}
|
||||
# for crm_{resource,simulate,ticket} utilities
|
||||
|
|
@ -168,17 +152,19 @@ as a full-fledged site.
|
|||
|
||||
%package test
|
||||
Summary: Test scripts for Booth
|
||||
Group: System Environment/Daemons
|
||||
BuildArch: noarch
|
||||
# runtests.py suite (for hostname and killall respectively)
|
||||
Requires: hostname psmisc
|
||||
Requires: python(abi) < 3
|
||||
# any of the following internal dependencies will pull -core package
|
||||
## for booth@booth.service
|
||||
Requires: %{name}-arbitrator = %{version}-%{release}
|
||||
## for booth-site and service-runnable scripts
|
||||
## (and /usr/lib/ocf/resource.d/booth)
|
||||
Requires: %{name}-site = %{version}-%{release}
|
||||
Requires: gdb
|
||||
Requires: %{__python3}
|
||||
# runtests.py suite (for perl and ss)
|
||||
Requires: perl-interpreter iproute
|
||||
|
||||
%description test
|
||||
Automated tests for running Booth, ticket manager for multi-site clusters.
|
||||
|
|
@ -186,7 +172,7 @@ Automated tests for running Booth, ticket manager for multi-site clusters.
|
|||
# BUILD #
|
||||
|
||||
%prep
|
||||
%autosetup -n %{name}-%{commit} -S git
|
||||
%autosetup -n %{name}-%{version} -S git_am
|
||||
|
||||
%build
|
||||
./autogen.sh
|
||||
|
|
@ -194,8 +180,9 @@ Automated tests for running Booth, ticket manager for multi-site clusters.
|
|||
--with-initddir=%{_initrddir} \
|
||||
--docdir=%{_pkgdocdir} \
|
||||
--enable-user-flags \
|
||||
%{!?with_html_man:--without-html_man} \
|
||||
%{!?with_glue:--without-glue}
|
||||
%{?with_html_man:--with-html_man} \
|
||||
%{!?with_glue:--without-glue} \
|
||||
PYTHON=%{__python3}
|
||||
%{make_build}
|
||||
|
||||
%install
|
||||
|
|
@ -214,17 +201,35 @@ rm -rf %{buildroot}/%{_pkgdocdir}/README.upgrade-from-v0.1
|
|||
rm -rf %{buildroot}/%{_pkgdocdir}/COPYING
|
||||
# tests
|
||||
mkdir -p %{buildroot}/%{test_path}
|
||||
# Copy tests from tarball
|
||||
cp -a -t %{buildroot}/%{test_path} \
|
||||
-- conf test unit-tests script/unit-test.py
|
||||
-- conf test
|
||||
chmod +x %{buildroot}/%{test_path}/test/booth_path
|
||||
chmod +x %{buildroot}/%{test_path}/test/live_test.sh
|
||||
mkdir -p %{buildroot}/%{test_path}/src
|
||||
ln -s -t %{buildroot}/%{test_path}/src \
|
||||
-- %{_sbindir}/boothd
|
||||
# Generate runtests.py and boothtestenv.py
|
||||
sed -e 's#PYTHON_SHEBANG#%{__python3} -Es#g' \
|
||||
-e 's#TEST_SRC_DIR#%{test_path}/test#g' \
|
||||
-e 's#TEST_BUILD_DIR#%{test_path}/test#g' \
|
||||
%{buildroot}/%{test_path}/test/runtests.py.in > %{buildroot}/%{test_path}/test/runtests.py
|
||||
|
||||
chmod +x %{buildroot}/%{test_path}/test/runtests.py
|
||||
|
||||
sed -e 's#PYTHON_SHEBANG#%{__python3} -Es#g' \
|
||||
-e 's#TEST_SRC_DIR#%{test_path}/test#g' \
|
||||
-e 's#TEST_BUILD_DIR#%{test_path}/test#g' \
|
||||
%{buildroot}/%{test_path}/test/boothtestenv.py.in > %{buildroot}/%{test_path}/test/boothtestenv.py
|
||||
|
||||
# https://fedoraproject.org/wiki/Packaging:Python_Appendix#Manual_byte_compilation
|
||||
%py_byte_compile %{__python3} %{buildroot}/%{test_path}
|
||||
|
||||
%check
|
||||
# alternatively: test/runtests.py
|
||||
%if 0%{?with_run_build_tests}
|
||||
VERBOSE=1 make check
|
||||
%endif
|
||||
|
||||
%files core
|
||||
%license COPYING
|
||||
|
|
@ -239,6 +244,15 @@ VERBOSE=1 make check
|
|||
%dir %{_sysconfdir}/booth
|
||||
%exclude %{_sysconfdir}/booth/booth.conf.example
|
||||
|
||||
%dir %attr (750, %{uname}, %{gname}) %{_var}/lib/booth/
|
||||
%dir %attr (750, %{uname}, %{gname}) %{_var}/lib/booth/cores
|
||||
|
||||
# Generated html docs
|
||||
%if 0%{?with_html_man}
|
||||
%{_pkgdocdir}/booth-keygen.8.html
|
||||
%{_pkgdocdir}/boothd.8.html
|
||||
%endif
|
||||
|
||||
%files arbitrator
|
||||
%{_unitdir}/booth@.service
|
||||
%{_unitdir}/booth-arbitrator.service
|
||||
|
|
@ -246,27 +260,200 @@ VERBOSE=1 make check
|
|||
%files site
|
||||
# OCF (agent + a helper)
|
||||
## /usr/lib/ocf/resource.d/pacemaker provided by pacemaker
|
||||
/usr/lib/ocf/resource.d/pacemaker/booth-site
|
||||
%dir /usr/lib/ocf/lib/booth
|
||||
/usr/lib/ocf/lib/booth/geo_attr.sh
|
||||
%{_usr}/lib/ocf/resource.d/pacemaker/booth-site
|
||||
%dir %{_usr}/lib/ocf/lib/booth
|
||||
%{_usr}/lib/ocf/lib/booth/geo_attr.sh
|
||||
# geostore (command + OCF agent)
|
||||
%{_sbindir}/geostore
|
||||
%{_mandir}/man8/geostore.8*
|
||||
## /usr/lib/ocf/resource.d provided by resource-agents
|
||||
%dir /usr/lib/ocf/resource.d/booth
|
||||
/usr/lib/ocf/resource.d/booth/geostore
|
||||
%dir %{_usr}/lib/ocf/resource.d/booth
|
||||
%{_usr}/lib/ocf/resource.d/booth/geostore
|
||||
# helper (possibly used in the configuration hook)
|
||||
%dir %{_datadir}/booth
|
||||
%{_datadir}/booth/service-runnable
|
||||
|
||||
# Generated html docs
|
||||
%if 0%{?with_html_man}
|
||||
%{_pkgdocdir}/geostore.8.html
|
||||
%endif
|
||||
|
||||
%files test
|
||||
%doc %{_pkgdocdir}/README-testing
|
||||
# /usr/share/booth provided by -site
|
||||
%{test_path}
|
||||
# /usr/lib/ocf/resource.d/booth provided by -site
|
||||
/usr/lib/ocf/resource.d/booth/sharedrsc
|
||||
%{_usr}/lib/ocf/resource.d/booth/sharedrsc
|
||||
|
||||
%changelog
|
||||
* Fri Sep 19 2025 Python Maint <python-maint@redhat.com> - 1.2-6
|
||||
- Rebuilt for Python 3.14.0rc3 bytecode
|
||||
|
||||
* Thu Aug 21 2025 Cristian Le <git@lecris.dev>
|
||||
- Convert STI tests to TMT (rhbz#2382867)
|
||||
|
||||
* Fri Aug 15 2025 Python Maint <python-maint@redhat.com> - 1.2-5
|
||||
- Rebuilt for Python 3.14.0rc2 bytecode
|
||||
|
||||
* Wed Jul 23 2025 Fedora Release Engineering <releng@fedoraproject.org> - 1.2-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild
|
||||
|
||||
* Thu Jan 16 2025 Fedora Release Engineering <releng@fedoraproject.org> - 1.2-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild
|
||||
|
||||
* Wed Jul 17 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.2-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
|
||||
|
||||
* Fri Jun 07 2024 Jan Friesse <jfriesse@redhat.com> - 1.2-1
|
||||
- New upstream release
|
||||
|
||||
* Tue Jan 23 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.1-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
|
||||
|
||||
* Fri Jan 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.1-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
|
||||
|
||||
* Wed Oct 18 2023 Jan Friesse <jfriesse@redhat.com> - 1.1-1
|
||||
- New upstream release
|
||||
- Upstream releases should now be released regularly, so convert spec
|
||||
to use them instead of git snapshots
|
||||
|
||||
* Wed Jul 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.0-283.4.9d4029a.git
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
|
||||
|
||||
* Tue Jun 06 2023 Jan Friesse <jfriesse@redhat.com> - 1.0-283.3.9d4029a.git
|
||||
- migrated to SPDX license
|
||||
|
||||
* Wed Jan 18 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.0-283.2.9d4029a.git
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
|
||||
|
||||
* Mon Nov 21 2022 Jan Friesse <jfriesse@redhat.com> - 1.0-283.1.9d4029a.git
|
||||
- Rebase to newest upstream snapshot
|
||||
|
||||
* Fri Sep 30 2022 Jan Friesse <jfriesse@redhat.com> - 1.0-272.1.7acb757.git
|
||||
- Rebase to newest upstream snapshot
|
||||
|
||||
* Thu Sep 29 2022 Jan Friesse <jfriesse@redhat.com> - 1.0-266.4.f288d59.git
|
||||
- Remove Alias directive from booth@.service unit file
|
||||
|
||||
* Tue Aug 09 2022 Jan Friesse <jfriesse@redhat.com> - 1.0-266.3.f288d59.git
|
||||
- Remove template unit from systemd_(post|preun|postun_with_restart) macro
|
||||
|
||||
* Wed Jul 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.0-266.2.f288d59.git
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
|
||||
|
||||
* Wed Jul 20 2022 Jan Friesse <jfriesse@redhat.com> - 1.0-266.1.f288d59.git
|
||||
- Rebase to newest upstream snapshot
|
||||
- This version fixes a critical bug that caused the authfile directive
|
||||
to be ignored. After installing the patched version, nodes may stop
|
||||
communicating. Solution is to either remove authfile from configuration
|
||||
file or update all other nodes.
|
||||
|
||||
* Thu May 19 2022 Jan Friesse <jfriesse@redhat.com> - 1.0-262.1.d0ac26c.git
|
||||
- Rebase to newest upstream snapshot
|
||||
|
||||
* Wed Jan 19 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.0-251.3.bfb2f92.git
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
|
||||
|
||||
* Wed Jul 21 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.0-251.2.bfb2f92.git
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
|
||||
|
||||
* Thu May 20 2021 Jan Friesse <jfriesse@redhat.com> - 1.0-251.1.bfb2f92.git
|
||||
- Rebase to newest upstream snapshot
|
||||
|
||||
* Tue May 18 2021 Jan Friesse <jfriesse@redhat.com> - 1.0-249.1.977726e.git
|
||||
- Do not include unit-test by default
|
||||
- Rebase to newest upstream snapshot
|
||||
|
||||
* Tue Mar 02 2021 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 1.0-239.3.52ec255.git
|
||||
- Rebuilt for updated systemd-rpm-macros
|
||||
See https://pagure.io/fesco/issue/2583.
|
||||
|
||||
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.0-239.2.52ec255.git
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
|
||||
|
||||
* Mon Nov 23 2020 Jan Friesse <jfriesse@redhat.com> - 1.0-239.1.52ec255.git
|
||||
- Rebase to newest upstream snapshot
|
||||
|
||||
* Thu Oct 15 2020 Jan Friesse <jfriesse@redhat.com> - 1.0-237.2.dd88847.git
|
||||
- Fix dist macro
|
||||
|
||||
* Thu Oct 15 2020 Jan Friesse <jfriesse@redhat.com> - 1.0-237.1.dd88847.git
|
||||
- Rebase to newest upstream snapshot
|
||||
|
||||
* Thu Oct 15 2020 Jan Friesse <jfriesse@redhat.com> - 1.0-199.1.ac1d34c.git
|
||||
- Implement new versioning scheme
|
||||
|
||||
* Tue Sep 29 2020 Jan Friesse <jfriesse@redhat.com> - 1.0-6.ac1d34c.git.5
|
||||
- Remove net-tools (netstat) dependency and replace it with iproute (ss)
|
||||
- Disable running tests during build by default (conditional run_build_tests)
|
||||
|
||||
* Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.0-6.ac1d34c.git.4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
|
||||
|
||||
* Wed Jun 3 2020 Jan Friesse <jfriesse@redhat.com> - 1.0-6.ac1d34c.git.3
|
||||
- Do not link with the pcmk libraries
|
||||
- Generate runtests.py and boothtestenv.py with -Es as make check does
|
||||
|
||||
* Tue Jun 2 2020 Jan Friesse <jfriesse@redhat.com> - 1.0-6.ac1d34c.git.2
|
||||
- Require the Python interpreter directly instead of using the package name
|
||||
|
||||
* Tue Jun 2 2020 Jan Friesse <jfriesse@redhat.com> - 1.0-6.ac1d34c.git.1
|
||||
- Update to current snapshot (commit ac1d34c) to fix test suite
|
||||
|
||||
* Mon Jun 1 2020 Jan Friesse <jfriesse@redhat.com> - 1.0-5.385cc25.git.3
|
||||
- Add CI tests
|
||||
- Enable gating
|
||||
- Fix hardcoded-library-path
|
||||
|
||||
* Mon Jun 1 2020 Jan Friesse <jfriesse@redhat.com> - 1.0-5.385cc25.git.2
|
||||
- Package /var/lib/booth where booth can chroot
|
||||
|
||||
* Thu May 28 2020 Jan Friesse <jfriesse@redhat.com> - 1.0-5.385cc25.git.1
|
||||
- Fix test subpackage generating
|
||||
|
||||
* Wed May 27 2020 Jan Friesse <jfriesse@redhat.com> - 1.0-5.385cc25.git
|
||||
- Update to current snapshot (commit 385cc25) to fix build warnings
|
||||
|
||||
* Wed May 13 2020 Jan Friesse <jfriesse@redhat.com> - 1.0-4.5d837d2.git.2
|
||||
- Rebuild for the new libqb
|
||||
|
||||
* Mon May 4 2020 Jan Friesse <jfriesse@redhat.com> - 1.0-4.5d837d2.git.1
|
||||
- Add '?dist' macro to release field
|
||||
|
||||
* Mon May 4 2020 Jan Friesse <jfriesse@redhat.com> - 1.0-4.5d837d2.git
|
||||
- Update to current snapshot (commit 5d837d2) to build with gcc10
|
||||
- Pass full path of Python3 to configure
|
||||
|
||||
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.0-3.f2d38ce.git.3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
||||
|
||||
* Wed Jul 24 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.0-3.f2d38ce.git.2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
|
||||
|
||||
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.0-3.f2d38ce.git.1
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
|
||||
|
||||
* Fri Jul 13 2018 Jan Pokorný <jpokorny+rpm-booth@fedoraproject.org> - 1.0-3.f2d38ce.git
|
||||
- update for another, current snapshot beyond booth-1.0
|
||||
(commit f2d38ce), including:
|
||||
. support for solely manually managed tickets (9a365f9)
|
||||
. use asciidoctor instead of asciidoc for generating man pages (65e6a6b)
|
||||
- switch to using Python 3 for the tests instead of Python 2
|
||||
(behind unversioned "python" references; rhbz#1555651)
|
||||
|
||||
* Thu Jul 12 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.0-2.570876d.git.6
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
|
||||
|
||||
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.0-2.570876d.git.5
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
|
||||
|
||||
* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.0-2.570876d.git.4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
|
||||
|
||||
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.0-2.570876d.git.3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
|
||||
|
||||
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.0-2.570876d.git.2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
|
||||
|
||||
|
|
|
|||
15
gating.yaml
Normal file
15
gating.yaml
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
--- !Policy
|
||||
product_versions:
|
||||
- fedora-*
|
||||
decision_context: bodhi_update_push_testing
|
||||
subject_type: koji_build
|
||||
rules:
|
||||
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional}
|
||||
|
||||
--- !Policy
|
||||
product_versions:
|
||||
- fedora-*
|
||||
decision_context: bodhi_update_push_stable
|
||||
subject_type: koji_build
|
||||
rules:
|
||||
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional}
|
||||
13
plans.fmf
Normal file
13
plans.fmf
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
summary: Run all tests
|
||||
discover:
|
||||
how: fmf
|
||||
prepare:
|
||||
- name: Disable installing everything from srpm
|
||||
how: install
|
||||
exclude: ".*"
|
||||
- name: Install the main test package
|
||||
how: install
|
||||
package:
|
||||
- booth-test
|
||||
execute:
|
||||
how: tmt
|
||||
2
sources
2
sources
|
|
@ -1 +1 @@
|
|||
ac33d4fff4d578a2eedf4624b89f2fbd booth-570876d.tar.gz
|
||||
SHA512 (booth-1.2.tar.gz) = b63217e561fd5e8ede1ba432ec6b4ef6efb73dc16a501814cf07b82f87a23c3f734ebf09c56a5d521668ee57ed02be48d257aabb1d2e3c4840f1219ef13d3fde
|
||||
|
|
|
|||
3
tests/.gitignore
vendored
Normal file
3
tests/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# Ignore tests runs/artefacts.
|
||||
artifacts/**
|
||||
**/*.retry
|
||||
3
tests/main.fmf
Normal file
3
tests/main.fmf
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
/upstream:
|
||||
summary: Run upstream tests
|
||||
test: ./upstream/runtest.sh
|
||||
6
tests/upstream/runtest.sh
Executable file
6
tests/upstream/runtest.sh
Executable file
|
|
@ -0,0 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -xe
|
||||
set -o pipefail
|
||||
|
||||
/usr/share/booth/tests/test/runtests.py --allow-root-user
|
||||
Loading…
Add table
Add a link
Reference in a new issue