Accepting request 721844 from home:yan_gao:branches:network:ha-clustering:Factory:Test
- Update to version 2.0.2+20190801.122c32115: - libcib: install cib_types.h - tools: Use glib for cmdline handling in crm_mon. - libcrmcommon: Handle no digits in crm_int_helper. - libcrmcommon: Allow glib cmdline parsing without formatted output. - extra: calculate #health_disk correctly in SysInfo - extra: handle run-as-user properly in ClusterMon - extra: advertise promote and demote in Stateful meta-data - extra: formally deprecate the ocf:pacemaker:pingd agent - extra: quote shell variables in agent code where appropriate - extra: use ":=" where appropriate in agent code - Update to version 2.0.2+20190725.4b4fea3eb: - Rebase: * bug-977201_pacemaker-controld-self-fencing.patch - libcrmcommon: Restore getopt behavior in stonith_admin. - controller: document the cluster-name cluster property - controller: allow configurable reaction to local node fencing - pacemakerd: make daemon exit detection messages more consistent - executor: stonith probes should fail only if previously registered - libstonithd: handle API creation errors better - spec: avoid long-broken (in a pristine tree state) "make all" - controller: panic local host if notified of own fencing - controller: clear "required" bit when disconnecting scheduler - libcrmcommon: Remove -q from global cmdline options. - tools: Allow HTML output in stonith_admin. - libstonithd: Add HTML support to fencing messages. - st_client: Reword stonith_event_text. - controld: Use XML output to check for pending status. - pengine: formatted output for html OBS-URL: https://build.opensuse.org/request/show/721844 OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/pacemaker?expand=0&rev=329
This commit is contained in:
parent
3fc6e0ce2a
commit
154c80f970
@ -1,144 +0,0 @@
|
||||
From 60c3bcbcebd8b619b2124dfed9585182b97eb385 Mon Sep 17 00:00:00 2001
|
||||
From: "Gao,Yan" <ygao@suse.com>
|
||||
Date: Thu, 11 Apr 2019 17:08:41 +0200
|
||||
Subject: [PATCH 1/2] Revert "Fix: service-lib: avoid call-pattern leading to
|
||||
use-after-free"
|
||||
|
||||
This reverts commit e5a1d5dd751effe674e57a2f834e75650ad210c1.
|
||||
---
|
||||
include/crm/services.h | 8 +-------
|
||||
lib/fencing/st_client.c | 18 +++---------------
|
||||
lib/services/services.c | 13 +------------
|
||||
lib/services/services_linux.c | 5 -----
|
||||
lib/services/services_private.h | 1 -
|
||||
5 files changed, 5 insertions(+), 40 deletions(-)
|
||||
|
||||
diff --git a/include/crm/services.h b/include/crm/services.h
|
||||
index 4bdd21a34..c13fc0f04 100644
|
||||
--- a/include/crm/services.h
|
||||
+++ b/include/crm/services.h
|
||||
@@ -305,17 +305,11 @@ gboolean services_action_kick(const char *name, const char *action,
|
||||
*
|
||||
* \param[in] op services action data
|
||||
* \param[in] action_callback callback for when the action completes
|
||||
- * \param[in] action_fork_callback callback for when action forked successfully
|
||||
*
|
||||
* \retval TRUE succesfully started execution
|
||||
* \retval FALSE failed to start execution, no callback will be received
|
||||
*/
|
||||
- gboolean services_action_async_fork_notify(svc_action_t * op,
|
||||
- void (*action_callback) (svc_action_t *),
|
||||
- void (*action_fork_callback) (svc_action_t *));
|
||||
-
|
||||
- gboolean services_action_async(svc_action_t * op,
|
||||
- void (*action_callback) (svc_action_t *));
|
||||
+ gboolean services_action_async(svc_action_t * op, void (*action_callback) (svc_action_t *));
|
||||
|
||||
gboolean services_action_cancel(const char *name, const char *action,
|
||||
guint interval_ms);
|
||||
diff --git a/lib/fencing/st_client.c b/lib/fencing/st_client.c
|
||||
index f4b7addc2..0f2c33012 100644
|
||||
--- a/lib/fencing/st_client.c
|
||||
+++ b/lib/fencing/st_client.c
|
||||
@@ -720,18 +720,6 @@ stonith_action_async_done(svc_action_t *svc_action)
|
||||
stonith__destroy_action(action);
|
||||
}
|
||||
|
||||
-static void
|
||||
-stonith_action_async_forked(svc_action_t *svc_action)
|
||||
-{
|
||||
- stonith_action_t *action = (stonith_action_t *) svc_action->cb_data;
|
||||
-
|
||||
- action->pid = svc_action->pid;
|
||||
- action->svc_action = svc_action;
|
||||
-
|
||||
- crm_trace("Child process %d performing action '%s' successfully forked",
|
||||
- action->pid, action->action);
|
||||
-}
|
||||
-
|
||||
static int
|
||||
internal_stonith_action_execute(stonith_action_t * action)
|
||||
{
|
||||
@@ -778,12 +766,12 @@ internal_stonith_action_execute(stonith_action_t * action)
|
||||
|
||||
if (action->async) {
|
||||
/* async */
|
||||
- if(services_action_async_fork_notify(svc_action,
|
||||
- &stonith_action_async_done,
|
||||
- &stonith_action_async_forked) == FALSE) {
|
||||
+ if(services_action_async(svc_action, &stonith_action_async_done) == FALSE) {
|
||||
services_action_free(svc_action);
|
||||
svc_action = NULL;
|
||||
} else {
|
||||
+ action->pid = svc_action->pid;
|
||||
+ action->svc_action = svc_action;
|
||||
rc = 0;
|
||||
}
|
||||
|
||||
diff --git a/lib/services/services.c b/lib/services/services.c
|
||||
index 313567f58..fa1e0dbe8 100644
|
||||
--- a/lib/services/services.c
|
||||
+++ b/lib/services/services.c
|
||||
@@ -766,17 +766,12 @@ services_untrack_op(svc_action_t *op)
|
||||
}
|
||||
|
||||
gboolean
|
||||
-services_action_async_fork_notify(svc_action_t * op,
|
||||
- void (*action_callback) (svc_action_t *),
|
||||
- void (*action_fork_callback) (svc_action_t *))
|
||||
+services_action_async(svc_action_t * op, void (*action_callback) (svc_action_t *))
|
||||
{
|
||||
op->synchronous = false;
|
||||
if (action_callback) {
|
||||
op->opaque->callback = action_callback;
|
||||
}
|
||||
- if (action_fork_callback) {
|
||||
- op->opaque->fork_callback = action_fork_callback;
|
||||
- }
|
||||
|
||||
if (op->interval_ms > 0) {
|
||||
init_recurring_actions();
|
||||
@@ -796,12 +791,6 @@ services_action_async_fork_notify(svc_action_t * op,
|
||||
return action_exec_helper(op);
|
||||
}
|
||||
|
||||
-gboolean
|
||||
-services_action_async(svc_action_t * op,
|
||||
- void (*action_callback) (svc_action_t *))
|
||||
-{
|
||||
- return services_action_async_fork_notify(op, action_callback, NULL);
|
||||
-}
|
||||
|
||||
static gboolean processing_blocked_ops = FALSE;
|
||||
|
||||
diff --git a/lib/services/services_linux.c b/lib/services/services_linux.c
|
||||
index 8686f2947..66f0fbfc7 100644
|
||||
--- a/lib/services/services_linux.c
|
||||
+++ b/lib/services/services_linux.c
|
||||
@@ -888,11 +888,6 @@ services_os_action_execute(svc_action_t * op)
|
||||
op->opaque->stdin_fd = -1;
|
||||
}
|
||||
|
||||
- // after fds are setup properly and before we plug anything into mainloop
|
||||
- if (op->opaque->fork_callback) {
|
||||
- op->opaque->fork_callback(op);
|
||||
- }
|
||||
-
|
||||
if (op->synchronous) {
|
||||
action_synced_wait(op, pmask);
|
||||
sigchld_cleanup();
|
||||
diff --git a/lib/services/services_private.h b/lib/services/services_private.h
|
||||
index 660a35b67..bb4a7b6a3 100644
|
||||
--- a/lib/services/services_private.h
|
||||
+++ b/lib/services/services_private.h
|
||||
@@ -25,7 +25,6 @@ struct svc_action_private_s {
|
||||
|
||||
guint repeat_timer;
|
||||
void (*callback) (svc_action_t * op);
|
||||
- void (*fork_callback) (svc_action_t * op);
|
||||
|
||||
int stderr_fd;
|
||||
mainloop_io_t *stderr_gsource;
|
||||
--
|
||||
2.16.4
|
||||
|
@ -1,817 +0,0 @@
|
||||
From 3663798bc8548e47109c7457b86713355253d8a0 Mon Sep 17 00:00:00 2001
|
||||
From: "Gao,Yan" <ygao@suse.com>
|
||||
Date: Mon, 29 Apr 2019 10:27:12 +0200
|
||||
Subject: [PATCH] Revert "use common service interface for fence-agents and
|
||||
RAs"
|
||||
|
||||
This reverts commit 18c321e792a279d81008cbd99cb5ec7f81db096f.
|
||||
---
|
||||
include/crm/services.h | 5 +-
|
||||
lib/fencing/Makefile.am | 1 -
|
||||
lib/fencing/st_client.c | 453 +++++++++++++++++++++++++++++++---------
|
||||
lib/services/services_linux.c | 93 ---------
|
||||
lib/services/services_private.h | 2 -
|
||||
5 files changed, 355 insertions(+), 199 deletions(-)
|
||||
|
||||
diff --git a/include/crm/services.h b/include/crm/services.h
|
||||
index c13fc0f04..013f0b851 100644
|
||||
--- a/include/crm/services.h
|
||||
+++ b/include/crm/services.h
|
||||
@@ -156,10 +156,7 @@ typedef struct svc_action_s {
|
||||
char *agent;
|
||||
|
||||
int timeout;
|
||||
- GHashTable *params; /* used for setting up environment for ocf-ra &
|
||||
- alert agents
|
||||
- and to be sent via stdin for fence-agents
|
||||
- */
|
||||
+ GHashTable *params; /* used by OCF agents and alert agents */
|
||||
|
||||
int rc;
|
||||
int pid;
|
||||
diff --git a/lib/fencing/Makefile.am b/lib/fencing/Makefile.am
|
||||
index 024932457..02aed12f3 100644
|
||||
--- a/lib/fencing/Makefile.am
|
||||
+++ b/lib/fencing/Makefile.am
|
||||
@@ -15,7 +15,6 @@ libstonithd_la_CFLAGS = $(CFLAGS_HARDENED_LIB)
|
||||
libstonithd_la_LDFLAGS += $(LDFLAGS_HARDENED_LIB)
|
||||
|
||||
libstonithd_la_LIBADD = $(top_builddir)/lib/common/libcrmcommon.la
|
||||
-libstonithd_la_LIBADD += $(top_builddir)/lib/services/libcrmservice.la
|
||||
|
||||
libstonithd_la_SOURCES = st_client.c st_output.c st_rhcs.c
|
||||
if BUILD_LHA_SUPPORT
|
||||
diff --git a/lib/fencing/st_client.c b/lib/fencing/st_client.c
|
||||
index 0f2c33012..8f6734d33 100644
|
||||
--- a/lib/fencing/st_client.c
|
||||
+++ b/lib/fencing/st_client.c
|
||||
@@ -11,7 +11,6 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
-#include <libgen.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
@@ -38,18 +37,23 @@ struct stonith_action_s {
|
||||
char *agent;
|
||||
char *action;
|
||||
char *victim;
|
||||
- GHashTable *args;
|
||||
+ char *args;
|
||||
int timeout;
|
||||
int async;
|
||||
void *userdata;
|
||||
void (*done_cb) (GPid pid, gint status, const char *output, gpointer user_data);
|
||||
|
||||
- svc_action_t *svc_action;
|
||||
+ /*! internal async track data */
|
||||
+ int fd_stdout;
|
||||
+ int fd_stderr;
|
||||
+ int last_timeout_signo;
|
||||
|
||||
/*! internal timing information */
|
||||
time_t initial_start_time;
|
||||
int tries;
|
||||
int remaining_timeout;
|
||||
+ guint timer_sigterm;
|
||||
+ guint timer_sigkill;
|
||||
int max_retries;
|
||||
|
||||
/* device output data */
|
||||
@@ -431,11 +435,13 @@ stonith_api_register_level(stonith_t * st, int options, const char *node, int le
|
||||
}
|
||||
|
||||
static void
|
||||
-append_arg(const char *key, const char *value, GHashTable **args)
|
||||
+append_arg(const char *key, const char *value, char **args)
|
||||
{
|
||||
+ int len = 3; /* =, \n, \0 */
|
||||
+ int last = 0;
|
||||
+
|
||||
CRM_CHECK(key != NULL, return);
|
||||
CRM_CHECK(value != NULL, return);
|
||||
- CRM_CHECK(args != NULL, return);
|
||||
|
||||
if (strstr(key, "pcmk_")) {
|
||||
return;
|
||||
@@ -445,13 +451,15 @@ append_arg(const char *key, const char *value, GHashTable **args)
|
||||
return;
|
||||
}
|
||||
|
||||
- if (!*args) {
|
||||
- *args = crm_str_table_new();
|
||||
+ len += strlen(key);
|
||||
+ len += strlen(value);
|
||||
+ if (*args != NULL) {
|
||||
+ last = strlen(*args);
|
||||
}
|
||||
|
||||
- CRM_CHECK(*args != NULL, return);
|
||||
+ *args = realloc_safe(*args, last + len);
|
||||
crm_trace("Appending: %s=%s", key, value);
|
||||
- g_hash_table_replace(*args, strdup(key), strdup(value));
|
||||
+ sprintf((*args) + last, "%s=%s\n", key, value);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -467,12 +475,12 @@ append_config_arg(gpointer key, gpointer value, gpointer user_data)
|
||||
}
|
||||
}
|
||||
|
||||
-static GHashTable *
|
||||
+static char *
|
||||
make_args(const char *agent, const char *action, const char *victim, uint32_t victim_nodeid, GHashTable * device_args,
|
||||
GHashTable * port_map)
|
||||
{
|
||||
char buffer[512];
|
||||
- GHashTable *arg_list = NULL;
|
||||
+ char *arg_list = NULL;
|
||||
const char *value = NULL;
|
||||
|
||||
CRM_CHECK(action != NULL, return NULL);
|
||||
@@ -538,6 +546,66 @@ make_args(const char *agent, const char *action, const char *victim, uint32_t vi
|
||||
return arg_list;
|
||||
}
|
||||
|
||||
+static gboolean
|
||||
+st_child_term(gpointer data)
|
||||
+{
|
||||
+ int rc = 0;
|
||||
+ stonith_action_t *track = data;
|
||||
+
|
||||
+ crm_info("Child %d timed out, sending SIGTERM", track->pid);
|
||||
+ track->timer_sigterm = 0;
|
||||
+ track->last_timeout_signo = SIGTERM;
|
||||
+ rc = kill(-track->pid, SIGTERM);
|
||||
+ if (rc < 0) {
|
||||
+ crm_perror(LOG_ERR, "Couldn't send SIGTERM to %d", track->pid);
|
||||
+ }
|
||||
+ return FALSE;
|
||||
+}
|
||||
+
|
||||
+static gboolean
|
||||
+st_child_kill(gpointer data)
|
||||
+{
|
||||
+ int rc = 0;
|
||||
+ stonith_action_t *track = data;
|
||||
+
|
||||
+ crm_info("Child %d timed out, sending SIGKILL", track->pid);
|
||||
+ track->timer_sigkill = 0;
|
||||
+ track->last_timeout_signo = SIGKILL;
|
||||
+ rc = kill(-track->pid, SIGKILL);
|
||||
+ if (rc < 0) {
|
||||
+ crm_perror(LOG_ERR, "Couldn't send SIGKILL to %d", track->pid);
|
||||
+ }
|
||||
+ return FALSE;
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+stonith_action_clear_tracking_data(stonith_action_t * action)
|
||||
+{
|
||||
+ if (action->timer_sigterm > 0) {
|
||||
+ g_source_remove(action->timer_sigterm);
|
||||
+ action->timer_sigterm = 0;
|
||||
+ }
|
||||
+ if (action->timer_sigkill > 0) {
|
||||
+ g_source_remove(action->timer_sigkill);
|
||||
+ action->timer_sigkill = 0;
|
||||
+ }
|
||||
+ if (action->fd_stdout) {
|
||||
+ close(action->fd_stdout);
|
||||
+ action->fd_stdout = 0;
|
||||
+ }
|
||||
+ if (action->fd_stderr) {
|
||||
+ close(action->fd_stderr);
|
||||
+ action->fd_stderr = 0;
|
||||
+ }
|
||||
+ free(action->output);
|
||||
+ action->output = NULL;
|
||||
+ free(action->error);
|
||||
+ action->error = NULL;
|
||||
+ action->rc = 0;
|
||||
+ action->pid = 0;
|
||||
+ action->last_timeout_signo = 0;
|
||||
+}
|
||||
+
|
||||
/*!
|
||||
* \internal
|
||||
* \brief Free all memory used by a stonith action
|
||||
@@ -548,17 +616,11 @@ void
|
||||
stonith__destroy_action(stonith_action_t *action)
|
||||
{
|
||||
if (action) {
|
||||
+ stonith_action_clear_tracking_data(action);
|
||||
free(action->agent);
|
||||
- if (action->args) {
|
||||
- g_hash_table_destroy(action->args);
|
||||
- }
|
||||
+ free(action->args);
|
||||
free(action->action);
|
||||
free(action->victim);
|
||||
- if (action->svc_action) {
|
||||
- services_action_free(action->svc_action);
|
||||
- }
|
||||
- free(action->output);
|
||||
- free(action->error);
|
||||
free(action);
|
||||
}
|
||||
}
|
||||
@@ -640,6 +702,38 @@ stonith_action_create(const char *agent,
|
||||
return action;
|
||||
}
|
||||
|
||||
+#define READ_MAX 500
|
||||
+static char *
|
||||
+read_output(int fd)
|
||||
+{
|
||||
+ char buffer[READ_MAX];
|
||||
+ char *output = NULL;
|
||||
+ int len = 0;
|
||||
+ int more = 0;
|
||||
+
|
||||
+ if (!fd) {
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ do {
|
||||
+ errno = 0;
|
||||
+ memset(&buffer, 0, READ_MAX);
|
||||
+ more = read(fd, buffer, READ_MAX - 1);
|
||||
+
|
||||
+ if (more > 0) {
|
||||
+ buffer[more] = 0; /* Make sure it's nul-terminated for logging
|
||||
+ * 'more' is always less than our buffer size
|
||||
+ */
|
||||
+ output = realloc_safe(output, len + more + 1);
|
||||
+ snprintf(output + len, more + 1, "%s", buffer);
|
||||
+ len += more;
|
||||
+ }
|
||||
+
|
||||
+ } while (more == (READ_MAX - 1) || (more < 0 && errno == EINTR));
|
||||
+
|
||||
+ return output;
|
||||
+}
|
||||
+
|
||||
static gboolean
|
||||
update_remaining_timeout(stonith_action_t * action)
|
||||
{
|
||||
@@ -659,51 +753,58 @@ update_remaining_timeout(stonith_action_t * action)
|
||||
return action->remaining_timeout ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
-static int
|
||||
-svc_action_to_errno(svc_action_t *svc_action) {
|
||||
- int rv = pcmk_ok;
|
||||
+static void
|
||||
+stonith_action_async_done(mainloop_child_t * p, pid_t pid, int core, int signo, int exitcode)
|
||||
+{
|
||||
+ stonith_action_t *action = mainloop_child_userdata(p);
|
||||
|
||||
- if (svc_action->rc > 0) {
|
||||
- /* Try to provide a useful error code based on the fence agent's
|
||||
- * error output.
|
||||
- */
|
||||
- if (svc_action->rc == PCMK_OCF_TIMEOUT) {
|
||||
- rv = -ETIME;
|
||||
+ if (action->timer_sigterm > 0) {
|
||||
+ g_source_remove(action->timer_sigterm);
|
||||
+ action->timer_sigterm = 0;
|
||||
+ }
|
||||
+ if (action->timer_sigkill > 0) {
|
||||
+ g_source_remove(action->timer_sigkill);
|
||||
+ action->timer_sigkill = 0;
|
||||
+ }
|
||||
|
||||
- } else if (svc_action->stderr_data == NULL) {
|
||||
- rv = -ENODATA;
|
||||
+ action->output = read_output(action->fd_stdout);
|
||||
+ action->error = read_output(action->fd_stderr);
|
||||
|
||||
- } else if (strstr(svc_action->stderr_data, "imed out")) {
|
||||
- /* Some agents have their own internal timeouts */
|
||||
- rv = -ETIME;
|
||||
+ if (action->last_timeout_signo) {
|
||||
+ action->rc = -ETIME;
|
||||
+ crm_notice("Child process %d performing action '%s' timed out with signal %d",
|
||||
+ pid, action->action, action->last_timeout_signo);
|
||||
|
||||
- } else if (strstr(svc_action->stderr_data, "Unrecognised action")) {
|
||||
- rv = -EOPNOTSUPP;
|
||||
+ } else if (signo) {
|
||||
+ action->rc = -ECONNABORTED;
|
||||
+ crm_notice("Child process %d performing action '%s' timed out with signal %d",
|
||||
+ pid, action->action, signo);
|
||||
|
||||
- } else {
|
||||
- rv = -pcmk_err_generic;
|
||||
+ } else {
|
||||
+ crm_debug("Child process %d performing action '%s' exited with rc %d",
|
||||
+ pid, action->action, exitcode);
|
||||
+ if (exitcode > 0) {
|
||||
+ /* Try to provide a useful error code based on the fence agent's
|
||||
+ * error output.
|
||||
+ */
|
||||
+ if (action->error == NULL) {
|
||||
+ exitcode = -ENODATA;
|
||||
+
|
||||
+ } else if (strstr(action->error, "imed out")) {
|
||||
+ /* Some agents have their own internal timeouts */
|
||||
+ exitcode = -ETIMEDOUT;
|
||||
+
|
||||
+ } else if (strstr(action->error, "Unrecognised action")) {
|
||||
+ exitcode = -EOPNOTSUPP;
|
||||
+
|
||||
+ } else {
|
||||
+ exitcode = -pcmk_err_generic;
|
||||
+ }
|
||||
}
|
||||
+ action->rc = exitcode;
|
||||
}
|
||||
- return rv;
|
||||
-}
|
||||
-
|
||||
-static void
|
||||
-stonith_action_async_done(svc_action_t *svc_action)
|
||||
-{
|
||||
- stonith_action_t *action = (stonith_action_t *) svc_action->cb_data;
|
||||
-
|
||||
- action->rc = svc_action_to_errno(svc_action);
|
||||
- action->output = svc_action->stdout_data;
|
||||
- svc_action->stdout_data = NULL;
|
||||
- action->error = svc_action->stderr_data;
|
||||
- svc_action->stderr_data = NULL;
|
||||
-
|
||||
- svc_action->params = NULL;
|
||||
-
|
||||
- crm_debug("Child process %d performing action '%s' exited with rc %d",
|
||||
- action->pid, action->action, svc_action->rc);
|
||||
|
||||
- log_action(action, action->pid);
|
||||
+ log_action(action, pid);
|
||||
|
||||
if (action->rc != pcmk_ok && update_remaining_timeout(action)) {
|
||||
int rc = internal_stonith_action_execute(action);
|
||||
@@ -713,21 +814,28 @@ stonith_action_async_done(svc_action_t *svc_action)
|
||||
}
|
||||
|
||||
if (action->done_cb) {
|
||||
- action->done_cb(action->pid, action->rc, action->output, action->userdata);
|
||||
+ action->done_cb(pid, action->rc, action->output, action->userdata);
|
||||
}
|
||||
|
||||
- action->svc_action = NULL; // don't remove our caller
|
||||
stonith__destroy_action(action);
|
||||
}
|
||||
|
||||
static int
|
||||
internal_stonith_action_execute(stonith_action_t * action)
|
||||
{
|
||||
- int rc = -EPROTO;
|
||||
+ int pid, status = 0, len, rc = -EPROTO;
|
||||
+ int ret;
|
||||
+ int total = 0;
|
||||
+ int p_read_fd, p_write_fd; /* parent read/write file descriptors */
|
||||
+ int c_read_fd, c_write_fd; /* child read/write file descriptors */
|
||||
+ int c_stderr_fd, p_stderr_fd; /* parent/child side file descriptors for stderr */
|
||||
+ int fd1[2];
|
||||
+ int fd2[2];
|
||||
+ int fd3[2];
|
||||
int is_retry = 0;
|
||||
- svc_action_t *svc_action = NULL;
|
||||
- static int stonith_sequence = 0;
|
||||
- char *buffer = NULL;
|
||||
+
|
||||
+ /* clear any previous tracking data */
|
||||
+ stonith_action_clear_tracking_data(action);
|
||||
|
||||
if (!action->tries) {
|
||||
action->initial_start_time = time(NULL);
|
||||
@@ -740,60 +848,207 @@ internal_stonith_action_execute(stonith_action_t * action)
|
||||
is_retry = 1;
|
||||
}
|
||||
|
||||
+ c_read_fd = c_write_fd = p_read_fd = p_write_fd = c_stderr_fd = p_stderr_fd = -1;
|
||||
+
|
||||
if (action->args == NULL || action->agent == NULL)
|
||||
goto fail;
|
||||
+ len = strlen(action->args);
|
||||
+
|
||||
+ if (pipe(fd1))
|
||||
+ goto fail;
|
||||
+ p_read_fd = fd1[0];
|
||||
+ c_write_fd = fd1[1];
|
||||
+
|
||||
+ if (pipe(fd2))
|
||||
+ goto fail;
|
||||
+ c_read_fd = fd2[0];
|
||||
+ p_write_fd = fd2[1];
|
||||
+
|
||||
+ if (pipe(fd3))
|
||||
+ goto fail;
|
||||
+ p_stderr_fd = fd3[0];
|
||||
+ c_stderr_fd = fd3[1];
|
||||
+
|
||||
+ crm_debug("forking");
|
||||
+ pid = fork();
|
||||
+ if (pid < 0) {
|
||||
+ rc = -ECHILD;
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
+ if (!pid) {
|
||||
+ /* child */
|
||||
+ setpgid(0, 0);
|
||||
+
|
||||
+ close(1);
|
||||
+ /* coverity[leaked_handle] False positive */
|
||||
+ if (dup(c_write_fd) < 0)
|
||||
+ goto fail;
|
||||
+ close(2);
|
||||
+ /* coverity[leaked_handle] False positive */
|
||||
+ if (dup(c_stderr_fd) < 0)
|
||||
+ goto fail;
|
||||
+ close(0);
|
||||
+ /* coverity[leaked_handle] False positive */
|
||||
+ if (dup(c_read_fd) < 0)
|
||||
+ goto fail;
|
||||
+
|
||||
+ /* keep c_stderr_fd open so parent can report all errors. */
|
||||
+ /* keep c_write_fd open so hostlist can be sent to parent. */
|
||||
+ close(c_read_fd);
|
||||
+ close(p_read_fd);
|
||||
+ close(p_write_fd);
|
||||
+ close(p_stderr_fd);
|
||||
+
|
||||
+ /* keep retries from executing out of control */
|
||||
+ if (is_retry) {
|
||||
+ sleep(1);
|
||||
+ }
|
||||
+ execlp(action->agent, action->agent, NULL);
|
||||
+ exit(CRM_EX_ERROR);
|
||||
+ }
|
||||
+
|
||||
+ /* parent */
|
||||
+ action->pid = pid;
|
||||
+ ret = crm_set_nonblocking(p_read_fd);
|
||||
+ if (ret < 0) {
|
||||
+ crm_notice("Could not set output of %s to be non-blocking: %s "
|
||||
+ CRM_XS " rc=%d",
|
||||
+ action->agent, pcmk_strerror(rc), rc);
|
||||
+ }
|
||||
+ ret = crm_set_nonblocking(p_stderr_fd);
|
||||
+ if (ret < 0) {
|
||||
+ crm_notice("Could not set error output of %s to be non-blocking: %s "
|
||||
+ CRM_XS " rc=%d",
|
||||
+ action->agent, pcmk_strerror(rc), rc);
|
||||
+ }
|
||||
+
|
||||
+ errno = 0;
|
||||
+ do {
|
||||
+ crm_debug("sending args");
|
||||
+ ret = write(p_write_fd, action->args + total, len - total);
|
||||
+ if (ret > 0) {
|
||||
+ total += ret;
|
||||
+ }
|
||||
|
||||
- buffer = crm_strdup_printf(RH_STONITH_DIR "/%s", basename(action->agent));
|
||||
- svc_action = services_action_create_generic(buffer, NULL);
|
||||
- free(buffer);
|
||||
- svc_action->timeout = 1000 * action->remaining_timeout;
|
||||
- svc_action->standard = strdup(PCMK_RESOURCE_CLASS_STONITH);
|
||||
- svc_action->id = crm_strdup_printf("%s_%s_%d", basename(action->agent),
|
||||
- action->action, action->tries);
|
||||
- svc_action->agent = strdup(action->agent);
|
||||
- svc_action->sequence = stonith_sequence++;
|
||||
- svc_action->params = action->args;
|
||||
- svc_action->cb_data = (void *) action;
|
||||
-
|
||||
- /* keep retries from executing out of control and free previous results */
|
||||
- if (is_retry) {
|
||||
- free(action->output);
|
||||
- action->output = NULL;
|
||||
- free(action->error);
|
||||
- action->error = NULL;
|
||||
- sleep(1);
|
||||
+ } while (errno == EINTR && total < len);
|
||||
+
|
||||
+ if (total != len) {
|
||||
+ crm_perror(LOG_ERR, "Sent %d not %d bytes", total, len);
|
||||
+ if (ret >= 0) {
|
||||
+ rc = -ECOMM;
|
||||
+ }
|
||||
+ goto fail;
|
||||
}
|
||||
|
||||
+ close(p_write_fd); p_write_fd = -1;
|
||||
+
|
||||
+ /* async */
|
||||
if (action->async) {
|
||||
- /* async */
|
||||
- if(services_action_async(svc_action, &stonith_action_async_done) == FALSE) {
|
||||
- services_action_free(svc_action);
|
||||
- svc_action = NULL;
|
||||
+ action->fd_stdout = p_read_fd;
|
||||
+ action->fd_stderr = p_stderr_fd;
|
||||
+ mainloop_child_add(pid, 0/* Move the timeout here? */, action->action, action, stonith_action_async_done);
|
||||
+ crm_trace("Op: %s on %s, pid: %d, timeout: %ds", action->action, action->agent, pid,
|
||||
+ action->remaining_timeout);
|
||||
+ action->last_timeout_signo = 0;
|
||||
+ if (action->remaining_timeout) {
|
||||
+ action->timer_sigterm =
|
||||
+ g_timeout_add(1000 * action->remaining_timeout, st_child_term, action);
|
||||
+ action->timer_sigkill =
|
||||
+ g_timeout_add(1000 * (action->remaining_timeout + 5), st_child_kill, action);
|
||||
} else {
|
||||
- action->pid = svc_action->pid;
|
||||
- action->svc_action = svc_action;
|
||||
- rc = 0;
|
||||
+ crm_err("No timeout set for stonith operation %s with device %s",
|
||||
+ action->action, action->agent);
|
||||
}
|
||||
|
||||
+ close(c_write_fd);
|
||||
+ close(c_read_fd);
|
||||
+ close(c_stderr_fd);
|
||||
+ return 0;
|
||||
+
|
||||
} else {
|
||||
/* sync */
|
||||
- if (services_action_sync(svc_action)) {
|
||||
+ int timeout = action->remaining_timeout + 1;
|
||||
+ pid_t p = 0;
|
||||
+
|
||||
+ while (action->remaining_timeout < 0 || timeout > 0) {
|
||||
+ p = waitpid(pid, &status, WNOHANG);
|
||||
+ if (p > 0) {
|
||||
+ break;
|
||||
+ }
|
||||
+ sleep(1);
|
||||
+ timeout--;
|
||||
+ }
|
||||
+
|
||||
+ if (timeout == 0) {
|
||||
+ int killrc = kill(-pid, SIGKILL);
|
||||
+
|
||||
+ if (killrc && errno != ESRCH) {
|
||||
+ crm_err("kill(%d, KILL) failed: %s (%d)", pid, pcmk_strerror(errno), errno);
|
||||
+ }
|
||||
+ /*
|
||||
+ * From sigprocmask(2):
|
||||
+ * It is not possible to block SIGKILL or SIGSTOP. Attempts to do so are silently ignored.
|
||||
+ *
|
||||
+ * This makes it safe to skip WNOHANG here
|
||||
+ */
|
||||
+ p = waitpid(pid, &status, 0);
|
||||
+ }
|
||||
+
|
||||
+ if (p <= 0) {
|
||||
+ crm_perror(LOG_ERR, "waitpid(%d)", pid);
|
||||
+
|
||||
+ } else if (p != pid) {
|
||||
+ crm_err("Waited for %d, got %d", pid, p);
|
||||
+ }
|
||||
+
|
||||
+ action->output = read_output(p_read_fd);
|
||||
+ action->error = read_output(p_stderr_fd);
|
||||
+
|
||||
+ action->rc = -ECONNABORTED;
|
||||
+
|
||||
+ log_action(action, pid);
|
||||
+
|
||||
+ rc = action->rc;
|
||||
+ if (timeout == 0) {
|
||||
+ action->rc = -ETIME;
|
||||
+ } else if (WIFEXITED(status)) {
|
||||
+ crm_debug("result = %d", WEXITSTATUS(status));
|
||||
+ action->rc = -WEXITSTATUS(status);
|
||||
rc = 0;
|
||||
- action->rc = svc_action_to_errno(svc_action);
|
||||
- action->output = svc_action->stdout_data;
|
||||
- svc_action->stdout_data = NULL;
|
||||
- action->error = svc_action->stderr_data;
|
||||
- svc_action->stderr_data = NULL;
|
||||
+
|
||||
+ } else if (WIFSIGNALED(status)) {
|
||||
+ crm_err("call %s for %s exited due to signal %d", action->action, action->agent,
|
||||
+ WTERMSIG(status));
|
||||
+
|
||||
} else {
|
||||
- action->rc = -ECONNABORTED;
|
||||
- rc = action->rc;
|
||||
+ crm_err("call %s for %s returned unexpected status %#x",
|
||||
+ action->action, action->agent, status);
|
||||
}
|
||||
-
|
||||
- svc_action->params = NULL;
|
||||
- services_action_free(svc_action);
|
||||
}
|
||||
|
||||
fail:
|
||||
+
|
||||
+ if (p_read_fd >= 0) {
|
||||
+ close(p_read_fd);
|
||||
+ }
|
||||
+ if (p_write_fd >= 0) {
|
||||
+ close(p_write_fd);
|
||||
+ }
|
||||
+ if (p_stderr_fd >= 0) {
|
||||
+ close(p_stderr_fd);
|
||||
+ }
|
||||
+
|
||||
+ if (c_read_fd >= 0) {
|
||||
+ close(c_read_fd);
|
||||
+ }
|
||||
+ if (c_write_fd >= 0) {
|
||||
+ close(c_write_fd);
|
||||
+ }
|
||||
+ if (c_stderr_fd >= 0) {
|
||||
+ close(c_stderr_fd);
|
||||
+ }
|
||||
+
|
||||
return rc;
|
||||
}
|
||||
|
||||
diff --git a/lib/services/services_linux.c b/lib/services/services_linux.c
|
||||
index 87a25d687..5df51d20a 100644
|
||||
--- a/lib/services/services_linux.c
|
||||
+++ b/lib/services/services_linux.c
|
||||
@@ -223,39 +223,6 @@ add_action_env_vars(const svc_action_t *op)
|
||||
}
|
||||
}
|
||||
|
||||
-static void
|
||||
-pipe_in_single_parameter(gpointer key, gpointer value, gpointer user_data)
|
||||
-{
|
||||
- svc_action_t *op = user_data;
|
||||
- char *buffer = crm_strdup_printf("%s=%s\n", (char *)key, (char *) value);
|
||||
- int ret, total = 0, len = strlen(buffer);
|
||||
-
|
||||
- do {
|
||||
- errno = 0;
|
||||
- ret = write(op->opaque->stdin_fd, buffer + total, len - total);
|
||||
- if (ret > 0) {
|
||||
- total += ret;
|
||||
- }
|
||||
-
|
||||
- } while ((errno == EINTR) && (total < len));
|
||||
- free(buffer);
|
||||
-}
|
||||
-
|
||||
-/*!
|
||||
- * \internal
|
||||
- * \brief Pipe parameters in via stdin for action
|
||||
- *
|
||||
- * \param[in] op Action to use
|
||||
- */
|
||||
-static void
|
||||
-pipe_in_action_stdin_parameters(const svc_action_t *op)
|
||||
-{
|
||||
- crm_debug("sending args");
|
||||
- if (op->params) {
|
||||
- g_hash_table_foreach(op->params, pipe_in_single_parameter, (gpointer) op);
|
||||
- }
|
||||
-}
|
||||
-
|
||||
gboolean
|
||||
recurring_action_timer(gpointer data)
|
||||
{
|
||||
@@ -345,10 +312,6 @@ operation_finished(mainloop_child_t * p, pid_t pid, int core, int signo, int exi
|
||||
op->opaque->stdout_gsource = NULL;
|
||||
}
|
||||
|
||||
- if (op->opaque->stdin_fd >= 0) {
|
||||
- close(op->opaque->stdin_fd);
|
||||
- }
|
||||
-
|
||||
if (signo) {
|
||||
if (mainloop_child_timeout(p)) {
|
||||
crm_warn("%s - timed out after %dms", prefix, op->timeout);
|
||||
@@ -680,9 +643,6 @@ action_synced_wait(svc_action_t * op, sigset_t *mask)
|
||||
|
||||
close(op->opaque->stdout_fd);
|
||||
close(op->opaque->stderr_fd);
|
||||
- if (op->opaque->stdin_fd >= 0) {
|
||||
- close(op->opaque->stdin_fd);
|
||||
- }
|
||||
|
||||
#ifdef HAVE_SYS_SIGNALFD_H
|
||||
close(sfd);
|
||||
@@ -696,7 +656,6 @@ services_os_action_execute(svc_action_t * op)
|
||||
{
|
||||
int stdout_fd[2];
|
||||
int stderr_fd[2];
|
||||
- int stdin_fd[2] = {-1, -1};
|
||||
int rc;
|
||||
struct stat st;
|
||||
sigset_t *pmask = NULL;
|
||||
@@ -762,25 +721,6 @@ services_os_action_execute(svc_action_t * op)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
- if (safe_str_eq(op->standard, PCMK_RESOURCE_CLASS_STONITH)) {
|
||||
- if (pipe(stdin_fd) < 0) {
|
||||
- rc = errno;
|
||||
-
|
||||
- close(stdout_fd[0]);
|
||||
- close(stdout_fd[1]);
|
||||
- close(stderr_fd[0]);
|
||||
- close(stderr_fd[1]);
|
||||
-
|
||||
- crm_err("pipe(stdin_fd) failed. '%s': %s (%d)", op->opaque->exec, pcmk_strerror(rc), rc);
|
||||
-
|
||||
- services_handle_exec_error(op, rc);
|
||||
- if (!op->synchronous) {
|
||||
- return operation_finalize(op);
|
||||
- }
|
||||
- return FALSE;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
if (op->synchronous) {
|
||||
#ifdef HAVE_SYS_SIGNALFD_H
|
||||
sigemptyset(&mask);
|
||||
@@ -828,10 +768,6 @@ services_os_action_execute(svc_action_t * op)
|
||||
close(stdout_fd[1]);
|
||||
close(stderr_fd[0]);
|
||||
close(stderr_fd[1]);
|
||||
- if (stdin_fd[0] >= 0) {
|
||||
- close(stdin_fd[0]);
|
||||
- close(stdin_fd[1]);
|
||||
- }
|
||||
|
||||
crm_err("Could not execute '%s': %s (%d)", op->opaque->exec, pcmk_strerror(rc), rc);
|
||||
services_handle_exec_error(op, rc);
|
||||
@@ -845,9 +781,6 @@ services_os_action_execute(svc_action_t * op)
|
||||
case 0: /* Child */
|
||||
close(stdout_fd[0]);
|
||||
close(stderr_fd[0]);
|
||||
- if (stdin_fd[1] >= 0) {
|
||||
- close(stdin_fd[1]);
|
||||
- }
|
||||
if (STDOUT_FILENO != stdout_fd[1]) {
|
||||
if (dup2(stdout_fd[1], STDOUT_FILENO) != STDOUT_FILENO) {
|
||||
crm_err("dup2() failed (stdout)");
|
||||
@@ -860,13 +793,6 @@ services_os_action_execute(svc_action_t * op)
|
||||
}
|
||||
close(stderr_fd[1]);
|
||||
}
|
||||
- if ((stdin_fd[0] >= 0) &&
|
||||
- (STDIN_FILENO != stdin_fd[0])) {
|
||||
- if (dup2(stdin_fd[0], STDIN_FILENO) != STDIN_FILENO) {
|
||||
- crm_err("dup2() failed (stdin)");
|
||||
- }
|
||||
- close(stdin_fd[0]);
|
||||
- }
|
||||
|
||||
if (op->synchronous) {
|
||||
sigchld_cleanup();
|
||||
@@ -879,9 +805,6 @@ services_os_action_execute(svc_action_t * op)
|
||||
/* Only the parent reaches here */
|
||||
close(stdout_fd[1]);
|
||||
close(stderr_fd[1]);
|
||||
- if (stdin_fd[0] >= 0) {
|
||||
- close(stdin_fd[0]);
|
||||
- }
|
||||
|
||||
op->opaque->stdout_fd = stdout_fd[0];
|
||||
rc = crm_set_nonblocking(op->opaque->stdout_fd);
|
||||
@@ -899,22 +822,6 @@ services_os_action_execute(svc_action_t * op)
|
||||
pcmk_strerror(rc), rc);
|
||||
}
|
||||
|
||||
- op->opaque->stdin_fd = stdin_fd[1];
|
||||
- if (op->opaque->stdin_fd >= 0) {
|
||||
- // using buffer behind non-blocking-fd here - that could be improved
|
||||
- // as long as no other standard uses stdin_fd assume stonith
|
||||
- rc = crm_set_nonblocking(op->opaque->stdin_fd);
|
||||
- if (rc < 0) {
|
||||
- crm_warn("Could not set child input non-blocking: %s "
|
||||
- CRM_XS " fd=%d,rc=%d",
|
||||
- pcmk_strerror(rc), op->opaque->stdin_fd, rc);
|
||||
- }
|
||||
- pipe_in_action_stdin_parameters(op);
|
||||
- // as long as we are handling parameters directly in here just close
|
||||
- close(op->opaque->stdin_fd);
|
||||
- op->opaque->stdin_fd = -1;
|
||||
- }
|
||||
-
|
||||
if (op->synchronous) {
|
||||
action_synced_wait(op, pmask);
|
||||
sigchld_cleanup();
|
||||
diff --git a/lib/services/services_private.h b/lib/services/services_private.h
|
||||
index bb4a7b6a3..23395e20e 100644
|
||||
--- a/lib/services/services_private.h
|
||||
+++ b/lib/services/services_private.h
|
||||
@@ -31,8 +31,6 @@ struct svc_action_private_s {
|
||||
|
||||
int stdout_fd;
|
||||
mainloop_io_t *stdout_gsource;
|
||||
-
|
||||
- int stdin_fd;
|
||||
#if SUPPORT_DBUS
|
||||
DBusPendingCall* pending;
|
||||
unsigned timerid;
|
||||
--
|
||||
2.16.4
|
||||
|
4
_service
4
_service
@ -8,9 +8,9 @@
|
||||
To update to a new release, change "revision" to the desired
|
||||
git commit hash and bump "version" if necessary
|
||||
|
||||
<param name="version">2.0.1</param>
|
||||
<param name="version">2.0.2</param>
|
||||
-->
|
||||
<param name="versionformat">2.0.1+%cd.%h</param>
|
||||
<param name="versionformat">2.0.2+%cd.%h</param>
|
||||
<param name="revision">master</param>
|
||||
<param name="changesgenerate">enable</param>
|
||||
</service>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<servicedata>
|
||||
<service name="tar_scm">
|
||||
<param name="url">git://github.com/ClusterLabs/pacemaker.git</param>
|
||||
<param name="changesrevision">977e17f1377e30f53585beb0e82c652991942234</param>
|
||||
<param name="changesrevision">b49c0d87ced772b60b3c44b810ba1da59f11fa7d</param>
|
||||
</service>
|
||||
</servicedata>
|
@ -4,11 +4,11 @@ Date: Thu Sep 6 15:14:58 2012 +0800
|
||||
|
||||
Medium: stonith: Expose IDs of stonith resources to stonith agents through "$CRM_meta_st_device_id" environment variable
|
||||
|
||||
Index: pacemaker-2.0.0+20180726.3d81c89b8/daemons/fenced/fenced_commands.c
|
||||
Index: pacemaker-2.0.2+20190614.9f18a420a/daemons/fenced/fenced_commands.c
|
||||
===================================================================
|
||||
--- pacemaker-2.0.0+20180726.3d81c89b8.orig/daemons/fenced/fenced_commands.c
|
||||
+++ pacemaker-2.0.0+20180726.3d81c89b8/daemons/fenced/fenced_commands.c
|
||||
@@ -940,6 +940,7 @@ build_device_from_xml(xmlNode * msg)
|
||||
--- pacemaker-2.0.2+20190614.9f18a420a.orig/daemons/fenced/fenced_commands.c
|
||||
+++ pacemaker-2.0.2+20190614.9f18a420a/daemons/fenced/fenced_commands.c
|
||||
@@ -878,6 +878,7 @@ build_device_from_xml(xmlNode * msg)
|
||||
device->id, device->on_target_actions);
|
||||
}
|
||||
|
||||
@ -16,27 +16,27 @@ Index: pacemaker-2.0.0+20180726.3d81c89b8/daemons/fenced/fenced_commands.c
|
||||
device->work = mainloop_add_trigger(G_PRIORITY_HIGH, stonith_device_dispatch, device);
|
||||
/* TODO: Hook up priority */
|
||||
|
||||
Index: pacemaker-2.0.0+20180726.3d81c89b8/lib/fencing/st_client.c
|
||||
Index: pacemaker-2.0.2+20190614.9f18a420a/lib/fencing/st_client.c
|
||||
===================================================================
|
||||
--- pacemaker-2.0.0+20180726.3d81c89b8.orig/lib/fencing/st_client.c
|
||||
+++ pacemaker-2.0.0+20180726.3d81c89b8/lib/fencing/st_client.c
|
||||
@@ -38,6 +38,7 @@ struct stonith_action_s {
|
||||
--- pacemaker-2.0.2+20190614.9f18a420a.orig/lib/fencing/st_client.c
|
||||
+++ pacemaker-2.0.2+20190614.9f18a420a/lib/fencing/st_client.c
|
||||
@@ -40,6 +40,7 @@ struct stonith_action_s {
|
||||
char *action;
|
||||
char *victim;
|
||||
char *args;
|
||||
GHashTable *args;
|
||||
+ char *dev_id;
|
||||
int timeout;
|
||||
int async;
|
||||
void *userdata;
|
||||
@@ -621,6 +622,7 @@ stonith__destroy_action(stonith_action_t
|
||||
free(action->args);
|
||||
free(action->action);
|
||||
free(action->victim);
|
||||
@@ -561,6 +562,7 @@ stonith__destroy_action(stonith_action_t
|
||||
}
|
||||
free(action->output);
|
||||
free(action->error);
|
||||
+ free(action->dev_id);
|
||||
free(action);
|
||||
}
|
||||
}
|
||||
@@ -690,6 +692,8 @@ stonith_action_create(const char *agent,
|
||||
@@ -630,6 +632,8 @@ stonith_action_create(const char *agent,
|
||||
if (device_args) {
|
||||
char buffer[512];
|
||||
const char *value = NULL;
|
||||
@ -45,7 +45,7 @@ Index: pacemaker-2.0.0+20180726.3d81c89b8/lib/fencing/st_client.c
|
||||
|
||||
snprintf(buffer, sizeof(buffer), "pcmk_%s_retries", _action);
|
||||
value = g_hash_table_lookup(device_args, buffer);
|
||||
@@ -697,6 +701,11 @@ stonith_action_create(const char *agent,
|
||||
@@ -637,6 +641,11 @@ stonith_action_create(const char *agent,
|
||||
if (value) {
|
||||
action->max_retries = atoi(value);
|
||||
}
|
||||
@ -57,23 +57,44 @@ Index: pacemaker-2.0.0+20180726.3d81c89b8/lib/fencing/st_client.c
|
||||
}
|
||||
|
||||
return action;
|
||||
@@ -878,6 +887,8 @@ internal_stonith_action_execute(stonith_
|
||||
@@ -773,6 +782,10 @@ internal_stonith_action_execute(stonith_
|
||||
svc_action->params = action->args;
|
||||
svc_action->cb_data = (void *) action;
|
||||
|
||||
if (!pid) {
|
||||
/* child */
|
||||
+ if (action->dev_id) {
|
||||
+ svc_action->rsc = strdup(action->dev_id);
|
||||
+ }
|
||||
+
|
||||
/* keep retries from executing out of control and free previous results */
|
||||
if (is_retry) {
|
||||
free(action->output);
|
||||
Index: pacemaker-2.0.2+20190614.9f18a420a/lib/services/services_linux.c
|
||||
===================================================================
|
||||
--- pacemaker-2.0.2+20190614.9f18a420a.orig/lib/services/services_linux.c
|
||||
+++ pacemaker-2.0.2+20190614.9f18a420a/lib/services/services_linux.c
|
||||
@@ -30,6 +30,9 @@
|
||||
#include "crm/common/mainloop.h"
|
||||
#include "crm/services.h"
|
||||
|
||||
+#include "crm/stonith-ng.h"
|
||||
+#include "crm/fencing/internal.h"
|
||||
+
|
||||
#include "services_private.h"
|
||||
|
||||
#if SUPPORT_CIBSECRETS
|
||||
@@ -189,6 +192,15 @@ static void
|
||||
add_action_env_vars(const svc_action_t *op)
|
||||
{
|
||||
void (*env_setter)(gpointer, gpointer, gpointer) = NULL;
|
||||
+
|
||||
+ if (safe_str_eq(op->standard, PCMK_RESOURCE_CLASS_STONITH)
|
||||
+ && safe_str_eq(op->agent, "fence_legacy")
|
||||
+ && op->rsc != NULL) {
|
||||
+ const char *st_dev_id_key = CRM_META "_" F_STONITH_DEVICE;
|
||||
+
|
||||
setpgid(0, 0);
|
||||
|
||||
close(1);
|
||||
@@ -900,6 +911,10 @@ internal_stonith_action_execute(stonith_
|
||||
close(p_write_fd);
|
||||
close(p_stderr_fd);
|
||||
|
||||
+ if (action->dev_id) {
|
||||
+ setenv(st_dev_id_key, action->dev_id, 1);
|
||||
+ }
|
||||
+ setenv(st_dev_id_key, op->rsc, 1);
|
||||
+ }
|
||||
+
|
||||
/* keep retries from executing out of control */
|
||||
if (is_retry) {
|
||||
sleep(1);
|
||||
if (op->agent == NULL) {
|
||||
env_setter = set_alert_env; /* we deal with alert handler */
|
||||
|
||||
|
@ -4,16 +4,16 @@ Date: Mon Jun 13 17:26:27 2016 +0200
|
||||
|
||||
Fix: controld: Prevent unwanted self-fencing if "stateful_merge_wait" state of dlm is not available
|
||||
|
||||
Index: pacemaker-2.0.0+20180726.3d81c89b8/extra/resources/controld
|
||||
Index: pacemaker-2.0.2+20190725.4b4fea3eb/extra/resources/controld
|
||||
===================================================================
|
||||
--- pacemaker-2.0.0+20180726.3d81c89b8.orig/extra/resources/controld
|
||||
+++ pacemaker-2.0.0+20180726.3d81c89b8/extra/resources/controld
|
||||
@@ -224,10 +224,6 @@ controld_monitor() {
|
||||
--- pacemaker-2.0.2+20190725.4b4fea3eb.orig/extra/resources/controld
|
||||
+++ pacemaker-2.0.2+20190725.4b4fea3eb/extra/resources/controld
|
||||
@@ -226,10 +226,6 @@ controld_monitor() {
|
||||
if [ -n "$smw" ] && [ $smw -eq 1 ]; then
|
||||
ocf_log err "DLM status is: stateful_merge_wait"
|
||||
CM_RC=$OCF_ERR_GENERIC
|
||||
- elif [ -z "$smw" ] && dlm_tool ls | grep -q "wait fencing" && \
|
||||
- ! stonith_admin -H '*' -V | grep -q "wishes to"; then
|
||||
- ! stonith_admin -H '*' --output-as xml | grep -q "extended-status=\"pending\""; then
|
||||
- ocf_log err "DLM status is: wait fencing"
|
||||
- CM_RC=$OCF_ERR_GENERIC
|
||||
else
|
||||
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:49f0fb503ae983bd5988a7c869113874dd13c52fd94564b4f3dc8974f47535e4
|
||||
size 3446944
|
3
pacemaker-2.0.2+20190801.122c32115.tar.xz
Normal file
3
pacemaker-2.0.2+20190801.122c32115.tar.xz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:14863a5786b835484b10243cf8c50a3bf805c6f270848c4bf57e7ec818c97ce1
|
||||
size 3479184
|
@ -1,3 +1,164 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Aug 08 11:10:39 UTC 2019 - Yan Gao <ygao@suse.com>
|
||||
|
||||
- Update to version 2.0.2+20190801.122c32115:
|
||||
- libcib: install cib_types.h
|
||||
- tools: Use glib for cmdline handling in crm_mon.
|
||||
- libcrmcommon: Handle no digits in crm_int_helper.
|
||||
- libcrmcommon: Allow glib cmdline parsing without formatted output.
|
||||
- extra: calculate #health_disk correctly in SysInfo
|
||||
- extra: handle run-as-user properly in ClusterMon
|
||||
- extra: advertise promote and demote in Stateful meta-data
|
||||
- extra: formally deprecate the ocf:pacemaker:pingd agent
|
||||
- extra: quote shell variables in agent code where appropriate
|
||||
- extra: use ":=" where appropriate in agent code
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Jul 30 16:00:17 UTC 2019 - Yan Gao <ygao@suse.com>
|
||||
|
||||
- Update to version 2.0.2+20190725.4b4fea3eb:
|
||||
|
||||
- Rebase:
|
||||
* bug-977201_pacemaker-controld-self-fencing.patch
|
||||
|
||||
- libcrmcommon: Restore getopt behavior in stonith_admin.
|
||||
- controller: document the cluster-name cluster property
|
||||
- controller: allow configurable reaction to local node fencing
|
||||
- pacemakerd: make daemon exit detection messages more consistent
|
||||
- executor: stonith probes should fail only if previously registered
|
||||
- libstonithd: handle API creation errors better
|
||||
- spec: avoid long-broken (in a pristine tree state) "make all"
|
||||
- controller: panic local host if notified of own fencing
|
||||
- controller: clear "required" bit when disconnecting scheduler
|
||||
- libcrmcommon: Remove -q from global cmdline options.
|
||||
- tools: Allow HTML output in stonith_admin.
|
||||
- libstonithd: Add HTML support to fencing messages.
|
||||
- st_client: Reword stonith_event_text.
|
||||
- controld: Use XML output to check for pending status.
|
||||
- pengine: formatted output for html
|
||||
- executor: don't pass /dev/null to resource agents as log
|
||||
- executor: improve resource registration/unregistration messages
|
||||
- controller: don't print "successfully started" if not true
|
||||
- controller: monitor change can arrive in transition it was scheduled in
|
||||
- controller: improve action result messages
|
||||
- controller: confirm cancel actions by task key and node UUID
|
||||
- controller: allow graph update when confirming action
|
||||
- controller: improve remote RA connection messages
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Jul 15 09:35:42 UTC 2019 - Yan Gao <ygao@suse.com>
|
||||
|
||||
- Update to version 2.0.2+20190712.662793aac:
|
||||
- scheduler: wait for probe actions to complete to prevent unnecessary restart/re-promote of dependent resources (bsc#1130122, bsc#1032511)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Jul 12 13:54:03 UTC 2019 - Yan Gao <ygao@suse.com>
|
||||
|
||||
- Update to version 2.0.2+20190711.8a638d418:
|
||||
- st_client: cleanup token whenever setting api to disconnected
|
||||
- libcrmcommon: Add a "none" output formatter.
|
||||
- libcrmcommon: Add a formatted outputter for HTML.
|
||||
- remote: allow run-time configurable TLS priorities
|
||||
- pengine: formatted output for text
|
||||
- scheduler: properly detect dangling migrations
|
||||
- scheduler: only successful ops count for migration comparisons
|
||||
- libpe_status: add sanity check when unpacking migration history
|
||||
- libpe_status: check for stops correctly when unpacking migration
|
||||
- controller: reset expected reply when disconnecting from scheduler
|
||||
- cts-scheduler: convert to python
|
||||
- tools: Use a copy of argv in stonith_admin.
|
||||
- libcrmcommon: Add a new version message.
|
||||
- libcrmcommon: Add an error message.
|
||||
- tools: Convert command line handling in stonith_admin.
|
||||
- controller: set timeout on scheduler responses
|
||||
- libcrmcommon: tweak ACL log messages
|
||||
- libcrmcommon: pengine: formatted output for xml
|
||||
- libstonithd: improve error checking when sending command
|
||||
- fencer: don't require API registration for list and status commands
|
||||
- fencer: improve error checking and log messages for API action requests
|
||||
- executor: don't cancel stonith monitors when device is not registered
|
||||
- executor: return error for stonith probes if stonith connection was lost
|
||||
- libcrmcommon: assert on ACL memory allocation errors
|
||||
- libcrmcommon: improve ACL messages
|
||||
- libcrmcommon: avoid use-after-free when enforcing creation ACLs
|
||||
- controld-fencing: add notice-log for successful fencer-connect
|
||||
- st_client: make safe to remove notifications from notifications
|
||||
- attrd: ensure node ID is initialized properly
|
||||
- tools: avoid unlikely small memory leaks in attrd_updater
|
||||
- fence-history: resync fence-history after fenced crash
|
||||
- based: check for writeability of cib.xml.sig alongside cib.xml
|
||||
- based: make "preventive rename" on CIB access fault path-specific
|
||||
- fence-history: add notification upon history-synced
|
||||
- controld-fencing: remove-notifications upon connection-destroy
|
||||
- fence-history: fail leftover pending-actions after fenced-restart
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Jul 05 10:14:13 UTC 2019 - Yan Gao <ygao@suse.com>
|
||||
|
||||
- Update to version 2.0.2+20190614.9f18a420a:
|
||||
|
||||
- Rebase:
|
||||
* bug-728579_pacemaker-stonith-dev-id.patch
|
||||
|
||||
- libpe_status: don't add /var/log mount to bundles if user did
|
||||
- libpe_status: don't order implied stops relative to a remote connection
|
||||
- scheduler: remote state is failed if node is shutting down with connection failure
|
||||
- libpe_status: fail connection resource if remote action gets "not connected"
|
||||
- libcrmcommon: bump CRM feature set
|
||||
- controller: use op status, not rc, for execution in invalid state
|
||||
- controller: use op status, not rc, for executor disconnection
|
||||
- libpe_status: calculate secure digests for unfencing ops
|
||||
- Increase STONITH execution start log level to notice
|
||||
- Fix the log level to notice when the node attribute changes
|
||||
- libcrmcommon: add stderr source correctly when outputting XML
|
||||
- tools: stonith_admin --list-targets should show what fencer would use
|
||||
- Fix monitor's log to match other operation's log level
|
||||
- controller: don't check join status after remote node appears
|
||||
- pacemaker-remoted: use different default log if pid 1
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Jun 07 10:39:45 UTC 2019 - Yan Gao <ygao@suse.com>
|
||||
|
||||
- Update to version 2.0.2+20190606.73beea82f:
|
||||
- stonith-ng's function cannot be blocked with CIB updates forever
|
||||
- libpe_status: offer compile-time option to change concurrent-fencing default
|
||||
- libstonithd: return proper error code for async stonith action
|
||||
- various: improve fencer connection messages
|
||||
- stonith_admin --help: specify the usage of --cleanup (bsc#1135317)
|
||||
- pacemaker.service: Add option that does not restart Pacemaker if Corosync stops
|
||||
- controller: confirm cancel of failed monitors (bsc#1133866)
|
||||
- libcrmcommon: return error when applying XML diffs containing unknown operations (bsc#1127716)
|
||||
- libcrmcommon: avoid possible use-of-NULL when applying XML diffs (bsc#1127716)
|
||||
- libcrmcommon: correctly apply XML diffs with multiple move/create changes (bsc#1127716)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Jun 07 10:36:55 UTC 2019 - Yan Gao <ygao@suse.com>
|
||||
|
||||
- Update to version 2.0.2+20190606.744a30d65 (Pacemaker-2.0.2):
|
||||
- libcrmcommon: export logfile environment variable if using default
|
||||
- libstonithd: Change stonith-event XML output.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon May 27 12:07:02 UTC 2019 - Yan Gao <ygao@suse.com>
|
||||
|
||||
- Update to version 2.0.1+20190522.660ef6b13:
|
||||
- fence-lib: regression introduced with fork callback
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue May 21 13:00:58 UTC 2019 - Yan Gao <ygao@suse.com>
|
||||
|
||||
- Update to version 2.0.1+20190520.dc4103b37:
|
||||
|
||||
- Drop obsolete:
|
||||
* 0001-Revert-Fix-service-lib-avoid-call-pattern-leading-to.patch
|
||||
* 0002-Revert-use-common-service-interface-for-fence-agents.patch
|
||||
|
||||
- Rebase:
|
||||
* bug-728579_pacemaker-stonith-dev-id.patch
|
||||
|
||||
- fence-lib: avoid use-after-free on early failure return
|
||||
- libcrmcommon: Don't segfault in text_begin_list.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed May 01 07:22:56 UTC 2019 - Yan Gao <ygao@suse.com>
|
||||
|
||||
@ -69,16 +230,17 @@ Thu Apr 4 09:09:49 UTC 2019 - Yan Gao <ygao@suse.com>
|
||||
-------------------------------------------------------------------
|
||||
Thu Apr 4 09:05:55 UTC 2019 - Yan Gao <ygao@suse.com>
|
||||
|
||||
- Update to version 2.0.1+20190402.e091f4f0c:
|
||||
|
||||
- Rebase:
|
||||
* bug-728579_pacemaker-stonith-dev-id.patch
|
||||
|
||||
- Update to version 2.0.1+20190402.e091f4f0c:
|
||||
- scheduler: one group stop shouldn't make another required
|
||||
- libcrmcommon: compare_version: drop superfluous heap allocation
|
||||
- libfencing: enumerate installed RHCS-style agents alpha-sorted
|
||||
- xml diff'ing: prevent 'id' attribute reordering in "diff-removed"
|
||||
- libcrmcommon: downplay "Creating RNG parser context" as debug prio
|
||||
- controller: improve failed recurring action messages
|
||||
- controller: improve failed recurring action messages (bsc#1133866)
|
||||
- controller: improve lost action logs
|
||||
- use common service interface for fence-agents and RAs
|
||||
- libcrmcommon: allow whitespace in name/value pairs
|
||||
@ -337,7 +499,7 @@ Thu Sep 6 12:43:10 UTC 2018 - ygao@suse.com
|
||||
- libcrmcluster: improve CPG membership messages
|
||||
- controller: improve membership messages
|
||||
- stonith-history: keep history recorded within boundaries
|
||||
- tools: crm_resource -C should wait for all replies
|
||||
- tools: crm_resource -C should wait for all replies (bsc#1140519)
|
||||
- libcrmcommon: explicitly include stdint.h in util.h (bsc#1108303)
|
||||
- attrd: improve log messages
|
||||
- attrd: delay re-attempted writes
|
||||
|
@ -12,7 +12,7 @@
|
||||
# license that conforms to the Open Source Definition (Version 1.9)
|
||||
# published by the Open Source Initiative.
|
||||
|
||||
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
||||
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
||||
#
|
||||
|
||||
|
||||
@ -74,7 +74,7 @@
|
||||
%endif
|
||||
|
||||
Name: pacemaker
|
||||
Version: 2.0.1+20190430.8e851b084
|
||||
Version: 2.0.2+20190801.122c32115
|
||||
Release: 0
|
||||
Summary: Scalable High-Availability cluster resource manager
|
||||
# AGPL-3.0 licensed extra/clustermon.sh is not present in the binary
|
||||
@ -87,6 +87,7 @@ Source0: %{name}-%{version}.tar.xz
|
||||
Source1: crm_report.in
|
||||
Source100: pacemaker.rpmlintrc
|
||||
Patch1: bug-806256_pacemaker-log-level-notice.patch
|
||||
Patch2: bug-728579_pacemaker-stonith-dev-id.patch
|
||||
Patch3: pacemaker-nagios-plugin-dir.patch
|
||||
Patch4: bug-812269_pacemaker-fencing-device-register-messages.patch
|
||||
Patch5: pacemaker-Wno-format-signedness.patch
|
||||
@ -94,9 +95,6 @@ Patch6: bug-943295_pacemaker-lrmd-log-notice.patch
|
||||
Patch7: bug-977201_pacemaker-controld-self-fencing.patch
|
||||
Patch8: bug-995365_pacemaker-cts-restart-systemd-journald.patch
|
||||
Patch9: pacemaker-cts-StartCmd.patch
|
||||
Patch10: 0001-Revert-Fix-service-lib-avoid-call-pattern-leading-to.patch
|
||||
Patch11: 0002-Revert-use-common-service-interface-for-fence-agents.patch
|
||||
Patch12: bug-728579_pacemaker-stonith-dev-id.patch
|
||||
# Required for core functionality
|
||||
BuildRequires: autoconf
|
||||
BuildRequires: automake
|
||||
@ -304,6 +302,7 @@ manager.
|
||||
%prep
|
||||
%setup -q -n %{name}-%{version}
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
@ -311,9 +310,6 @@ manager.
|
||||
%patch7 -p1
|
||||
%patch8 -p1
|
||||
%patch9 -p1
|
||||
%patch10 -p1
|
||||
%patch11 -p1
|
||||
%patch12 -p1
|
||||
|
||||
%build
|
||||
|
||||
@ -357,7 +353,7 @@ autoreconf -fvi
|
||||
--localstatedir=%{_var} \
|
||||
--with-version=%{version}-%{release}
|
||||
|
||||
make %{?_smp_mflags} all
|
||||
make %{?_smp_mflags}
|
||||
|
||||
%install
|
||||
%make_install
|
||||
|
Loading…
Reference in New Issue
Block a user