summaryrefslogtreecommitdiffstats
path: root/lib/lrmd
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 07:45:40 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 07:45:40 +0000
commit07d7f4cfa4b10de87a31b68191036ff446add675 (patch)
tree7162524d8aaf1aef62d2f4fa51f595ed113981ff /lib/lrmd
parentAdding upstream version 2.1.6. (diff)
downloadpacemaker-07d7f4cfa4b10de87a31b68191036ff446add675.tar.xz
pacemaker-07d7f4cfa4b10de87a31b68191036ff446add675.zip
Adding upstream version 2.1.7.upstream/2.1.7
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'lib/lrmd')
-rw-r--r--lib/lrmd/Makefile.am17
-rw-r--r--lib/lrmd/lrmd_alerts.c4
-rw-r--r--lib/lrmd/lrmd_client.c67
3 files changed, 65 insertions, 23 deletions
diff --git a/lib/lrmd/Makefile.am b/lib/lrmd/Makefile.am
index e9ac906..a9b9c67 100644
--- a/lib/lrmd/Makefile.am
+++ b/lib/lrmd/Makefile.am
@@ -1,5 +1,5 @@
#
-# Copyright 2012-2020 the Pacemaker project contributors
+# Copyright 2012-2023 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
@@ -10,12 +10,17 @@ include $(top_srcdir)/mk/common.mk
lib_LTLIBRARIES = liblrmd.la
-liblrmd_la_LDFLAGS = -version-info 29:6:1
+liblrmd_la_LDFLAGS = -version-info 30:0:2
liblrmd_la_CFLAGS = $(CFLAGS_HARDENED_LIB)
liblrmd_la_LDFLAGS += $(LDFLAGS_HARDENED_LIB)
-liblrmd_la_LIBADD = $(top_builddir)/lib/common/libcrmcommon.la \
- $(top_builddir)/lib/services/libcrmservice.la \
- $(top_builddir)/lib/fencing/libstonithd.la
-liblrmd_la_SOURCES = lrmd_client.c proxy_common.c lrmd_alerts.c lrmd_output.c
+liblrmd_la_LIBADD = $(top_builddir)/lib/fencing/libstonithd.la
+liblrmd_la_LIBADD += $(top_builddir)/lib/services/libcrmservice.la
+liblrmd_la_LIBADD += $(top_builddir)/lib/common/libcrmcommon.la
+
+## Library sources (*must* use += format for bumplibs)
+liblrmd_la_SOURCES = lrmd_alerts.c
+liblrmd_la_SOURCES += lrmd_client.c
+liblrmd_la_SOURCES += lrmd_output.c
+liblrmd_la_SOURCES += proxy_common.c
diff --git a/lib/lrmd/lrmd_alerts.c b/lib/lrmd/lrmd_alerts.c
index 588ff97..2a8c988 100644
--- a/lib/lrmd/lrmd_alerts.c
+++ b/lib/lrmd/lrmd_alerts.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2022 the Pacemaker project contributors
+ * Copyright 2015-2023 the Pacemaker project contributors
*
* The version control history for this file may have further details.
*
@@ -355,7 +355,7 @@ lrmd_send_resource_alert(lrmd_t *lrmd, const GList *alert_list,
target_rc = rsc_op_expected_rc(op);
if ((op->interval_ms == 0) && (target_rc == op->rc)
- && pcmk__str_eq(op->op_type, RSC_STATUS, pcmk__str_casei)) {
+ && pcmk__str_eq(op->op_type, PCMK_ACTION_MONITOR, pcmk__str_casei)) {
/* Don't send alerts for probes with the expected result. Leave it up to
* the agent whether to alert for 'failed' probes. (Even if we find a
diff --git a/lib/lrmd/lrmd_client.c b/lib/lrmd/lrmd_client.c
index c565728..400d3b0 100644
--- a/lib/lrmd/lrmd_client.c
+++ b/lib/lrmd/lrmd_client.c
@@ -544,7 +544,20 @@ lrmd_ipc_connection_destroy(gpointer userdata)
lrmd_t *lrmd = userdata;
lrmd_private_t *native = lrmd->lrmd_private;
- crm_info("IPC connection destroyed");
+ switch (native->type) {
+ case pcmk__client_ipc:
+ crm_info("Disconnected from local executor");
+ break;
+#ifdef HAVE_GNUTLS_GNUTLS_H
+ case pcmk__client_tls:
+ crm_info("Disconnected from remote executor on %s",
+ native->remote_nodename);
+ break;
+#endif
+ default:
+ crm_err("Unsupported executor connection type %d (bug?)",
+ native->type);
+ }
/* Prevent these from being cleaned up in lrmd_api_disconnect() */
native->ipc = NULL;
@@ -588,7 +601,9 @@ lrmd_tls_connection_destroy(gpointer userdata)
}
free(native->remote->buffer);
+ free(native->remote->start_state);
native->remote->buffer = NULL;
+ native->remote->start_state = NULL;
native->source = 0;
native->sock = 0;
native->psk_cred_c = NULL;
@@ -980,6 +995,7 @@ lrmd_handshake(lrmd_t * lrmd, const char *name)
const char *version = crm_element_value(reply, F_LRMD_PROTOCOL_VERSION);
const char *msg_type = crm_element_value(reply, F_LRMD_OPERATION);
const char *tmp_ticket = crm_element_value(reply, F_LRMD_CLIENTID);
+ const char *start_state = crm_element_value(reply, PCMK__XA_NODE_START_STATE);
long long uptime = -1;
crm_element_value_int(reply, F_LRMD_RC, &rc);
@@ -992,6 +1008,10 @@ lrmd_handshake(lrmd_t * lrmd, const char *name)
crm_element_value_ll(reply, PCMK__XA_UPTIME, &uptime);
native->remote->uptime = uptime;
+ if (start_state) {
+ native->remote->start_state = strdup(start_state);
+ }
+
if (rc == -EPROTO) {
crm_err("Executor protocol version mismatch between client (%s) and server (%s)",
LRMD_PROTOCOL_VERSION, version);
@@ -1038,11 +1058,15 @@ lrmd_ipc_connect(lrmd_t * lrmd, int *fd)
if (fd) {
/* No mainloop */
native->ipc = crm_ipc_new(CRM_SYSTEM_LRMD, 0);
- if (native->ipc && crm_ipc_connect(native->ipc)) {
- *fd = crm_ipc_get_fd(native->ipc);
- } else if (native->ipc) {
- crm_perror(LOG_ERR, "Connection to executor failed");
- rc = -ENOTCONN;
+ if (native->ipc != NULL) {
+ rc = pcmk__connect_generic_ipc(native->ipc);
+ if (rc == pcmk_rc_ok) {
+ rc = pcmk__ipc_fd(native->ipc, fd);
+ }
+ if (rc != pcmk_rc_ok) {
+ crm_err("Connection to executor failed: %s", pcmk_rc_str(rc));
+ rc = -ENOTCONN;
+ }
}
} else {
native->source = mainloop_add_ipc_client(CRM_SYSTEM_LRMD, G_PRIORITY_HIGH, 0, lrmd, &lrmd_callbacks);
@@ -1238,7 +1262,7 @@ lrmd__init_remote_key(gnutls_datum_t *key)
bool env_is_fallback = false;
if (need_env) {
- env_location = getenv("PCMK_authkey_location");
+ env_location = pcmk__env_option(PCMK__ENV_AUTHKEY_LOCATION);
need_env = false;
}
@@ -1657,15 +1681,15 @@ lrmd_api_disconnect(lrmd_t * lrmd)
lrmd_private_t *native = lrmd->lrmd_private;
int rc = pcmk_ok;
- crm_info("Disconnecting %s %s executor connection",
- pcmk__client_type_str(native->type),
- (native->remote_nodename? native->remote_nodename : "local"));
switch (native->type) {
case pcmk__client_ipc:
+ crm_debug("Disconnecting from local executor");
lrmd_ipc_disconnect(lrmd);
break;
#ifdef HAVE_GNUTLS_GNUTLS_H
case pcmk__client_tls:
+ crm_debug("Disconnecting from remote executor on %s",
+ native->remote_nodename);
lrmd_tls_disconnect(lrmd);
break;
#endif
@@ -1964,8 +1988,8 @@ lrmd_api_get_metadata_params(lrmd_t *lrmd, const char *standard,
g_hash_table_insert(params_table, strdup(param->key), strdup(param->value));
}
action = services__create_resource_action(type, standard, provider, type,
- CRMD_ACTION_METADATA, 0,
- CRMD_METADATA_CALL_TIMEOUT,
+ PCMK_ACTION_META_DATA, 0,
+ PCMK_DEFAULT_METADATA_TIMEOUT_MS,
params_table, 0);
lrmd_key_value_freeall(params);
@@ -2421,14 +2445,15 @@ lrmd__metadata_async(const lrmd_rsc_info_t *rsc,
if (strcmp(rsc->standard, PCMK_RESOURCE_CLASS_STONITH) == 0) {
return stonith__metadata_async(rsc->type,
- CRMD_METADATA_CALL_TIMEOUT / 1000,
+ PCMK_DEFAULT_METADATA_TIMEOUT_MS / 1000,
callback, user_data);
}
action = services__create_resource_action(pcmk__s(rsc->id, rsc->type),
rsc->standard, rsc->provider,
- rsc->type, CRMD_ACTION_METADATA,
- 0, CRMD_METADATA_CALL_TIMEOUT,
+ rsc->type,
+ PCMK_ACTION_META_DATA, 0,
+ PCMK_DEFAULT_METADATA_TIMEOUT_MS,
NULL, 0);
if (action == NULL) {
pcmk__set_result(&result, PCMK_OCF_UNKNOWN_ERROR, PCMK_EXEC_ERROR,
@@ -2531,3 +2556,15 @@ lrmd__uptime(lrmd_t *lrmd)
return native->remote->uptime;
}
}
+
+const char *
+lrmd__node_start_state(lrmd_t *lrmd)
+{
+ lrmd_private_t *native = lrmd->lrmd_private;
+
+ if (native->remote == NULL) {
+ return NULL;
+ } else {
+ return native->remote->start_state;
+ }
+}