Skip to content

Commit cc2f6bb

Browse files
committed
Refactor: libcrmcommon: New pcmk__notice()
To replace crm_notice() Signed-off-by: Reid Wahl <[email protected]>
1 parent d86c080 commit cc2f6bb

File tree

81 files changed

+669
-602
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+669
-602
lines changed

daemons/attrd/attrd_alerts.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2015-2024 the Pacemaker project contributors
2+
* Copyright 2015-2025 the Pacemaker project contributors
33
*
44
* The version control history for this file may have further details.
55
*
@@ -87,7 +87,7 @@ config_query_callback(xmlNode * msg, int call_id, int rc, xmlNode * output, void
8787
crm_debug("Local CIB has no alerts section");
8888
return;
8989
} else if (rc != pcmk_ok) {
90-
crm_notice("Could not query local CIB: %s", pcmk_strerror(rc));
90+
pcmk__notice("Could not query local CIB: %s", pcmk_strerror(rc));
9191
return;
9292
}
9393

@@ -96,7 +96,7 @@ config_query_callback(xmlNode * msg, int call_id, int rc, xmlNode * output, void
9696
crmalerts = pcmk__xe_first_child(crmalerts, PCMK_XE_ALERTS, NULL, NULL);
9797
}
9898
if (!crmalerts) {
99-
crm_notice("CIB query result has no " PCMK_XE_ALERTS " section");
99+
pcmk__notice("CIB query result has no " PCMK_XE_ALERTS " section");
100100
return;
101101
}
102102

daemons/attrd/attrd_cib.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ attrd_cib_updated_cb(const char *event, xmlNode *msg)
9494
if (client_name == NULL) {
9595
client_name = pcmk__xe_get(msg, PCMK__XA_CIB_CLIENTID);
9696
}
97-
crm_notice("Updating all attributes after %s event triggered by %s",
98-
event, pcmk__s(client_name, "unidentified client"));
97+
pcmk__notice("Updating all attributes after %s event triggered by %s",
98+
event, pcmk__s(client_name, "unidentified client"));
9999

100100
attrd_write_attributes(attrd_write_all);
101101
}
@@ -591,9 +591,9 @@ write_attribute(attribute_t *a, bool ignore_delay)
591591
// Defer write if this is a cluster node that's never been seen
592592
if (node_xml_id == NULL) {
593593
attrd_set_attr_flags(a, attrd_attr_node_unknown);
594-
crm_notice("Cannot write %s[%s]='%s' to CIB because node's XML ID "
595-
"is unknown (will retry if learned)",
596-
a->id, v->nodename, v->current);
594+
pcmk__notice("Cannot write %s[%s]='%s' to CIB because node's XML "
595+
"ID is unknown (will retry if learned)",
596+
a->id, v->nodename, v->current);
597597
continue;
598598
}
599599

