diff --git a/backport-Log-pacemaker-based-client-name-can-be-NULL.patch b/backport-Log-pacemaker-based-client-name-can-be-NULL.patch new file mode 100644 index 0000000000000000000000000000000000000000..10f315bbfd6e965633acbd4b1f0aaec97f46ebff --- /dev/null +++ b/backport-Log-pacemaker-based-client-name-can-be-NULL.patch @@ -0,0 +1,51 @@ +From 78e350275174883f64ca36ffd0523735a3ece2b2 Mon Sep 17 00:00:00 2001 +From: Ken Gaillot +Date: Tue, 30 Jul 2024 17:27:14 -0500 +Subject: [PATCH] Log: pacemaker-based: client name can be NULL + +--- + daemons/based/based_callbacks.c | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +diff --git a/daemons/based/based_callbacks.c b/daemons/based/based_callbacks.c +index 8925d007c4..1390423c32 100644 +--- a/daemons/based/based_callbacks.c ++++ b/daemons/based/based_callbacks.c +@@ -1083,10 +1083,12 @@ cib_process_request(xmlNode *request, gboolean privileged, + + if (cib_client == NULL) { + crm_trace("Processing peer %s operation from %s/%s on %s intended for %s (reply=%s)", +- op, client_name, call_id, originator, target, reply_to); ++ op, pcmk__s(client_name, "client"), call_id, originator, ++ target, reply_to); + } else { + crm_xml_add(request, PCMK__XA_SRC, OUR_NODENAME); +- crm_trace("Processing local %s operation from %s/%s intended for %s", op, client_name, call_id, target); ++ crm_trace("Processing local %s operation from %s/%s intended for %s", ++ op, pcmk__s(client_name, "client"), call_id, target); + } + + rc = cib__get_operation(op, &operation); +@@ -1194,7 +1196,8 @@ cib_process_request(xmlNode *request, gboolean privileged, + do_crm_log(level, + "Completed %s operation for section %s: %s (rc=%d, origin=%s/%s/%s, version=%s.%s.%s)", + op, section ? section : "'all'", pcmk_strerror(rc), rc, +- originator ? originator : "local", client_name, call_id, ++ originator ? originator : "local", ++ pcmk__s(client_name, "client"), call_id, + pcmk__s(admin_epoch_s, "0"), + pcmk__s(epoch_s, "0"), + pcmk__s(num_updates_s, "0")); +@@ -1215,7 +1218,8 @@ cib_process_request(xmlNode *request, gboolean privileged, + + if (is_update && !cib_legacy_mode()) { + crm_trace("Completed pre-sync update from %s/%s/%s%s", +- originator ? originator : "local", client_name, call_id, ++ originator ? originator : "local", ++ pcmk__s(client_name, "client"), call_id, + local_notify?" with local notification":""); + + } else if (!needs_reply || stand_alone) { +-- +2.25.1 + diff --git a/backport-Refactor-libcib-drop-op_common.patch b/backport-Refactor-libcib-drop-op_common.patch new file mode 100644 index 0000000000000000000000000000000000000000..0497657067fb477a7cdbd24b184e4069d351e774 --- /dev/null +++ b/backport-Refactor-libcib-drop-op_common.patch @@ -0,0 +1,208 @@ +From 300dbeb2d6e3a9be7b73e627c751373b82b95ee0 Mon Sep 17 00:00:00 2001 +From: Ken Gaillot +Date: Tue, 30 Jul 2024 17:32:21 -0500 +Subject: [PATCH] Refactor: libcib: drop op_common() + +It's more obscure than helpful +--- + lib/cib/cib_client.c | 32 +++++++------------------------- + lib/cib/cib_utils.c | 18 ++++++++++++------ + 2 files changed, 19 insertions(+), 31 deletions(-) + +diff --git a/lib/cib/cib_client.c b/lib/cib/cib_client.c +index c98042915e..40ede8e713 100644 +--- a/lib/cib/cib_client.c ++++ b/lib/cib/cib_client.c +@@ -26,14 +26,6 @@ + + static GHashTable *cib_op_callback_table = NULL; + +-#define op_common(cib) do { \ +- if(cib == NULL) { \ +- return -EINVAL; \ +- } else if(cib->delegate_fn == NULL) { \ +- return -EPROTONOSUPPORT; \ +- } \ +- } while(0) +- + static int + cib_client_set_op_callback(cib_t *cib, + void (*callback) (const xmlNode * msg, int call_id, +@@ -250,7 +242,6 @@ cib_client_register_callback(cib_t *cib, int call_id, int timeout, + static int + cib_client_noop(cib_t * cib, int call_options) + { +- op_common(cib); + return cib_internal_op(cib, PCMK__CIB_REQUEST_NOOP, NULL, NULL, NULL, NULL, + call_options, cib->user); + } +@@ -258,7 +249,6 @@ cib_client_noop(cib_t * cib, int call_options) + static int + cib_client_ping(cib_t * cib, xmlNode ** output_data, int call_options) + { +- op_common(cib); + return cib_internal_op(cib, CRM_OP_PING, NULL, NULL, NULL, output_data, + call_options, cib->user); + } +@@ -273,7 +263,6 @@ static int + cib_client_query_from(cib_t * cib, const char *host, const char *section, + xmlNode ** output_data, int call_options) + { +- op_common(cib); + return cib_internal_op(cib, PCMK__CIB_REQUEST_QUERY, host, section, NULL, + output_data, call_options, cib->user); + } +@@ -281,7 +270,6 @@ cib_client_query_from(cib_t * cib, const char *host, const char *section, + static int + is_primary(cib_t *cib) + { +- op_common(cib); + return cib_internal_op(cib, PCMK__CIB_REQUEST_IS_PRIMARY, NULL, NULL, NULL, + NULL, cib_scope_local|cib_sync_call, cib->user); + } +@@ -289,7 +277,6 @@ is_primary(cib_t *cib) + static int + set_secondary(cib_t *cib, int call_options) + { +- op_common(cib); + return cib_internal_op(cib, PCMK__CIB_REQUEST_SECONDARY, NULL, NULL, NULL, + NULL, call_options, cib->user); + } +@@ -303,7 +290,6 @@ set_all_secondary(cib_t * cib, int call_options) + static int + set_primary(cib_t *cib, int call_options) + { +- op_common(cib); + crm_trace("Adding cib_scope_local to options"); + return cib_internal_op(cib, PCMK__CIB_REQUEST_PRIMARY, NULL, NULL, NULL, + NULL, call_options|cib_scope_local, cib->user); +@@ -312,7 +298,6 @@ set_primary(cib_t *cib, int call_options) + static int + cib_client_bump_epoch(cib_t * cib, int call_options) + { +- op_common(cib); + return cib_internal_op(cib, PCMK__CIB_REQUEST_BUMP, NULL, NULL, NULL, NULL, + call_options, cib->user); + } +@@ -320,7 +305,6 @@ cib_client_bump_epoch(cib_t * cib, int call_options) + static int + cib_client_upgrade(cib_t * cib, int call_options) + { +- op_common(cib); + return cib_internal_op(cib, PCMK__CIB_REQUEST_UPGRADE, NULL, NULL, NULL, + NULL, call_options, cib->user); + } +@@ -334,7 +318,6 @@ cib_client_sync(cib_t * cib, const char *section, int call_options) + static int + cib_client_sync_from(cib_t * cib, const char *host, const char *section, int call_options) + { +- op_common(cib); + return cib_internal_op(cib, PCMK__CIB_REQUEST_SYNC_TO_ALL, host, section, + NULL, NULL, call_options, cib->user); + } +@@ -342,7 +325,6 @@ cib_client_sync_from(cib_t * cib, const char *host, const char *section, int cal + static int + cib_client_create(cib_t * cib, const char *section, xmlNode * data, int call_options) + { +- op_common(cib); + return cib_internal_op(cib, PCMK__CIB_REQUEST_CREATE, NULL, section, data, + NULL, call_options, cib->user); + } +@@ -350,7 +332,6 @@ cib_client_create(cib_t * cib, const char *section, xmlNode * data, int call_opt + static int + cib_client_modify(cib_t * cib, const char *section, xmlNode * data, int call_options) + { +- op_common(cib); + return cib_internal_op(cib, PCMK__CIB_REQUEST_MODIFY, NULL, section, data, + NULL, call_options, cib->user); + } +@@ -358,7 +339,6 @@ cib_client_modify(cib_t * cib, const char *section, xmlNode * data, int call_opt + static int + cib_client_replace(cib_t * cib, const char *section, xmlNode * data, int call_options) + { +- op_common(cib); + return cib_internal_op(cib, PCMK__CIB_REQUEST_REPLACE, NULL, section, data, + NULL, call_options, cib->user); + } +@@ -366,7 +346,6 @@ cib_client_replace(cib_t * cib, const char *section, xmlNode * data, int call_op + static int + cib_client_delete(cib_t * cib, const char *section, xmlNode * data, int call_options) + { +- op_common(cib); + return cib_internal_op(cib, PCMK__CIB_REQUEST_DELETE, NULL, section, data, + NULL, call_options, cib->user); + } +@@ -374,7 +353,6 @@ cib_client_delete(cib_t * cib, const char *section, xmlNode * data, int call_opt + static int + cib_client_delete_absolute(cib_t * cib, const char *section, xmlNode * data, int call_options) + { +- op_common(cib); + return cib_internal_op(cib, PCMK__CIB_REQUEST_ABS_DELETE, NULL, section, + data, NULL, call_options, cib->user); + } +@@ -382,7 +360,6 @@ cib_client_delete_absolute(cib_t * cib, const char *section, xmlNode * data, int + static int + cib_client_erase(cib_t * cib, xmlNode ** output_data, int call_options) + { +- op_common(cib); + return cib_internal_op(cib, PCMK__CIB_REQUEST_ERASE, NULL, NULL, NULL, + output_data, call_options, cib->user); + } +@@ -392,7 +369,9 @@ cib_client_init_transaction(cib_t *cib) + { + int rc = pcmk_rc_ok; + +- op_common(cib); ++ if (cib == NULL) { ++ return -EINVAL; ++ } + + if (cib->transaction != NULL) { + // A client can have at most one transaction at a time +@@ -419,7 +398,10 @@ cib_client_end_transaction(cib_t *cib, bool commit, int call_options) + const char *client_id = NULL; + int rc = pcmk_ok; + +- op_common(cib); ++ if (cib == NULL) { ++ return -EINVAL; ++ } ++ + cib->cmds->client_id(cib, NULL, &client_id); + client_id = pcmk__s(client_id, "(unidentified)"); + +diff --git a/lib/cib/cib_utils.c b/lib/cib/cib_utils.c +index 34652dc97a..f868f11397 100644 +--- a/lib/cib/cib_utils.c ++++ b/lib/cib/cib_utils.c +@@ -884,15 +884,21 @@ cib_internal_op(cib_t * cib, const char *op, const char *host, + const char *section, xmlNode * data, + xmlNode ** output_data, int call_options, const char *user_name) + { +- int (*delegate) (cib_t * cib, const char *op, const char *host, +- const char *section, xmlNode * data, +- xmlNode ** output_data, int call_options, const char *user_name) = +- cib->delegate_fn; ++ int (*delegate)(cib_t *cib, const char *op, const char *host, ++ const char *section, xmlNode *data, xmlNode **output_data, ++ int call_options, const char *user_name) = NULL; + +- if(user_name == NULL) { +- user_name = getenv("CIB_user"); ++ if (cib == NULL) { ++ return -EINVAL; + } + ++ delegate = cib->delegate_fn; ++ if (delegate == NULL) { ++ return -EPROTONOSUPPORT; ++ } ++ if (user_name == NULL) { ++ user_name = getenv("CIB_user"); ++ } + return delegate(cib, op, host, section, data, output_data, call_options, user_name); + } + +-- +2.25.1 + diff --git a/pacemaker.spec b/pacemaker.spec index d59425ac7eb1799ba31eedbe64c97ec9d092f0a8..018ba9b83f92aef1c25d9c2e4664eded30ecf5d5 100644 --- a/pacemaker.spec +++ b/pacemaker.spec @@ -17,7 +17,7 @@ ## can be incremented to build packages reliably considered "newer" ## than previously built packages with the same pcmkversion) %global pcmkversion 2.1.8 -%global specversion 4 +%global specversion 5 ## Upstream commit (full commit ID, abbreviated commit ID, or tag) to build %global commit 3980678f0372f2c7c294c01f61d63f0b2cafaad1 @@ -159,6 +159,8 @@ Patch3: backport-Low-controller-libpacemaker-transition-graph-IDs-sho.pat Patch4: backport-Test-cts-scheduler-update-expected-graph-outputs-for.patch Patch5: backport-Refactor-libpacemaker-de-inline-pcmk__colocation_has.patch Patch6: backport-Log-various-ensure-there-are-spaces-around-CRM_XS.patch +Patch7: backport-Log-pacemaker-based-client-name-can-be-NULL.patch +Patch8: backport-Refactor-libcib-drop-op_common.patch Requires: resource-agents Requires: %{pkgname_pcmk_libs} = %{version}-%{release} @@ -766,6 +768,10 @@ exit 0 %license %{nagios_name}-%{nagios_hash}/COPYING %changelog +* Tue Dec 10 2024 bixiaoyan - 2.1.8-5 +- Log: pacemaker-based: client name can be NULL +- Refactor: libcib: drop op_common() + * Mon Dec 09 2024 liupei - 2.1.8-4 - Refactor: libpacemaker: de-inline pcmk__colocation_has_influence() - Log: various: ensure there are spaces around CRM_XS