Sync from SUSE:SLFO:Main cluster-glue revision 7cdb7348e888ba6d0d4140314a57aae3

This commit is contained in:
Adrian Schröter 2024-05-03 11:37:34 +02:00
commit adaba99878
9 changed files with 1680 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

19
_service Normal file
View File

@ -0,0 +1,19 @@
<services>
<service name="tar_scm" mode="disabled">
<param name="url">https://github.com/ClusterLabs/cluster-glue.git</param>
<param name="scm">git</param>
<param name="filename">cluster-glue</param>
<param name="versionformat">1.0.12+v1.git.%ct.%h</param>
<param name="revision">master</param>
<param name="changesgenerate">enable</param>
</service>
<service name="recompress" mode="disabled">
<param name="file">cluster-glue*.tar</param>
<param name="compression">bz2</param>
</service>
<service name="set_version" mode="disabled">
<param name="basename">cluster-glue</param>
</service>
</services>

6
_servicedata Normal file
View File

@ -0,0 +1,6 @@
<servicedata>
<service name="tar_scm">
<param name="url">git://github.com/ClusterLabs/cluster-glue.git</param>
<param name="changesrevision">958bd9035b926871171198c2c7fd2778bc4c371c</param></service><service name="tar_scm">
<param name="url">https://github.com/ClusterLabs/cluster-glue.git</param>
<param name="changesrevision">3efce74cfa5a20cb204bad9ba56a278b3021b3e4</param></service></servicedata>

View File