daemons/attrd/attrd_corosync.c

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -261,18 +261,24 @@ update_attr_on_host(attribute_t *a, const pcmk__node_status_t *peer,
261261
* kept in sync.
262262
*/
263263
v = g_hash_table_lookup(a->values, attrd_cluster->priv->node_name);
264-
crm_notice("%s[%s]: local value '%s' takes priority over '%s' from %s",
265-
attr, host, readable_value(v), value, peer->name);
264+
pcmk__notice("%s[%s]: local value '%s' takes priority over '%s' from "
265+
"%s",
266+
attr, host, readable_value(v), value, peer->name);
266267
attrd_broadcast_value(a, v);
267268

268269
} else if (changed) {
269-
crm_notice("Setting %s[%s]%s%s: %s -> %s "
270-
QB_XS " from %s with %s write delay and node XML ID %s",
271-
attr, host, a->set_type ? " in " : "",
272-
pcmk__s(a->set_type, ""), readable_value(v),
273-
pcmk__s(value, "(unset)"), peer->name,
274-
(a->timeout_ms == 0)? "no" : pcmk__readable_interval(a->timeout_ms),
275-
pcmk__s(node_xml_id, "unknown"));
270+
const char *timeout_s = "no";
271+
272+
if (a->timeout_ms != 0) {
273+
timeout_s = pcmk__readable_interval(a->timeout_ms);
274+
}
275+
276+
pcmk__notice("Setting %s[%s]%s%s: %s -> %s "
277+
QB_XS " from %s with %s write delay and node XML ID %s",
278+
attr, host, ((a->set_type != NULL)? " in " : ""),
279+
pcmk__s(a->set_type, ""), readable_value(v),
280+
pcmk__s(value, "(unset)"), peer->name, timeout_s,
281+
pcmk__s(node_xml_id, "unknown"));
276282
pcmk__str_update(&v->current, value);
277283
attrd_set_attr_flags(a, attrd_attr_changed);
278284

@@ -528,9 +534,9 @@ attrd_peer_remove(const char *host, bool uncache, const char *source)
528534
GHashTableIter aIter;
529535

530536
CRM_CHECK(host != NULL, return);
531-
crm_notice("Removing all %s attributes for node %s "
532-
QB_XS " %s reaping node from cache",
533-
host, source, (uncache? "and" : "without"));
537+
pcmk__notice("Removing all %s attributes for node %s "
538+
QB_XS " %s reaping node from cache",
539+
host, source, (uncache? "and" : "without"));
534540

535541
g_hash_table_iter_init(&aIter, attributes);
536542
while (g_hash_table_iter_next(&aIter, NULL, (gpointer *) & a)) {

daemons/attrd/attrd_elections.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,14 @@ attrd_check_for_new_writer(const pcmk__node_status_t *peer, const xmlNode *xml)
113113
if ((election_state(attrd_cluster) == election_won)
114114
&& !pcmk__str_eq(peer->name, attrd_cluster->priv->node_name,
115115
pcmk__str_casei)) {
116-
crm_notice("Detected another attribute writer (%s), starting new "
117-
"election",
118-
peer->name);
116+
pcmk__notice("Detected another attribute writer (%s), starting new "
117+
"election",
118+
peer->name);
119119
election_vote(attrd_cluster);
120120

121121
} else if (!pcmk__str_eq(peer->name, peer_writer, pcmk__str_casei)) {
122-
crm_notice("Recorded new attribute writer: %s (was %s)",
123-
peer->name, pcmk__s(peer_writer, "unset"));
122+
pcmk__notice("Recorded new attribute writer: %s (was %s)",
123+
peer->name, pcmk__s(peer_writer, "unset"));
124124
pcmk__str_update(&peer_writer, peer->name);
125125
}
126126
}
@@ -130,8 +130,8 @@ attrd_check_for_new_writer(const pcmk__node_status_t *peer, const xmlNode *xml)
130130
void
131131
attrd_declare_winner(void)
132132
{
133-
crm_notice("Recorded local node as attribute writer (was %s)",
134-
(peer_writer? peer_writer : "unset"));
133+
pcmk__notice("Recorded local node as attribute writer (was %s)",
134+
pcmk__s(peer_writer, "unset"));
135135
pcmk__str_update(&peer_writer, attrd_cluster->priv->node_name);
136136
}
137137

@@ -144,7 +144,7 @@ attrd_remove_voter(const pcmk__node_status_t *peer)
144144

145145
free(peer_writer);
146146
peer_writer = NULL;
147-
crm_notice("Lost attribute writer %s", peer->name);
147+
pcmk__notice("Lost attribute writer %s", peer->name);
148148

149149
/* Clear any election dampening in effect. Otherwise, if the lost writer
150150
* had just won, the election could fizzle out with no new writer.

daemons/attrd/attrd_sync.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,8 @@ attrd_ack_waitlist_clients(enum attrd_sync_point sync_point, const xmlNode *xml)
254254
return;
255255
}
256256

257-
crm_notice("Alerting client %s for reached %s sync point",
258-
wl->client_id, sync_point_str(wl->sync_point));
257+
pcmk__notice("Alerting client %s for reached %s sync point",
258+
wl->client_id, sync_point_str(wl->sync_point));
259259

260260
client = pcmk__find_client_by_id(wl->client_id);
261261
if (client == NULL) {

daemons/attrd/pacemaker-attrd.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ main(int argc, char **argv)
134134
pcmk__add_logfiles(log_files, out);
135135

136136
crm_log_init(PCMK__VALUE_ATTRD, LOG_INFO, TRUE, FALSE, argc, argv, FALSE);
137-
crm_notice("Starting Pacemaker node attribute manager%s",
138-
stand_alone ? " in standalone mode" : "");
137+
pcmk__notice("Starting Pacemaker node attribute manager%s",
138+
(stand_alone ? " in standalone mode" : ""));
139139

140140
if (ipc_already_running()) {
141141
attrd_exit_status = CRM_EX_OK;
@@ -187,7 +187,8 @@ main(int argc, char **argv)
187187
attrd_broadcast_protocol();
188188

189189
attrd_init_ipc();
190-
crm_notice("Pacemaker node attribute manager successfully started and accepting connections");
190+
pcmk__notice("Pacemaker node attribute manager successfully started and "
191+
"accepting connections");
191192
attrd_run_mainloop();
192193

193194
done:

daemons/based/based_callbacks.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -456,15 +456,16 @@ process_ping_reply(xmlNode *reply)
456456
num_updates_s = pcmk__xe_get(remote_cib, PCMK_XA_NUM_UPDATES);
457457
}
458458

459-
crm_notice("Local CIB %s.%s.%s.%s differs from %s: %s.%s.%s.%s %p",
460-
pcmk__xe_get(the_cib, PCMK_XA_ADMIN_EPOCH),
461-
pcmk__xe_get(the_cib, PCMK_XA_EPOCH),
462-
pcmk__xe_get(the_cib, PCMK_XA_NUM_UPDATES),
463-
ping_digest, host,
464-
pcmk__s(admin_epoch_s, "_"),
465-
pcmk__s(epoch_s, "_"),
466-
pcmk__s(num_updates_s, "_"),
467-
digest, remote_cib);
459+
pcmk__notice("Local CIB %s.%s.%s.%s differs from %s: %s.%s.%s.%s "
460+
"%p",
461+
pcmk__xe_get(the_cib, PCMK_XA_ADMIN_EPOCH),
462+
pcmk__xe_get(the_cib, PCMK_XA_EPOCH),
463+
pcmk__xe_get(the_cib, PCMK_XA_NUM_UPDATES),
464+
ping_digest, host,
465+
pcmk__s(admin_epoch_s, "_"),
466+
pcmk__s(epoch_s, "_"),
467+
pcmk__s(num_updates_s, "_"),
468+
digest, remote_cib);
468469

469470
if(remote_cib && remote_cib->children) {
470471
// Additional debug
@@ -1233,8 +1234,8 @@ cib_peer_callback(xmlNode * msg, void *private_data)
12331234
static gboolean
12341235
cib_force_exit(gpointer data)
12351236
{
1236-
crm_notice("Exiting immediately after %s without shutdown acknowledgment",
1237-
pcmk__readable_interval(EXIT_ESCALATION_MS));
1237+
pcmk__notice("Exiting immediately after %s without shutdown acknowledgment",
1238+
pcmk__readable_interval(EXIT_ESCALATION_MS));
12381239
terminate_cib(CRM_EX_ERROR);
12391240
return FALSE;
12401241
}

daemons/based/based_io.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,9 @@ readCibXmlFile(const char *dir, const char *file, gboolean discard_status)
203203

204204
rc = cib_file_read_and_verify(filename, sigfile, &root);
205205
if (rc == pcmk_ok) {
206-
crm_notice("Loaded CIB from last valid backup %s (with digest %s)",
207-
filename, sigfile);
206+
pcmk__notice("Loaded CIB from last valid backup %s (with digest "
207+
"%s)",
208+
filename, sigfile);
208209
} else {
209210
pcmk__warn("Not using next most recent CIB backup from %s (with "
210211
"digest %s): %s",

daemons/based/based_messages.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ cib_process_upgrade_server(const char *op, int options, const char *section, xml
231231
xmlNode *up = pcmk__xe_create(NULL, __func__);
232232

233233
rc = pcmk_ok;
234-
crm_notice("Upgrade request from %s verified", host);
234+
pcmk__notice("Upgrade request from %s verified", host);
235235

236236
pcmk__xe_set(up, PCMK__XA_T, PCMK__VALUE_CIB);
237237
pcmk__xe_set(up, PCMK__XA_CIB_OP, PCMK__CIB_REQUEST_UPGRADE);
@@ -319,9 +319,10 @@ cib_server_process_diff(const char *op, int options, const char *section, xmlNod
319319
&diff_del_admin_epoch, &diff_del_epoch, &diff_del_updates);
320320

321321
sync_in_progress++;
322-
crm_notice("Not applying diff %d.%d.%d -> %d.%d.%d (sync in progress)",
323-
diff_del_admin_epoch, diff_del_epoch, diff_del_updates,
324-
diff_add_admin_epoch, diff_add_epoch, diff_add_updates);
322+
pcmk__notice("Not applying diff %d.%d.%d -> %d.%d.%d (sync in "
323+
"progress)",
324+
diff_del_admin_epoch, diff_del_epoch, diff_del_updates,
325+
diff_add_admin_epoch, diff_add_epoch, diff_add_updates);
325326
return -pcmk_err_diff_resync;
326327
}
327328

daemons/based/based_notify.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ cib_notify_send(const xmlNode *xml)
117117
pcmk__foreach_ipc_client(cib_notify_send_one, &update);
118118

119119
} else {
120-
crm_notice("Could not notify clients: %s " QB_XS " rc=%d",
121-
pcmk_rc_str(rc), rc);
120+
pcmk__notice("Could not notify clients: %s " QB_XS " rc=%d",
121+
pcmk_rc_str(rc), rc);
122122
}
123123
pcmk_free_ipc_event(iov);
124124
}

0 commit comments

Comments
 (0)