@ -0,0 +1,156 @@
# HG changeset patch
# Parent ef8ad188f372c6393847a1287af02f79e11717ec
Medium: stonith: load libplumb symbols manually (thanks to lge) (bnc#694243)
diff -r ef8ad188f372 -r 43e0d1d58866 lib/stonith/Makefile.am
--- a/lib/stonith/Makefile.am Thu Dec 13 17:38:22 2012 +0100
+++ b/lib/stonith/Makefile.am Thu Dec 13 17:43:11 2012 +0100
@@ -33,9 +33,7 @@ endif
stonith_SOURCES = main.c
-stonith_LDADD = libstonith.la $(top_builddir)/lib/pils/libpils.la $(GLIBLIB) \
- $(top_builddir)/lib/clplumbing/libplumb.la \
- $(top_builddir)/lib/clplumbing/libplumbgpl.la
+stonith_LDADD = libstonith.la $(top_builddir)/lib/pils/libpils.la $(GLIBLIB)
stonith_LDFLAGS = @LIBADD_DL@ @LIBLTDL@ -export-dynamic @DLOPEN_FORCE_FLAGS@ @LIBADD_INTL@
meatclient_SOURCES = meatclient.c
diff -r ef8ad188f372 -r 43e0d1d58866 lib/stonith/main.c
--- a/lib/stonith/main.c Thu Dec 13 17:38:22 2012 +0100
+++ b/lib/stonith/main.c Thu Dec 13 17:43:11 2012 +0100
@@ -26,9 +26,9 @@
#include <unistd.h>
#include <string.h>
#include <syslog.h>
+#include <dlfcn.h>
#include <stonith/stonith.h>
#include <pils/plugin.h>
-#include <clplumbing/cl_log.h>
#include <glib.h>
#include <libxml/entities.h>
@@ -43,6 +43,7 @@ static int debug = 0;
#define LOG_TERMINAL 0
#define LOG_CLLOG 1
static int log_destination = LOG_TERMINAL;
+static void (*logfun)(int, const char *, ...) G_GNUC_PRINTF(2,3);
static const char META_TEMPLATE[] =
"<?xml version=\"1.0\"?>\n"
@@ -73,9 +74,11 @@ void print_stonith_meta(Stonith * stonit
void print_types(void);
void print_confignames(Stonith *s);
+const char *prio2str(int priority);
void log_buf(int severity, char *buf);
void log_msg(int severity, const char * fmt, ...)G_GNUC_PRINTF(2,3);
void trans_log(int priority, const char * fmt, ...)G_GNUC_PRINTF(2,3);
+void setup_cl_log(void);
static int pil_loglevel_to_syslog_severity[] = {
/* Indices: <none>=0, PIL_FATAL=1, PIL_CRIT=2, PIL_WARN=3,
@@ -297,6 +300,7 @@ print_stonith_meta(Stonith * stonith_obj
}
#define MAXNVARG 50
+#define MAXLINE (512*10)
void
print_types()
@@ -331,6 +335,27 @@ print_confignames(Stonith *s)
printf("\n");
}
+const char *
+prio2str(int priority)
+{
+ static const char *log_prio[8] = {
+ "EMERG",
+ "ALERT",
+ "CRIT",
+ "ERROR",
+ "WARN",
+ "notice",
+ "info",
+ "debug"
+ };
+ int logpri;
+
+ logpri = LOG_PRI(priority);
+
+ return (logpri < 0 || logpri >= DIMOF(log_prio)) ?
+ "(undef)" : log_prio[logpri];
+}
+
void
log_buf(int severity, char *buf)
{
@@ -339,7 +364,11 @@ log_buf(int severity, char *buf)
if (log_destination == LOG_TERMINAL) {
fprintf(stderr, "%s: %s\n", prio2str(severity),buf);
} else {
- cl_log(severity, "%s", buf);
+ if (logfun) {
+ (*logfun)(severity, "%s", buf);
+ } else {
+ syslog(severity, "%s", buf);
+ }
}
}
@@ -370,6 +399,40 @@ trans_log(int priority, const char * fmt
log_buf(severity, buf);
}
+/*
+ * due to possible symbol conflict with other system libraries
+ * (in particular HMAC, MD5, and base64*) we just pick the
+ * symbols we need here
+ */
+
+void
+setup_cl_log(void)
+{
+ void *ldhandle;
+ void (*set_entity)(const char *);
+ void (*enable_stderr)(int);
+ void (*set_facility)(int);
+ void (*inherit_logging_environment)(int);
+
+ ldhandle = dlopen("libplumb.so", RTLD_LAZY);
+ if (!ldhandle) {
+ return;
+ }
+
+ *(void **) (&set_entity) = dlsym(ldhandle, "cl_log_set_entity");
+ *(void **) (&enable_stderr) = dlsym(ldhandle, "cl_log_enable_stderr");
+ *(void **) (&set_facility) = dlsym(ldhandle, "cl_log_set_facility");
+ *(void **) (&inherit_logging_environment) = dlsym(ldhandle, "cl_inherit_logging_environment");
+ *(void **) (&logfun) = dlsym(ldhandle, "cl_log");
+
+ (*set_entity)("stonith");
+ (*enable_stderr)(debug?TRUE:FALSE);
+ (*set_facility)(HA_LOG_FACILITY);
+
+ /* Use logd if it's enabled by heartbeat */
+ (*inherit_logging_environment)(0);
+}
+
int
main(int argc, char** argv)
{
@@ -491,12 +554,7 @@ main(int argc, char** argv)
/* if we're invoked by stonithd, log through cl_log */
if (!isatty(fileno(stdin))) {
log_destination = LOG_CLLOG;
- cl_log_set_entity("stonith");
- cl_log_enable_stderr(debug?TRUE:FALSE);
- cl_log_set_facility(HA_LOG_FACILITY);
-
- /* Use logd if it's enabled by heartbeat */
- cl_inherit_logging_environment(0);
+ setup_cl_log();
}
if (help && !errors) {

BIN
cluster-glue-1.0.12+v1.git.1663933145.1619d044.tar.bz2 (Stored with Git LFS) Normal file

Binary file not shown.

1181
cluster-glue.changes Normal file

File diff suppressed because it is too large Load Diff

225
cluster-glue.spec Normal file
View File

@ -0,0 +1,225 @@
#
# spec file for package cluster-glue
#
# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define gid 90
%define uid 90
%define gname haclient
%define uname hacluster
# Directory where we install documentation
%global glue_docdir %{_defaultdocdir}/%{name}
Name: cluster-glue
Version: 1.0.12+v1.git.1663933145.1619d044
Release: 0
Summary: Reusable cluster components
License: GPL-2.0-only AND LGPL-2.1-or-later
Group: Productivity/Clustering/HA
URL: https://github.com/ClusterLabs/cluster-glue.git
Source: %{name}-%{version}.tar.bz2
Source3: hb_report.in
# PATCH-FIX-OPENSUSE: load libplumb symbols manually (thanks to lge) (bnc#694243)
Patch1: bug-694243_cluster-glue_symbol-conflict.patch
# PATCH-FIX-OPENSUSE: drop lrm as it's not used anymore by pacemaker
Patch4: cluster-glue_droplrm.patch
# PATCH-FIX-UPSTREAM: fix warnings seen by GCC7
BuildRequires: asciidoc
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: docbook-xsl-stylesheets
BuildRequires: docbook_4
BuildRequires: e2fsprogs-devel
BuildRequires: help2man
BuildRequires: libaio-devel
BuildRequires: libtool
BuildRequires: libxslt
BuildRequires: net-snmp-devel
BuildRequires: pkgconfig
BuildRequires: systemd-rpm-macros
BuildRequires: pkgconfig(OpenIPMI)
BuildRequires: pkgconfig(bzip2)
BuildRequires: pkgconfig(glib-2.0)
BuildRequires: pkgconfig(libcurl)
BuildRequires: pkgconfig(libxml-2.0)
Requires: perl-TimeDate
Requires: sudo
Requires(pre): shadow
# The following is necessary since sbd is dropped from
# cluster-glue itself:
Recommends: sbd
Conflicts: heartbeat-common < 3.0.2
Conflicts: pacemaker < 1.1.8
Obsoletes: heartbeat-common < 3.0.2
%{?systemd_requires}
%if 0%{?suse_version} >= 1330
Requires(pre): group(nobody)
Requires(pre): user(nobody)
%endif
%description
A collection of common tools that are useful for writing cluster managers
such as Pacemaker.
Provides a local resource manager that understands the OCF and LSB
standards, and an interface to common STONITH devices.
%package libs
Summary: Reusable cluster libraries
Group: System/Libraries
Requires: %{name} = %{version}-%{release}
Provides: libglue2 = %version-%release
Conflicts: libheartbeat2 < 3.0.2
Obsoletes: libglue2 < %version-%release
Obsoletes: libheartbeat2 < 3.0.2
%description libs
A collection of libraries that are useful for writing cluster managers
such as Pacemaker.
%package devel
Summary: Headers and libraries for writing cluster managers
Group: Development/Libraries/C and C++
Requires: %{name}-libs = %{version}-%{release}
Provides: libglue-devel = %version-%release
Conflicts: libheartbeat-devel < 3.0.2
Obsoletes: libglue-devel < %version-%release
Obsoletes: libheartbeat-devel < 3.0.2
%description devel
Headers and shared libraries for a useful for writing cluster managers
such as Pacemaker.
%prep
%autosetup -p1
%build
export CFLAGS="${CFLAGS} %{optflags}"
export PYTHON="%{_bindir}/python3"
./autogen.sh
find . -type f -exec perl -pi -e 'BEGIN{undef $/};s[^#\!%{_bindir}/env perl][#\!%{_bindir}/perl]' {} \;
%configure \
--disable-static \
--enable-ipmilan=no \
--enable-libnet=no \
--disable-fatal-warnings \
--with-package-name=%{name} \
--with-daemon-group=%{gname} \
--with-daemon-user=%{uname} \
--with-systemdsystemunitdir=%{_unitdir} \
--with-rundir=%{_rundir} \
--docdir=%{glue_docdir}
make %{?_smp_mflags}
%install
%make_install
# Dont package static libs or compiled python
find %{buildroot} -type f "(" -name "*.la" -o -name "*.pyc" -o -name "*.pyo" ")" -delete -print
install -D -m 755 %{SOURCE3} %{buildroot}%{_sbindir}/hb_report
%if %{defined _unitdir}
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rclogd
%endif
%pre
getent group %{gname} >/dev/null || groupadd -r -g %{gid} %{gname}
getent passwd %{uname} >/dev/null || useradd -r -u %{uid} -g %{gname} -d %{_localstatedir}/lib/heartbeat/cores/%{uname} -s /sbin/nologin -c "heartbeat processes" %{uname}
%service_add_pre logd.service
%post
%service_add_post logd.service
mkdir -p %{_var}/run/heartbeat/rsctmp
%preun
%service_del_preun logd.service
%postun
%service_del_postun logd.service
%post libs -p /sbin/ldconfig
%postun libs -p /sbin/ldconfig
%files
%{_defaultdocdir}/%{name}/
%dir %{_libdir}/heartbeat
%dir %{_var}/lib/heartbeat
%dir %{_var}/lib/heartbeat/cores
%dir %attr (0700, root, root) %{_var}/lib/heartbeat/cores/root
%dir %attr (0700, nobody, nobody) %{_var}/lib/heartbeat/cores/nobody
%dir %attr (0700, %{uname}, %{gname}) %{_var}/lib/heartbeat/cores/%{uname}
%dir %{_libdir}/heartbeat/plugins
%dir %{_libdir}/heartbeat/plugins/RAExec
%dir %{_libdir}/heartbeat/plugins/InterfaceMgr
%dir %{_libdir}/heartbeat/plugins/compress
%dir %{_libdir}/stonith
%dir %{_libdir}/stonith/plugins
%dir %{_libdir}/stonith/plugins/stonith2
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/ha_cf_support.sh
%{_datadir}/%{name}/openais_conf_support.sh
%{_datadir}/%{name}/utillib.sh
%{_datadir}/%{name}/ha_log.sh
%{_sbindir}/ha_logger
%{_sbindir}/hb_report
%{_sbindir}/meatclient
%{_sbindir}/stonith
%{_unitdir}/logd.service
%{_mandir}/man8/*
%doc AUTHORS
%license COPYING
%doc logd/logd.cf
%{_sbindir}/rclogd
%{_libdir}/heartbeat/ha_logd
%{_libdir}/heartbeat/plugins/RAExec/*.so
%{_libdir}/heartbeat/plugins/InterfaceMgr/*.so
%{_libdir}/heartbeat/plugins/compress/*.so
%{_libdir}/stonith/plugins/external
%{_libdir}/stonith/plugins/stonith2/ribcl.py
%exclude %{_libdir}/stonith/plugins/stonith2/null.so
%exclude %{_libdir}/stonith/plugins/stonith2/ssh.so
%exclude %{_libdir}/stonith/plugins/external/ssh
%{_libdir}/stonith/plugins/stonith2/*.so
%{_libdir}/stonith/plugins/xen0-ha-dom0-stonith-helper
%files libs
%{_libdir}/lib*.so.*
%doc AUTHORS
%license COPYING.LIB
%files devel
%dir %{_libdir}/heartbeat
%dir %{_libdir}/heartbeat/plugins
%dir %{_libdir}/heartbeat/plugins/test
%dir %{_datadir}/%{name}
%{_libdir}/lib*.so
%{_libdir}/heartbeat/ipctest
%{_libdir}/heartbeat/ipctransientclient
%{_libdir}/heartbeat/ipctransientserver
%{_libdir}/heartbeat/transient-test.sh
%{_libdir}/heartbeat/base64_md5_test
%{_libdir}/heartbeat/logtest
%{_includedir}/clplumbing
%{_includedir}/heartbeat
%exclude %{_includedir}/heartbeat/lrm
%{_includedir}/stonith
%{_includedir}/pils
%{_libdir}/heartbeat/plugins/test/test.so
%{_libdir}/stonith/plugins/stonith2/null.so
%{_libdir}/stonith/plugins/stonith2/ssh.so
%{_libdir}/stonith/plugins/external/ssh
%doc AUTHORS
%license COPYING
%license COPYING.LIB
%changelog

View File

@ -0,0 +1,44 @@
# HG changeset patch
# Parent 54ec848c439e3fb4dfd34e8b405f8ca84bc5d592
build: drop lrm as it's not used anymore by pacemaker
diff -r 54ec848c439e lib/Makefile.am
--- a/lib/Makefile.am Fri Feb 01 11:54:20 2013 +0100
+++ b/lib/Makefile.am Fri Feb 01 13:15:55 2013 +0100
@@ -17,4 +17,4 @@
#
MAINTAINERCLEANFILES = Makefile.in
-SUBDIRS = pils clplumbing lrm stonith plugins
+SUBDIRS = pils clplumbing stonith plugins
diff -r 54ec848c439e lrm/Makefile.am
--- a/lrm/Makefile.am Fri Feb 01 11:54:20 2013 +0100
+++ b/lrm/Makefile.am Fri Feb 01 13:15:55 2013 +0100
@@ -17,4 +17,4 @@
#
MAINTAINERCLEANFILES = Makefile.in
-SUBDIRS = lrmd admin test
+SUBDIRS = admin
diff -r 54ec848c439e lrm/admin/Makefile.am
--- a/lrm/admin/Makefile.am Fri Feb 01 11:54:20 2013 +0100
+++ b/lrm/admin/Makefile.am Fri Feb 01 13:15:55 2013 +0100
@@ -23,18 +23,3 @@ INCLUDES = -I$(top_builddir)/include
halibdir = $(libdir)/@HB_PKG@
COMMONLIBS = $(top_builddir)/lib/clplumbing/libplumb.la $(GLIBLIB)
-LRM_DIR = lrm
-sbin_PROGRAMS = lrmadmin
-sbin_SCRIPTS = cibsecret
-lrmadmin_SOURCES = lrmadmin.c
-lrmadmin_LDFLAGS = $(COMMONLIBS)
-lrmadmin_LDADD = $(top_builddir)/lib/$(LRM_DIR)/liblrm.la
-lrmadmin_DEPENDENCIES = $(top_builddir)/lib/$(LRM_DIR)/liblrm.la
-
-if BUILD_HELP
-man8_MANS = $(sbin_PROGRAMS:%=%.8)
-%.8: %
- echo Creating $@
- chmod a+x $<
- help2man --output $@ --no-info --section 8 --name "Part of the Linux-HA project" $(top_builddir)/lrm/admin/$<
-endif

23
hb_report.in Normal file
View File

@ -0,0 +1,23 @@
#!/bin/sh
#
# Copyright (C) 2007 Dejan Muhamedagic <dmuhamedagic@suse.com>
# Copyright (C) 2015 Kristoffer Gronlund <kgronlund@suse.com>
#
# Replaced with crm report
PARENT_COMMAND="$(ps -o comm= $PPID)"
PROG="$(basename "$0")"
die() {
echo "$PROG: $*"
exit 1
}
[ "$(basename "$PARENT_COMMAND")" = "crm" ] && die "called itself in a loop, aborting"
echo "WARNING: Command \"$PROG\" is deprecated, please use \"crm report\""
if which crm > /dev/null 2>&1; then
crm report "$@"
elif [ -x /usr/sbin/crm ]; then
/usr/sbin/crm report "$@"
else
die "hb_report has been deprecated: Please install crmsh, which replaces it"
fi