Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
...
  • 10 commits
  • 24 files changed
  • 0 commit comments
  • 1 contributor
Commits on Jan 16, 2012
@beekhof High: Corosync: Default to using the nodeid as the node's uuid (inste…
…ad of uname)
ffa5ed6
Commits on Jan 17, 2012
@beekhof High: Fencing: Standardize on /one/ method for clients to request mem…
…bers be fenced

Allow the uname to be provided if the caller knows it, otherwise default
to the corosync node id.

Remove logging from stonith_api_time, let the caller do some if they
want to.

Rename the functions to be less corosync specific (none have appeared in
a release so now is the time).
fc47414
@beekhof Medium: Fencing: Remove our logging from an API call designed to be u…
…sed externally
b583598
@beekhof High: Fencing: Fix segfault caused by passing garbage to dlsym() 6635e90
@beekhof Medium: Fencing: crm_system_name likely wont be set by callers of sto…
…nith_api_kick()
96650df
@beekhof High: Core: correctly inherit the debug when using libqb
Also allow it to be enabled on a per daemon basis with PCMK_debug and
for stderr to be configurable in the same way.
4c726c1
@beekhof Low: Convert use of do_crm_log_unlikely to crm_trace 0ae1153
@beekhof Medium: Core: Don't do any work constructing arguments if the log wil…
…l be discarded
d9ffe51
@beekhof Low: mcp: Less verbose logging 8de7f5d
Commits on Jan 18, 2012
@beekhof Convert triggers from mainloop to qbloop de4b7b4
View
2 cib/main.c
@@ -299,7 +299,7 @@ cib_stats(gpointer data)
(100 * cib_calls_ms) / cib_stat_interval_ms, cib_stat_interval);
}
- do_crm_log_unlikely(local_log_level + 1,
+ crm_trace(
"\tDetail: %lu operations (%ums total)"
" (%lu local, %lu updates, %lu failures,"
" %lu timeouts, %lu bad connects)",
View
1 crmd/control.c
@@ -872,6 +872,7 @@ create_cib_node_definition(gpointer key, gpointer value, gpointer user_data)
xmlNode *cib_nodes = user_data;
xmlNode *cib_new_node = NULL;
+ crm_trace("Creating node entry for %s/%s", node->uname, node->uuid);
cib_new_node = create_xml_node(cib_nodes, XML_CIB_TAG_NODE);
crm_xml_add(cib_new_node, XML_ATTR_ID, node->uuid);
crm_xml_add(cib_new_node, XML_ATTR_UNAME, node->uname);
View
2 crmd/fsa.c
@@ -70,7 +70,7 @@ extern GHashTable *integrated_nodes;
extern void initialize_join(gboolean before);
#define DOT_PREFIX "actions:trace: "
-#define do_dot_log(fmt, args...) do_crm_log_unlikely(LOG_DEBUG_2, fmt, ##args)
+#define do_dot_log(fmt, args...) crm_trace( fmt, ##args)
long long do_state_transition(long long actions,
enum crmd_fsa_state cur_state,
View
156 crmd/utils.c
@@ -667,268 +667,266 @@ fsa_dump_inputs(int log_level, const char *text, long long input_register)
}
if (is_set(input_register, R_THE_DC)) {
- do_crm_log_unlikely(log_level, "%s %.16llx (R_THE_DC)", text, R_THE_DC);
+ crm_trace( "%s %.16llx (R_THE_DC)", text, R_THE_DC);
}
if (is_set(input_register, R_STARTING)) {
- do_crm_log_unlikely(log_level, "%s %.16llx (R_STARTING)", text, R_STARTING);
+ crm_trace( "%s %.16llx (R_STARTING)", text, R_STARTING);
}
if (is_set(input_register, R_SHUTDOWN)) {
- do_crm_log_unlikely(log_level, "%s %.16llx (R_SHUTDOWN)", text, R_SHUTDOWN);
+ crm_trace( "%s %.16llx (R_SHUTDOWN)", text, R_SHUTDOWN);
}
if (is_set(input_register, R_STAYDOWN)) {
- do_crm_log_unlikely(log_level, "%s %.16llx (R_STAYDOWN)", text, R_STAYDOWN);
+ crm_trace( "%s %.16llx (R_STAYDOWN)", text, R_STAYDOWN);
}
if (is_set(input_register, R_JOIN_OK)) {
- do_crm_log_unlikely(log_level, "%s %.16llx (R_JOIN_OK)", text, R_JOIN_OK);
+ crm_trace( "%s %.16llx (R_JOIN_OK)", text, R_JOIN_OK);
}
if (is_set(input_register, R_READ_CONFIG)) {
- do_crm_log_unlikely(log_level, "%s %.16llx (R_READ_CONFIG)", text, R_READ_CONFIG);
+ crm_trace( "%s %.16llx (R_READ_CONFIG)", text, R_READ_CONFIG);
}
if (is_set(input_register, R_INVOKE_PE)) {
- do_crm_log_unlikely(log_level, "%s %.16llx (R_INVOKE_PE)", text, R_INVOKE_PE);
+ crm_trace( "%s %.16llx (R_INVOKE_PE)", text, R_INVOKE_PE);
}
if (is_set(input_register, R_CIB_CONNECTED)) {
- do_crm_log_unlikely(log_level, "%s %.16llx (R_CIB_CONNECTED)", text, R_CIB_CONNECTED);
+ crm_trace( "%s %.16llx (R_CIB_CONNECTED)", text, R_CIB_CONNECTED);
}
if (is_set(input_register, R_PE_CONNECTED)) {
- do_crm_log_unlikely(log_level, "%s %.16llx (R_PE_CONNECTED)", text, R_PE_CONNECTED);
+ crm_trace( "%s %.16llx (R_PE_CONNECTED)", text, R_PE_CONNECTED);
}
if (is_set(input_register, R_TE_CONNECTED)) {
- do_crm_log_unlikely(log_level, "%s %.16llx (R_TE_CONNECTED)", text, R_TE_CONNECTED);
+ crm_trace( "%s %.16llx (R_TE_CONNECTED)", text, R_TE_CONNECTED);
}
if (is_set(input_register, R_LRM_CONNECTED)) {
- do_crm_log_unlikely(log_level, "%s %.16llx (R_LRM_CONNECTED)", text, R_LRM_CONNECTED);
+ crm_trace( "%s %.16llx (R_LRM_CONNECTED)", text, R_LRM_CONNECTED);
}
if (is_set(input_register, R_CIB_REQUIRED)) {
- do_crm_log_unlikely(log_level, "%s %.16llx (R_CIB_REQUIRED)", text, R_CIB_REQUIRED);
+ crm_trace( "%s %.16llx (R_CIB_REQUIRED)", text, R_CIB_REQUIRED);
}
if (is_set(input_register, R_PE_REQUIRED)) {
- do_crm_log_unlikely(log_level, "%s %.16llx (R_PE_REQUIRED)", text, R_PE_REQUIRED);
+ crm_trace( "%s %.16llx (R_PE_REQUIRED)", text, R_PE_REQUIRED);
}
if (is_set(input_register, R_TE_REQUIRED)) {
- do_crm_log_unlikely(log_level, "%s %.16llx (R_TE_REQUIRED)", text, R_TE_REQUIRED);
+ crm_trace( "%s %.16llx (R_TE_REQUIRED)", text, R_TE_REQUIRED);
}
if (is_set(input_register, R_REQ_PEND)) {
- do_crm_log_unlikely(log_level, "%s %.16llx (R_REQ_PEND)", text, R_REQ_PEND);
+ crm_trace( "%s %.16llx (R_REQ_PEND)", text, R_REQ_PEND);
}
if (is_set(input_register, R_PE_PEND)) {
- do_crm_log_unlikely(log_level, "%s %.16llx (R_PE_PEND)", text, R_PE_PEND);
+ crm_trace( "%s %.16llx (R_PE_PEND)", text, R_PE_PEND);
}
if (is_set(input_register, R_TE_PEND)) {
- do_crm_log_unlikely(log_level, "%s %.16llx (R_TE_PEND)", text, R_TE_PEND);
+ crm_trace( "%s %.16llx (R_TE_PEND)", text, R_TE_PEND);
}
if (is_set(input_register, R_RESP_PEND)) {
- do_crm_log_unlikely(log_level, "%s %.16llx (R_RESP_PEND)", text, R_RESP_PEND);
+ crm_trace( "%s %.16llx (R_RESP_PEND)", text, R_RESP_PEND);
}
if (is_set(input_register, R_CIB_DONE)) {
- do_crm_log_unlikely(log_level, "%s %.16llx (R_CIB_DONE)", text, R_CIB_DONE);
+ crm_trace( "%s %.16llx (R_CIB_DONE)", text, R_CIB_DONE);
}
if (is_set(input_register, R_HAVE_CIB)) {
- do_crm_log_unlikely(log_level, "%s %.16llx (R_HAVE_CIB)", text, R_HAVE_CIB);
+ crm_trace( "%s %.16llx (R_HAVE_CIB)", text, R_HAVE_CIB);
}
if (is_set(input_register, R_CIB_ASKED)) {
- do_crm_log_unlikely(log_level, "%s %.16llx (R_CIB_ASKED)", text, R_CIB_ASKED);
+ crm_trace( "%s %.16llx (R_CIB_ASKED)", text, R_CIB_ASKED);
}
if (is_set(input_register, R_CCM_DATA)) {
- do_crm_log_unlikely(log_level, "%s %.16llx (R_CCM_DATA)", text, R_CCM_DATA);
+ crm_trace( "%s %.16llx (R_CCM_DATA)", text, R_CCM_DATA);
}
if (is_set(input_register, R_PEER_DATA)) {
- do_crm_log_unlikely(log_level, "%s %.16llx (R_PEER_DATA)", text, R_PEER_DATA);
+ crm_trace( "%s %.16llx (R_PEER_DATA)", text, R_PEER_DATA);
}
if (is_set(input_register, R_IN_RECOVERY)) {
- do_crm_log_unlikely(log_level, "%s %.16llx (R_IN_RECOVERY)", text, R_IN_RECOVERY);
+ crm_trace( "%s %.16llx (R_IN_RECOVERY)", text, R_IN_RECOVERY);
}
}
void
fsa_dump_actions(long long action, const char *text)
{
- int log_level = LOG_DEBUG_3;
-
if (is_set(action, A_READCONFIG)) {
- do_crm_log_unlikely(log_level, "Action %.16llx (A_READCONFIG) %s", A_READCONFIG, text);
+ crm_trace( "Action %.16llx (A_READCONFIG) %s", A_READCONFIG, text);
}
if (is_set(action, A_STARTUP)) {
- do_crm_log_unlikely(log_level, "Action %.16llx (A_STARTUP) %s", A_STARTUP, text);
+ crm_trace( "Action %.16llx (A_STARTUP) %s", A_STARTUP, text);
}
if (is_set(action, A_STARTED)) {
- do_crm_log_unlikely(log_level, "Action %.16llx (A_STARTED) %s", A_STARTED, text);
+ crm_trace( "Action %.16llx (A_STARTED) %s", A_STARTED, text);
}
if (is_set(action, A_HA_CONNECT)) {
- do_crm_log_unlikely(log_level, "Action %.16llx (A_CONNECT) %s", A_HA_CONNECT, text);
+ crm_trace( "Action %.16llx (A_CONNECT) %s", A_HA_CONNECT, text);
}
if (is_set(action, A_HA_DISCONNECT)) {
- do_crm_log_unlikely(log_level, "Action %.16llx (A_DISCONNECT) %s", A_HA_DISCONNECT, text);
+ crm_trace( "Action %.16llx (A_DISCONNECT) %s", A_HA_DISCONNECT, text);
}
if (is_set(action, A_LRM_CONNECT)) {
- do_crm_log_unlikely(log_level, "Action %.16llx (A_LRM_CONNECT) %s", A_LRM_CONNECT, text);
+ crm_trace( "Action %.16llx (A_LRM_CONNECT) %s", A_LRM_CONNECT, text);
}
if (is_set(action, A_LRM_EVENT)) {
- do_crm_log_unlikely(log_level, "Action %.16llx (A_LRM_EVENT) %s", A_LRM_EVENT, text);
+ crm_trace( "Action %.16llx (A_LRM_EVENT) %s", A_LRM_EVENT, text);
}
if (is_set(action, A_LRM_INVOKE)) {
- do_crm_log_unlikely(log_level, "Action %.16llx (A_LRM_INVOKE) %s", A_LRM_INVOKE, text);
+ crm_trace( "Action %.16llx (A_LRM_INVOKE) %s", A_LRM_INVOKE, text);
}
if (is_set(action, A_LRM_DISCONNECT)) {
- do_crm_log_unlikely(log_level,
+ crm_trace(
"Action %.16llx (A_LRM_DISCONNECT) %s", A_LRM_DISCONNECT, text);
}
if (is_set(action, A_DC_TIMER_STOP)) {
- do_crm_log_unlikely(log_level,
+ crm_trace(
"Action %.16llx (A_DC_TIMER_STOP) %s", A_DC_TIMER_STOP, text);
}
if (is_set(action, A_DC_TIMER_START)) {
- do_crm_log_unlikely(log_level,
+ crm_trace(
"Action %.16llx (A_DC_TIMER_START) %s", A_DC_TIMER_START, text);
}
if (is_set(action, A_INTEGRATE_TIMER_START)) {
- do_crm_log_unlikely(log_level,
+ crm_trace(
"Action %.16llx (A_INTEGRATE_TIMER_START) %s",
A_INTEGRATE_TIMER_START, text);
}
if (is_set(action, A_INTEGRATE_TIMER_STOP)) {
- do_crm_log_unlikely(log_level,
+ crm_trace(
"Action %.16llx (A_INTEGRATE_TIMER_STOP) %s",
A_INTEGRATE_TIMER_STOP, text);
}
if (is_set(action, A_FINALIZE_TIMER_START)) {
- do_crm_log_unlikely(log_level,
+ crm_trace(
"Action %.16llx (A_FINALIZE_TIMER_START) %s",
A_FINALIZE_TIMER_START, text);
}
if (is_set(action, A_FINALIZE_TIMER_STOP)) {
- do_crm_log_unlikely(log_level,
+ crm_trace(
"Action %.16llx (A_FINALIZE_TIMER_STOP) %s",
A_FINALIZE_TIMER_STOP, text);
}
if (is_set(action, A_ELECTION_COUNT)) {
- do_crm_log_unlikely(log_level,
+ crm_trace(
"Action %.16llx (A_ELECTION_COUNT) %s", A_ELECTION_COUNT, text);
}
if (is_set(action, A_ELECTION_VOTE)) {
- do_crm_log_unlikely(log_level,
+ crm_trace(
"Action %.16llx (A_ELECTION_VOTE) %s", A_ELECTION_VOTE, text);
}
if (is_set(action, A_ELECTION_CHECK)) {
- do_crm_log_unlikely(log_level,
+ crm_trace(
"Action %.16llx (A_ELECTION_CHECK) %s", A_ELECTION_CHECK, text);
}
if (is_set(action, A_CL_JOIN_ANNOUNCE)) {
- do_crm_log_unlikely(log_level,
+ crm_trace(
"Action %.16llx (A_CL_JOIN_ANNOUNCE) %s", A_CL_JOIN_ANNOUNCE, text);
}
if (is_set(action, A_CL_JOIN_REQUEST)) {
- do_crm_log_unlikely(log_level,
+ crm_trace(
"Action %.16llx (A_CL_JOIN_REQUEST) %s", A_CL_JOIN_REQUEST, text);
}
if (is_set(action, A_CL_JOIN_RESULT)) {
- do_crm_log_unlikely(log_level,
+ crm_trace(
"Action %.16llx (A_CL_JOIN_RESULT) %s", A_CL_JOIN_RESULT, text);
}
if (is_set(action, A_DC_JOIN_OFFER_ALL)) {
- do_crm_log_unlikely(log_level,
+ crm_trace(
"Action %.16llx (A_DC_JOIN_OFFER_ALL) %s", A_DC_JOIN_OFFER_ALL, text);
}
if (is_set(action, A_DC_JOIN_OFFER_ONE)) {
- do_crm_log_unlikely(log_level,
+ crm_trace(
"Action %.16llx (A_DC_JOIN_OFFER_ONE) %s", A_DC_JOIN_OFFER_ONE, text);
}
if (is_set(action, A_DC_JOIN_PROCESS_REQ)) {
- do_crm_log_unlikely(log_level,
+ crm_trace(
"Action %.16llx (A_DC_JOIN_PROCESS_REQ) %s",
A_DC_JOIN_PROCESS_REQ, text);
}
if (is_set(action, A_DC_JOIN_PROCESS_ACK)) {
- do_crm_log_unlikely(log_level,
+ crm_trace(
"Action %.16llx (A_DC_JOIN_PROCESS_ACK) %s",
A_DC_JOIN_PROCESS_ACK, text);
}
if (is_set(action, A_DC_JOIN_FINALIZE)) {
- do_crm_log_unlikely(log_level,
+ crm_trace(
"Action %.16llx (A_DC_JOIN_FINALIZE) %s", A_DC_JOIN_FINALIZE, text);
}
if (is_set(action, A_MSG_PROCESS)) {
- do_crm_log_unlikely(log_level, "Action %.16llx (A_MSG_PROCESS) %s", A_MSG_PROCESS, text);
+ crm_trace( "Action %.16llx (A_MSG_PROCESS) %s", A_MSG_PROCESS, text);
}
if (is_set(action, A_MSG_ROUTE)) {
- do_crm_log_unlikely(log_level, "Action %.16llx (A_MSG_ROUTE) %s", A_MSG_ROUTE, text);
+ crm_trace( "Action %.16llx (A_MSG_ROUTE) %s", A_MSG_ROUTE, text);
}
if (is_set(action, A_RECOVER)) {
- do_crm_log_unlikely(log_level, "Action %.16llx (A_RECOVER) %s", A_RECOVER, text);
+ crm_trace( "Action %.16llx (A_RECOVER) %s", A_RECOVER, text);
}
if (is_set(action, A_DC_RELEASE)) {
- do_crm_log_unlikely(log_level, "Action %.16llx (A_DC_RELEASE) %s", A_DC_RELEASE, text);
+ crm_trace( "Action %.16llx (A_DC_RELEASE) %s", A_DC_RELEASE, text);
}
if (is_set(action, A_DC_RELEASED)) {
- do_crm_log_unlikely(log_level, "Action %.16llx (A_DC_RELEASED) %s", A_DC_RELEASED, text);
+ crm_trace( "Action %.16llx (A_DC_RELEASED) %s", A_DC_RELEASED, text);
}
if (is_set(action, A_DC_TAKEOVER)) {
- do_crm_log_unlikely(log_level, "Action %.16llx (A_DC_TAKEOVER) %s", A_DC_TAKEOVER, text);
+ crm_trace( "Action %.16llx (A_DC_TAKEOVER) %s", A_DC_TAKEOVER, text);
}
if (is_set(action, A_SHUTDOWN)) {
- do_crm_log_unlikely(log_level, "Action %.16llx (A_SHUTDOWN) %s", A_SHUTDOWN, text);
+ crm_trace( "Action %.16llx (A_SHUTDOWN) %s", A_SHUTDOWN, text);
}
if (is_set(action, A_SHUTDOWN_REQ)) {
- do_crm_log_unlikely(log_level, "Action %.16llx (A_SHUTDOWN_REQ) %s", A_SHUTDOWN_REQ, text);
+ crm_trace( "Action %.16llx (A_SHUTDOWN_REQ) %s", A_SHUTDOWN_REQ, text);
}
if (is_set(action, A_STOP)) {
- do_crm_log_unlikely(log_level, "Action %.16llx (A_STOP ) %s", A_STOP, text);
+ crm_trace( "Action %.16llx (A_STOP ) %s", A_STOP, text);
}
if (is_set(action, A_EXIT_0)) {
- do_crm_log_unlikely(log_level, "Action %.16llx (A_EXIT_0) %s", A_EXIT_0, text);
+ crm_trace( "Action %.16llx (A_EXIT_0) %s", A_EXIT_0, text);
}
if (is_set(action, A_EXIT_1)) {
- do_crm_log_unlikely(log_level, "Action %.16llx (A_EXIT_1) %s", A_EXIT_1, text);
+ crm_trace( "Action %.16llx (A_EXIT_1) %s", A_EXIT_1, text);
}
if (is_set(action, A_CCM_CONNECT)) {
- do_crm_log_unlikely(log_level, "Action %.16llx (A_CCM_CONNECT) %s", A_CCM_CONNECT, text);
+ crm_trace( "Action %.16llx (A_CCM_CONNECT) %s", A_CCM_CONNECT, text);
}
if (is_set(action, A_CCM_DISCONNECT)) {
- do_crm_log_unlikely(log_level,
+ crm_trace(
"Action %.16llx (A_CCM_DISCONNECT) %s", A_CCM_DISCONNECT, text);
}
if (is_set(action, A_CIB_START)) {
- do_crm_log_unlikely(log_level, "Action %.16llx (A_CIB_START) %s", A_CIB_START, text);
+ crm_trace( "Action %.16llx (A_CIB_START) %s", A_CIB_START, text);
}
if (is_set(action, A_CIB_STOP)) {
- do_crm_log_unlikely(log_level, "Action %.16llx (A_CIB_STOP) %s", A_CIB_STOP, text);
+ crm_trace( "Action %.16llx (A_CIB_STOP) %s", A_CIB_STOP, text);
}
if (is_set(action, A_TE_INVOKE)) {
- do_crm_log_unlikely(log_level, "Action %.16llx (A_TE_INVOKE) %s", A_TE_INVOKE, text);
+ crm_trace( "Action %.16llx (A_TE_INVOKE) %s", A_TE_INVOKE, text);
}
if (is_set(action, A_TE_START)) {
- do_crm_log_unlikely(log_level, "Action %.16llx (A_TE_START) %s", A_TE_START, text);
+ crm_trace( "Action %.16llx (A_TE_START) %s", A_TE_START, text);
}
if (is_set(action, A_TE_STOP)) {
- do_crm_log_unlikely(log_level, "Action %.16llx (A_TE_STOP) %s", A_TE_STOP, text);
+ crm_trace( "Action %.16llx (A_TE_STOP) %s", A_TE_STOP, text);
}
if (is_set(action, A_TE_CANCEL)) {
- do_crm_log_unlikely(log_level, "Action %.16llx (A_TE_CANCEL) %s", A_TE_CANCEL, text);
+ crm_trace( "Action %.16llx (A_TE_CANCEL) %s", A_TE_CANCEL, text);
}
if (is_set(action, A_PE_INVOKE)) {
- do_crm_log_unlikely(log_level, "Action %.16llx (A_PE_INVOKE) %s", A_PE_INVOKE, text);
+ crm_trace( "Action %.16llx (A_PE_INVOKE) %s", A_PE_INVOKE, text);
}
if (is_set(action, A_PE_START)) {
- do_crm_log_unlikely(log_level, "Action %.16llx (A_PE_START) %s", A_PE_START, text);
+ crm_trace( "Action %.16llx (A_PE_START) %s", A_PE_START, text);
}
if (is_set(action, A_PE_STOP)) {
- do_crm_log_unlikely(log_level, "Action %.16llx (A_PE_STOP) %s", A_PE_STOP, text);
+ crm_trace( "Action %.16llx (A_PE_STOP) %s", A_PE_STOP, text);
}
if (is_set(action, A_NODE_BLOCK)) {
- do_crm_log_unlikely(log_level, "Action %.16llx (A_NODE_BLOCK) %s", A_NODE_BLOCK, text);
+ crm_trace( "Action %.16llx (A_NODE_BLOCK) %s", A_NODE_BLOCK, text);
}
if (is_set(action, A_UPDATE_NODESTATUS)) {
- do_crm_log_unlikely(log_level,
+ crm_trace(
"Action %.16llx (A_UPDATE_NODESTATUS) %s", A_UPDATE_NODESTATUS, text);
}
if (is_set(action, A_LOG)) {
- do_crm_log_unlikely(log_level, "Action %.16llx (A_LOG ) %s", A_LOG, text);
+ crm_trace( "Action %.16llx (A_LOG ) %s", A_LOG, text);
}
if (is_set(action, A_ERROR)) {
- do_crm_log_unlikely(log_level, "Action %.16llx (A_ERROR ) %s", A_ERROR, text);
+ crm_trace( "Action %.16llx (A_ERROR ) %s", A_ERROR, text);
}
if (is_set(action, A_WARN)) {
- do_crm_log_unlikely(log_level, "Action %.16llx (A_WARN ) %s", A_WARN, text);
+ crm_trace( "Action %.16llx (A_WARN ) %s", A_WARN, text);
}
}
View
2 include/crm/common/cluster.h
@@ -35,6 +35,8 @@ extern unsigned long long crm_peer_seq;
extern void crm_peer_init(void);
extern void crm_peer_destroy(void);
+extern char *get_corosync_uuid(uint32_t id, const char *uname);
+extern const char *get_node_uuid(uint32_t id, const char *uname);
extern gboolean crm_cluster_connect(char **our_uname, char **our_uuid, void *dispatch,
void *destroy,
View
1 include/crm/common/mainloop.h
@@ -21,7 +21,6 @@
# include <glib.h>
typedef struct trigger_s {
- GSource source;
gboolean trigger;
void *user_data;
guint id;
View
2 include/crm/common/util.h
@@ -95,6 +95,8 @@ extern gboolean crm_log_init(const char *entity, int level, gboolean coredir, gb
extern gboolean crm_log_init_quiet(const char *entity, int level, gboolean coredir,
gboolean to_stderr, int argc, char **argv);
+extern gboolean daemon_option_enabled(const char *daemon, const char *option);
+
extern gboolean crm_log_init_worker(const char *entity, int level, gboolean coredir,
gboolean to_stderr, int argc, char **argv, gboolean quiet);
View
9 include/crm/crm.h
@@ -227,8 +227,13 @@ typedef GList *GListPtr;
qb_log_from_external_source( __func__, __FILE__, fmt, level, __LINE__, 0, ##args); \
} while(0)
+/* level /MUST/ be a constant or compilation will fail */
# define do_crm_log_unlikely(level, fmt, args...) do { \
- qb_log_from_external_source( __func__, __FILE__, fmt, level, __LINE__, 0, ##args); \
+ static struct qb_log_callsite trace_cs __attribute__((section("__verbose"), aligned(8))) = {__func__, __FILE__, fmt, level, __LINE__, 0, 0 }; \
+ if (trace_cs.targets) { \
+ qb_log_from_external_source( \
+ __func__, __FILE__, fmt, level, __LINE__, 0, ##args); \
+ } \
} while(0)
# define do_crm_log_xml(level, text, xml) do { \
@@ -250,7 +255,7 @@ typedef GList *GListPtr;
# define crm_notice(fmt, args...) qb_logt(LOG_NOTICE, 0, fmt , ##args)
# define crm_info(fmt, args...) qb_logt(LOG_INFO, 0, fmt , ##args)
# define crm_debug(fmt, args...) qb_logt(LOG_DEBUG, 0, fmt , ##args)
-# define crm_trace(fmt, args...) qb_logt(LOG_TRACE, 0, fmt , ##args)
+# define crm_trace(fmt, args...) do_crm_log_unlikely(LOG_TRACE, fmt , ##args)
# define CRM_LOG_ASSERT(expr) do { \
static struct qb_log_callsite core_cs __attribute__((section("__verbose"), aligned(8))) = {__func__, __FILE__, "assert-block", LOG_TRACE, __LINE__, 0, 0 }; \
View
66 include/crm/stonith-ng.h
@@ -21,6 +21,9 @@
# include <dlfcn.h>
# include <stdbool.h>
+/* TO-DO: Work out how to drop this requirement */
+# include <libxml/tree.h>
+
/* *INDENT-OFF* */
enum stonith_state {
stonith_connected_command,
@@ -223,66 +226,93 @@ extern stonith_key_value_t *stonith_key_value_add(stonith_key_value_t * kvp, con
const char *value);
extern void stonith_key_value_freeall(stonith_key_value_t * kvp, int keys, int values);
+/* Basic helpers that allows nodes to be fenced and the history to be
+ * queried without mainloop or the caller understanding the full API
+ *
+ * At least one of nodeid and uname are required
+ */
+extern int stonith_api_kick(int nodeid, const char *uname, int timeout, bool off);
+extern time_t stonith_api_time(int nodeid, const char *uname, bool in_progress);
/*
- * Helpers for initiating fencing from CPG based controld's
- * that avoid the need for install-time dependancies
+ * Helpers for using the above functions without install-time dependancies
*
* Usage:
* #include <crm/stonith-ng.h>
*
- * To turn a node off:
- * stonith_api_kick_cs_helper(nodeid, 120, 1);
+ * To turn a node off by corosync nodeid:
+ * stonith_api_kick_helper(nodeid, 120, 1);
*
- * To check the last fence date/time:
- * last = stonith_api_time_cs_helper(nodeid, 0);
+ * To check the last fence date/time (also by nodeid):
+ * last = stonith_api_time_helper(nodeid, 0);
*
* To check if fencing is in progress:
- * if(stonith_api_time_cs_helper(nodeid, 1) > 0) { ... }
+ * if(stonith_api_time_helper(nodeid, 1) > 0) { ... }
*
+ * eg.
+
+ #include <stdio.h>
+ #include <time.h>
+ #include <crm/stonith-ng.h>
+ int
+ main(int argc, char ** argv)
+ {
+ int rc = 0;
+ int nodeid = 102;
+
+ rc = stonith_api_time_helper(nodeid, 0);
+ printf("%d last fenced at %s\n", nodeid, ctime(rc));
+
+ rc = stonith_api_kick_helper(nodeid, 120, 1);
+ printf("%d fence result: %d\n", nodeid, rc);
+
+ rc = stonith_api_time_helper(nodeid, 0);
+ printf("%d last fenced at %s\n", nodeid, ctime(rc));
+
+ return 0;
+ }
+
+
*/
# define STONITH_LIBRARY "libstonithd.so.1"
-int stonith_api_cs_kick(int nodeid, int timeout, bool off);
-time_t stonith_api_cs_time(int nodeid, bool in_progress);
-
static inline int
-stonith_api_kick_cs_helper(int nodeid, int timeout, bool off)
+stonith_api_kick_helper(int nodeid, int timeout, bool off)
{
static void *st_library = NULL;
- static int(*st_kick_fn)(int nodeid, int timeout, bool off) = NULL;
+ static int(*st_kick_fn)(int nodeid, const char *uname, int timeout, bool off) = NULL;
if(st_library == NULL) {
st_library = dlopen(STONITH_LIBRARY, RTLD_LAZY);
}
if(st_library && st_kick_fn == NULL) {
- st_kick_fn = dlsym(&st_library, "stonith_api_cs_kick");
+ st_kick_fn = dlsym(st_library, "stonith_api_kick");
}
if(st_kick_fn == NULL) {
return st_err_not_supported;
}
- return (*st_kick_fn)(nodeid, timeout, off);
+ return (*st_kick_fn)(nodeid, NULL, timeout, off);
}
static inline time_t
-stonith_api_time_cs_helper(int nodeid, bool in_progress)
+stonith_api_time_helper(int nodeid, bool in_progress)
{
static void *st_library = NULL;
- static time_t(*st_time_fn)(int nodeid, bool in_progress) = NULL;
+ static time_t(*st_time_fn)(int nodeid, const char *uname, bool in_progress) = NULL;
if(st_library == NULL) {
st_library = dlopen(STONITH_LIBRARY, RTLD_LAZY);
}
if(st_library && st_time_fn == NULL) {
- st_time_fn = dlsym(&st_library, "stonith_api_cs_time");
+ st_time_fn = dlsym(st_library, "stonith_api_time");
}
if(st_time_fn == NULL) {
return 0;
}
- return (*st_time_fn)(nodeid, in_progress);
+ return (*st_time_fn)(nodeid, NULL, in_progress);
}
#endif
View
176 lib/cluster/cluster.c
@@ -40,8 +40,123 @@ CRM_TRACE_INIT_DATA(cluster);
void *hb_library = NULL;
#endif
+static GHashTable *crm_uuid_cache = NULL;
+static GHashTable *crm_uname_cache = NULL;
+
xmlNode *create_common_message(xmlNode * original_request, xmlNode * xml_response_data);
+static char *get_heartbeat_uuid(uint32_t unused, const char *uname)
+{
+ char *uuid_calc = NULL;
+#if SUPPORT_HEARTBEAT
+ cl_uuid_t uuid_raw;
+ const char *unknown = "00000000-0000-0000-0000-000000000000";
+
+ if (heartbeat_cluster == NULL) {
+ crm_warn("No connection to heartbeat, using uuid=uname");
+ return NULL;
+ }
+
+ if (heartbeat_cluster->llc_ops->get_uuid_by_name(heartbeat_cluster, uname, &uuid_raw) ==
+ HA_FAIL) {
+ crm_err("get_uuid_by_name() call failed for host %s", uname);
+ crm_free(uuid_calc);
+ return NULL;
+ }
+
+ crm_malloc0(uuid_calc, 50);
+ cl_uuid_unparse(&uuid_raw, uuid_calc);
+
+ if (safe_str_eq(uuid_calc, unknown)) {
+ crm_warn("Could not calculate UUID for %s", uname);
+ crm_free(uuid_calc);
+ return NULL;
+ }
+#endif
+ return uuid_calc;
+}
+
+char *
+get_corosync_uuid(uint32_t id, const char *uname)
+{
+ static const char *uuid_pref = NULL;
+
+ if(uuid_pref == NULL) {
+ uuid_pref = getenv("PCMK_uname_is_uuid");
+ }
+
+ if(uuid_pref == NULL) {
+ uuid_pref = "true";
+ }
+
+ if(crm_is_true(uuid_pref) && is_corosync_cluster()) {
+ if(id <= 0) {
+ /* Try the membership cache... */
+ crm_node_t *node = g_hash_table_lookup(crm_peer_cache, uname);
+ if(node != NULL) {
+ id = node->id;
+ }
+ }
+
+ if(id > 0) {
+ return crm_itoa(id);
+ } else {
+ crm_warn("Node %s is not yet known by corosync", uname);
+ }
+
+ } else if(uname != NULL) {
+ return crm_strdup(uname);
+ }
+
+ return NULL;
+}
+
+const char *
+get_node_uuid(uint32_t id, const char *uname)
+{
+ char *uuid = NULL;
+ enum cluster_type_e type = get_cluster_type();
+
+ CRM_CHECK(uname != NULL, return NULL);
+
+ if (crm_uuid_cache == NULL) {
+ crm_uuid_cache = g_hash_table_new_full(crm_str_hash, g_str_equal,
+ g_hash_destroy_str, g_hash_destroy_str);
+ }
+
+ /* avoid blocking heartbeat calls where possible */
+ uuid = g_hash_table_lookup(crm_uuid_cache, uname);
+ if (uuid != NULL) {
+ return uuid;
+ }
+
+ switch (type) {
+ case pcmk_cluster_corosync:
+ uuid = get_corosync_uuid(id, uname);
+ break;
+
+ case pcmk_cluster_cman:
+ case pcmk_cluster_classic_ais:
+ uuid = crm_strdup(uname);
+ break;
+
+ case pcmk_cluster_heartbeat:
+ uuid = get_heartbeat_uuid(id, uname);
+
+ case pcmk_cluster_unknown:
+ case pcmk_cluster_invalid:
+ crm_err("Unsupported cluster type");
+ break;
+ }
+
+ if(uuid == NULL) {
+ return NULL;
+ }
+
+ g_hash_table_insert(crm_uuid_cache, crm_strdup(uname), uuid);
+ return g_hash_table_lookup(crm_uuid_cache, uname);
+}
+
gboolean
crm_cluster_connect(char **our_uname, char **our_uuid, void *dispatch, void *destroy,
#if SUPPORT_HEARTBEAT
@@ -131,9 +246,6 @@ send_cluster_message(const char *node, enum crm_ais_msg_types service, xmlNode *
return FALSE;
}
-static GHashTable *crm_uuid_cache = NULL;
-static GHashTable *crm_uname_cache = NULL;
-
void
empty_uuid_cache(void)
{
@@ -155,63 +267,7 @@ unget_uuid(const char *uname)
const char *
get_uuid(const char *uname)
{
- char *uuid_calc = NULL;
-
- CRM_CHECK(uname != NULL, return NULL);
-
- if (crm_uuid_cache == NULL) {
- crm_uuid_cache = g_hash_table_new_full(crm_str_hash, g_str_equal,
- g_hash_destroy_str, g_hash_destroy_str);
- }
-
- CRM_CHECK(uname != NULL, return NULL);
-
- /* avoid blocking calls where possible */
- uuid_calc = g_hash_table_lookup(crm_uuid_cache, uname);
- if (uuid_calc != NULL) {
- return uuid_calc;
- }
-#if SUPPORT_COROSYNC
- if (is_openais_cluster()) {
- uuid_calc = crm_strdup(uname);
- goto fallback;
- }
-#endif
-#if SUPPORT_HEARTBEAT
- if (is_heartbeat_cluster()) {
- cl_uuid_t uuid_raw;
- const char *unknown = "00000000-0000-0000-0000-000000000000";
-
- if (heartbeat_cluster == NULL) {
- crm_warn("No connection to heartbeat, using uuid=uname");
- uuid_calc = crm_strdup(uname);
- goto fallback;
- }
-
- if (heartbeat_cluster->llc_ops->get_uuid_by_name(heartbeat_cluster, uname, &uuid_raw) ==
- HA_FAIL) {
- crm_err("get_uuid_by_name() call failed for host %s", uname);
- crm_free(uuid_calc);
- return NULL;
- }
-
- crm_malloc0(uuid_calc, 50);
- cl_uuid_unparse(&uuid_raw, uuid_calc);
-
- if (safe_str_eq(uuid_calc, unknown)) {
- crm_warn("Could not calculate UUID for %s", uname);
- crm_free(uuid_calc);
- return NULL;
- }
- }
-#endif
- goto fallback;
-
- fallback:
- g_hash_table_insert(crm_uuid_cache, crm_strdup(uname), uuid_calc);
- uuid_calc = g_hash_table_lookup(crm_uuid_cache, uname);
-
- return uuid_calc;
+ return get_node_uuid(0, uname);
}
const char *
View
2 lib/cluster/corosync.c
@@ -1251,7 +1251,7 @@ init_ais_connection_once(gboolean(*dispatch) (AIS_Message *, char *, int),
}
if (our_uuid != NULL) {
- *our_uuid = crm_strdup(pcmk_uname);
+ *our_uuid = get_corosync_uuid(pcmk_nodeid, pcmk_uname);
}
if (our_uname != NULL) {
View
63 lib/cluster/membership.c
@@ -317,11 +317,12 @@ crm_update_peer(unsigned int id, uint64_t born, uint64_t seen, int32_t votes, ui
}
if (node->uuid == NULL) {
- if (uuid != NULL) {
- node->uuid = crm_strdup(uuid);
+ if (is_openais_cluster()) {
+ /* Yes, overrule whatever was passed in */
+ node->uuid = get_corosync_uuid(id, uname);
- } else if (node->uname != NULL && is_openais_cluster()) {
- node->uuid = crm_strdup(node->uname);
+ } else if (uuid != NULL) {
+ node->uuid = crm_strdup(uuid);
}
}
@@ -470,63 +471,15 @@ crm_update_peer_proc(const char *uname, uint32_t flag, const char *status)
}
}
-static int
-crm_terminate_member_common(int nodeid, const char *uname, IPC_Channel * cluster, int *connection)
-{
- int rc = stonith_ok;
- stonith_t *st = NULL;
-
- if(uname == NULL) {
- crm_node_t *node = crm_get_peer(nodeid, uname);
- if (node) {
- uname = node->uname;
- }
- }
-
- if(uname == NULL) {
- crm_err("Nothing known about node id=%d", nodeid);
- return -1;
-
- } else {
- st = stonith_api_new();
- }
-
- if(st) {
- rc = st->cmds->connect(st, crm_system_name, NULL);
- }
-
- if(rc == stonith_ok) {
- crm_info("Requesting that node %d/%s be terminated", nodeid, uname);
- rc = st->cmds->fence(st, st_opt_allow_suicide, uname, "off", 120);
- }
-
- if(st) {
- st->cmds->disconnect(st);
- stonith_api_delete(st);
- }
-
- if(rc < stonith_ok) {
- crm_err("Could not terminate node %d/%s: %s", nodeid, crm_str(uname), stonith_error2string(rc));
- rc = 1;
-
- } else {
- rc = 0;
- }
- return rc;
-}
-
int
crm_terminate_member(int nodeid, const char *uname, IPC_Channel * cluster)
{
- if (cluster != NULL) {
- return crm_terminate_member_common(nodeid, uname, cluster, NULL);
- }
- crm_err("Could not terminate node %d/%s: No cluster connection", nodeid, uname);
- return 0;
+ /* Always use the synchronous, non-mainloop version */
+ return stonith_api_kick(nodeid, uname, 120, TRUE);
}
int
crm_terminate_member_no_mainloop(int nodeid, const char *uname, int *connection)
{
- return crm_terminate_member_common(nodeid, uname, NULL, connection);
+ return stonith_api_kick(nodeid, uname, 120, TRUE);
}
View
122 lib/common/mainloop.c
@@ -29,110 +29,62 @@
#include <crm/crm.h>
#include <crm/common/mainloop.h>
-static gboolean
-crm_trigger_prepare(GSource * source, gint * timeout)
+crm_trigger_t *
+mainloop_add_trigger(int priority, gboolean(*dispatch) (gpointer user_data), gpointer userdata)
{
- crm_trigger_t *trig = (crm_trigger_t *) source;
-
- /* cluster-glue's FD and IPC related sources make use of
- * g_source_add_poll() but do not set a timeout in their prepare
- * functions
- *
- * This means mainloop's poll() will block until an event for one
- * of these sources occurs - any /other/ type of source, such as
- * this one or g_idle_*, that doesn't use g_source_add_poll() is
- * S-O-L and wont be processed until there is something fd-based
- * happens.
- *
- * Luckily the timeout we can set here affects all sources and
- * puts an upper limit on how long poll() can take.
- *
- * So unconditionally set a small-ish timeout, not too small that
- * we're in constant motion, which will act as an upper bound on
- * how long the signal handling might be delayed for.
- */
- *timeout = 500; /* Timeout in ms */
-
- return trig->trigger;
-}
+ crm_trigger_t *source = (crm_trigger_t *) userdata;
-static gboolean
-crm_trigger_check(GSource * source)
-{
- crm_trigger_t *trig = (crm_trigger_t *) source;
+ source->trigger = FALSE;
+ source->user_data = userdata;
+ source->dispatch = dispatch;
+ source->priority = priority;
- return trig->trigger;
+ return source;
}
-static gboolean
-crm_trigger_dispatch(GSource * source, GSourceFunc callback, gpointer userdata)
+int mainloop_trigger_dispatch(void *userdata)
{
- crm_trigger_t *trig = (crm_trigger_t *) source;
-
- trig->trigger = FALSE;
-
- if (callback) {
- return callback(trig->user_data);
+ crm_trigger_t *source = (crm_trigger_t *) userdata;
+
+ if(source->trigger && source->delete == FALSE) {
+ source->trigger = FALSE;
+ if(source->dispatch) {
+ if(source->dispatch(userdata) == FALSE) {
+ source->delete = TRUE;
+ }
+ }
}
- return TRUE;
-}
-
-static GSourceFuncs crm_trigger_funcs = {
- crm_trigger_prepare,
- crm_trigger_check,
- crm_trigger_dispatch,
- NULL
-};
-
-static crm_trigger_t *
-mainloop_setup_trigger(GSource * source, int priority, gboolean(*dispatch) (gpointer user_data),
- gpointer userdata)
-{
- crm_trigger_t *trigger = NULL;
- trigger = (crm_trigger_t *) source;
-
- trigger->id = 0;
- trigger->trigger = FALSE;
- trigger->user_data = userdata;
-
- if (dispatch) {
- g_source_set_callback(source, dispatch, trigger, NULL);
+ if(source->delete) {
+ crm_free(source);
}
-
- g_source_set_priority(source, priority);
- g_source_set_can_recurse(source, FALSE);
-
- trigger->id = g_source_attach(source, NULL);
- return trigger;
-}
-
-crm_trigger_t *
-mainloop_add_trigger(int priority, gboolean(*dispatch) (gpointer user_data), gpointer userdata)
-{
- GSource *source = NULL;
-
- CRM_ASSERT(sizeof(crm_trigger_t) > sizeof(GSource));
- source = g_source_new(&crm_trigger_funcs, sizeof(crm_trigger_t));
- CRM_ASSERT(source != NULL);
-
- return mainloop_setup_trigger(source, priority, dispatch, userdata);
+ return 0;
}
void
mainloop_set_trigger(crm_trigger_t * source)
{
- source->trigger = TRUE;
+ int rc = 0;
+ if(source->trigger == FALSE) {
+ source->trigger = TRUE;
+ rc = qb_loop_job_add(qb_loop_t *l,
+ source->priority,
+ source->user_data,
+ mainloop_trigger_dispatch);
+ if(rc != 0) {
+ crm_err("Couldn't trigger execution of source %p", source);
+ }
+ }
}
gboolean
mainloop_destroy_trigger(crm_trigger_t * source)
{
- source->trigger = FALSE;
- if (source->id > 0) {
- g_source_remove(source->id);
+ source->delete = TRUE;
+ if(source->trigger == FALSE) {
+ mainloop_trigger_dispatch(source->user_data);
}
- return TRUE;
+ return source->trigger;
}
typedef struct signal_s {
@@ -224,7 +176,7 @@ mainloop_add_signal(int sig, void (*dispatch) (int sig))
CRM_ASSERT(sizeof(crm_signal_t) > sizeof(GSource));
source = g_source_new(&crm_signal_funcs, sizeof(crm_signal_t));
- crm_signals[sig] = (crm_signal_t *) mainloop_setup_trigger(source, priority, NULL, NULL);
+ crm_signals[sig] = (crm_signal_t *) mainloop_add_trigger(source, priority, NULL, NULL);
CRM_ASSERT(crm_signals[sig] != NULL);
crm_signals[sig]->handler = dispatch;
View
36 lib/common/utils.c
@@ -610,6 +610,31 @@ update_all_trace_data(void)
#endif
}
+#ifndef NAME_MAX
+# define NAME_MAX 256
+#endif
+gboolean daemon_option_enabled(const char *daemon, const char *option)
+{
+ char env_name[NAME_MAX];
+ const char *value = NULL;
+
+ snprintf(env_name, NAME_MAX, "PCMK_%s", option);
+ value = getenv(env_name);
+ if (value != NULL && crm_is_true(value)) {
+ return TRUE;
+
+ } else if (value != NULL && strstr(value, daemon)) {
+ return TRUE;
+ }
+
+ snprintf(env_name, NAME_MAX, "HA_%s", option);
+ value = getenv(env_name);
+ if (value != NULL && crm_is_true(value)) {
+ return TRUE;
+ }
+
+ return FALSE;
+}
gboolean
crm_log_init_worker(const char *entity, int level, gboolean coredir, gboolean to_stderr,
@@ -619,7 +644,6 @@ crm_log_init_worker(const char *entity, int level, gboolean coredir, gboolean to
const char *facility = getenv("HA_logfacility");
/* Redirect messages from glib functions to our handler */
-/* cl_malloc_forced_for_glib(); */
#ifdef HAVE_G_LOG_SET_DEFAULT_HANDLER
glib_log_default = g_log_set_default_handler(crm_glib_handler, NULL);
#endif
@@ -647,6 +671,16 @@ crm_log_init_worker(const char *entity, int level, gboolean coredir, gboolean to
setenv("PCMK_service", crm_system_name, 1);
+ if(daemon_option_enabled(crm_system_name, "debug")) {
+ /* Override the default setting */
+ level = LOG_DEBUG;
+ }
+
+ if(daemon_option_enabled(crm_system_name, "stderr")) {
+ /* Override the default setting */
+ to_stderr = TRUE;
+ }
+
#if LIBQB_LOGGING
crm_log_level = level;
qb_log_init(crm_system_name, qb_log_facility2int(facility), level);
View
71 lib/fencing/st_client.c
@@ -1914,64 +1914,72 @@ stonith_key_value_freeall(stonith_key_value_t * head, int keys, int values)
int
-stonith_api_cs_kick(int nodeid, int timeout, bool off)
+stonith_api_kick(int nodeid, const char *uname, int timeout, bool off)
{
- int rc = stonith_ok;
- stonith_t *st = NULL;
- enum stonith_call_options opts = st_opt_sync_call|st_opt_allow_suicide|st_opt_cs_nodeid;
+ char *name = NULL;
+ const char *action = "reboot";
- crm_log_init("st-client", LOG_INFO, FALSE, FALSE, 0, NULL);
+ int rc = st_err_internal;
+ stonith_t *st = NULL;
+ enum stonith_call_options opts = st_opt_sync_call|st_opt_allow_suicide;
st = stonith_api_new();
if(st) {
- rc = st->cmds->connect(st, crm_system_name, NULL);
+ rc = st->cmds->connect(st, "stonith-api", NULL);
}
- if(st && rc == stonith_ok) {
- char *name = crm_itoa(nodeid);
- crm_info("Requesting that node %d be terminated", nodeid);
- rc = st->cmds->fence(st, opts, name, "off", 120);
- crm_free(name);
+ if(uname != NULL) {
+ name = strdup(uname);
+
+ } else if(nodeid > 0) {
+ opts |= st_opt_cs_nodeid;
+ name = crm_itoa(nodeid);
+ }
+
+ if(off) {
+ action = "off";
+ }
+
+ if(rc == stonith_ok) {
+ rc = st->cmds->fence(st, opts, name, action, timeout);
}
if(st) {
st->cmds->disconnect(st);
stonith_api_delete(st);
}
- if(rc < stonith_ok) {
- crm_err("Could not terminate node %d: %s", nodeid, stonith_error2string(rc));
- rc = 1;
-
- } else {
- rc = 0;
- }
+ crm_free(name);
return rc;
}
time_t
-stonith_api_cs_time(int nodeid, bool in_progress)
+stonith_api_time(int nodeid, const char *uname, bool in_progress)
{
int rc = 0;
+ char *name = NULL;
+
time_t when = 0;
time_t progress = 0;
stonith_t *st = NULL;
stonith_history_t *history, *hp = NULL;
-
- crm_log_init("st-client", LOG_INFO, FALSE, FALSE, 0, NULL);
+ enum stonith_call_options opts = st_opt_sync_call;
st = stonith_api_new();
if(st) {
- rc = st->cmds->connect(st, crm_system_name, NULL);
+ rc = st->cmds->connect(st, "stonith-api", NULL);
+ }
+
+ if(uname != NULL) {
+ name = strdup(uname);
+
+ } else if(nodeid > 0) {
+ opts |= st_opt_cs_nodeid;
+ name = crm_itoa(nodeid);
}
if(st && rc == stonith_ok) {
- char *name = NULL;
- if(nodeid > 0) {
- name = crm_itoa(nodeid);
- }
st->cmds->history(st, st_opt_sync_call|st_opt_cs_nodeid, name, &history, 120);
- crm_free(name);
for(hp = history; hp; hp = hp->next) {
if(in_progress) {
@@ -1986,19 +1994,14 @@ stonith_api_cs_time(int nodeid, bool in_progress)
}
if(progress) {
- crm_debug("Node %d is in the process of being shot", nodeid);
when = progress;
-
- } else if(when != 0) {
- crm_debug("Node %d was last shot at: %s", nodeid, ctime(&when));
-
- } else {
- crm_debug("It does not appear node %d has been shot", nodeid);
}
if(st) {
st->cmds->disconnect(st);
stonith_api_delete(st);
}
+
+ crm_free(name);
return when;
}
View
6 lib/pengine/utils.c
@@ -237,7 +237,7 @@ dump_node_capacity(int level, const char *comment, node_t * node)
if (level == 0) {
fprintf(stdout, "%s\n", dump_text);
} else {
- do_crm_log_unlikely(level, "%s", dump_text);
+ crm_trace( "%s", dump_text);
}
crm_free(dump_text);
@@ -259,7 +259,7 @@ dump_rsc_utilization(int level, const char *comment, resource_t * rsc, node_t *
if (level == 0) {
fprintf(stdout, "%s\n", dump_text);
} else {
- do_crm_log_unlikely(level, "%s", dump_text);
+ crm_trace( "%s", dump_text);
}
crm_free(dump_text);
@@ -442,7 +442,7 @@ custom_action(resource_t * rsc, char *key, const char *task,
} else if (is_not_set(rsc->flags, pe_rsc_managed)
&& g_hash_table_lookup(action->meta, XML_LRM_ATTR_INTERVAL) == NULL) {
- do_crm_log_unlikely(LOG_DEBUG, "Action %s (unmanaged)", action->uuid);
+ crm_debug( "Action %s (unmanaged)", action->uuid);
set_bit_inplace(action->flags, pe_action_optional);
/* action->runnable = FALSE; */
View
2 mcp/pacemaker.c
@@ -612,7 +612,7 @@ update_node_processes(uint32_t id, const char *uname, uint32_t procs)
}
if (procs != 0 && procs != node->processes) {
- crm_info("Node %s now has process list: %.32x (was %.32x)",
+ crm_debug("Node %s now has process list: %.32x (was %.32x)",
node->uname, procs, node->processes);
node->processes = procs;
changed = TRUE;
View
4 mcp/pacemaker.sysconfig
@@ -1,5 +1,9 @@
# For non-systemd based systems, prefix export to each enabled line
+# Enable this for compatibility with older corosync (prior to 2.0)
+# based clusters which used the nodes uname as its uuid also
+# PCMK_uname_is_uuid=no
+
# Variables that control logging
# PCMK_trace_functions=function1,function2,function3
# PCMK_trace_formats="Sent delete %d"
View
3 pengine/allocate.c
@@ -953,7 +953,6 @@ static gint
sort_rsc_process_order(gconstpointer a, gconstpointer b, gpointer data)
{
int rc = 0;
- int level = LOG_TRACE;
int r1_weight = -INFINITY;
int r2_weight = -INFINITY;
@@ -1074,7 +1073,7 @@ sort_rsc_process_order(gconstpointer a, gconstpointer b, gpointer data)
g_hash_table_destroy(r2_nodes);
}
- do_crm_log_unlikely(level, "%s (%d) %c %s (%d) on %s: %s",
+ crm_trace( "%s (%d) %c %s (%d) on %s: %s",
resource1->id, r1_weight, rc < 0 ? '>' : rc > 0 ? '<' : '=',
resource2->id, r2_weight, node ? node->details->id : "n/a", reason);
return rc;
View
65 pengine/clone.c
@@ -63,7 +63,6 @@ gint
sort_clone_instance(gconstpointer a, gconstpointer b, gpointer data_set)
{
int rc = 0;
- int level = LOG_DEBUG_3;
node_t *node1 = NULL;
node_t *node2 = NULL;
@@ -86,11 +85,11 @@ sort_clone_instance(gconstpointer a, gconstpointer b, gpointer data_set)
if (resource1->running_on && resource2->running_on) {
if (g_list_length(resource1->running_on) < g_list_length(resource2->running_on)) {
- do_crm_log_unlikely(level, "%s < %s: running_on", resource1->id, resource2->id);
+ crm_trace( "%s < %s: running_on", resource1->id, resource2->id);
return -1;
} else if (g_list_length(resource1->running_on) > g_list_length(resource2->running_on)) {
- do_crm_log_unlikely(level, "%s > %s: running_on", resource1->id, resource2->id);
+ crm_trace( "%s > %s: running_on", resource1->id, resource2->id);
return 1;
}
}
@@ -106,7 +105,7 @@ sort_clone_instance(gconstpointer a, gconstpointer b, gpointer data_set)
node_t *match = pe_hash_table_lookup(resource1->allowed_nodes, node1->details->id);
if (match == NULL || match->weight < 0) {
- do_crm_log_unlikely(level, "%s: current location is unavailable", resource1->id);
+ crm_trace( "%s: current location is unavailable", resource1->id);
node1 = NULL;
can1 = FALSE;
}
@@ -116,43 +115,43 @@ sort_clone_instance(gconstpointer a, gconstpointer b, gpointer data_set)
node_t *match = pe_hash_table_lookup(resource2->allowed_nodes, node2->details->id);
if (match == NULL || match->weight < 0) {
- do_crm_log_unlikely(level, "%s: current location is unavailable", resource2->id);
+ crm_trace( "%s: current location is unavailable", resource2->id);
node2 = NULL;
can2 = FALSE;
}
}
if (can1 != can2) {
if (can1) {
- do_crm_log_unlikely(level, "%s < %s: availability of current location", resource1->id,
+ crm_trace( "%s < %s: availability of current location", resource1->id,
resource2->id);
return -1;
}
- do_crm_log_unlikely(level, "%s > %s: availability of current location", resource1->id,
+ crm_trace( "%s > %s: availability of current location", resource1->id,
resource2->id);
return 1;
}
if (resource1->priority < resource2->priority) {
- do_crm_log_unlikely(level, "%s < %s: priority", resource1->id, resource2->id);
+ crm_trace( "%s < %s: priority", resource1->id, resource2->id);
return 1;
} else if (resource1->priority > resource2->priority) {
- do_crm_log_unlikely(level, "%s > %s: priority", resource1->id, resource2->id);
+ crm_trace( "%s > %s: priority", resource1->id, resource2->id);
return -1;
}
if (node1 == NULL && node2 == NULL) {
- do_crm_log_unlikely(level, "%s == %s: not active", resource1->id, resource2->id);
+ crm_trace( "%s == %s: not active", resource1->id, resource2->id);
return 0;
}
if (node1 != node2) {
if (node1 == NULL) {
- do_crm_log_unlikely(level, "%s > %s: active", resource1->id, resource2->id);
+ crm_trace( "%s > %s: active", resource1->id, resource2->id);
return 1;
} else if (node2 == NULL) {
- do_crm_log_unlikely(level, "%s < %s: active", resource1->id, resource2->id);
+ crm_trace( "%s < %s: active", resource1->id, resource2->id);
return -1;
}
}
@@ -161,45 +160,45 @@ sort_clone_instance(gconstpointer a, gconstpointer b, gpointer data_set)
can2 = can_run_resources(node2);
if (can1 != can2) {
if (can1) {
- do_crm_log_unlikely(level, "%s < %s: can", resource1->id, resource2->id);
+ crm_trace( "%s < %s: can", resource1->id, resource2->id);
return -1;
}
- do_crm_log_unlikely(level, "%s > %s: can", resource1->id, resource2->id);
+ crm_trace( "%s > %s: can", resource1->id, resource2->id);
return 1;
}
node1 = parent_node_instance(resource1, node1);
node2 = parent_node_instance(resource2, node2);
if (node1 != NULL && node2 == NULL) {
- do_crm_log_unlikely(level, "%s < %s: not allowed", resource1->id, resource2->id);
+ crm_trace( "%s < %s: not allowed", resource1->id, resource2->id);
return -1;
} else if (node1 == NULL && node2 != NULL) {
- do_crm_log_unlikely(level, "%s > %s: not allowed", resource1->id, resource2->id);
+ crm_trace( "%s > %s: not allowed", resource1->id, resource2->id);
return 1;
}
if (node1 == NULL || node2 == NULL) {
- do_crm_log_unlikely(level, "%s == %s: not allowed", resource1->id, resource2->id);
+ crm_trace( "%s == %s: not allowed", resource1->id, resource2->id);
return 0;
}
if (node1->count < node2->count) {
- do_crm_log_unlikely(level, "%s < %s: count", resource1->id, resource2->id);
+ crm_trace( "%s < %s: count", resource1->id, resource2->id);
return -1;
} else if (node1->count > node2->count) {
- do_crm_log_unlikely(level, "%s > %s: count", resource1->id, resource2->id);
+ crm_trace( "%s > %s: count", resource1->id, resource2->id);
return 1;
}
can1 = did_fail(resource1);
can2 = did_fail(resource2);
if (can1 != can2) {
if (can1) {
- do_crm_log_unlikely(level, "%s > %s: failed", resource1->id, resource2->id);
+ crm_trace( "%s > %s: failed", resource1->id, resource2->id);
return 1;
}
- do_crm_log_unlikely(level, "%s < %s: failed", resource1->id, resource2->id);
+ crm_trace( "%s < %s: failed", resource1->id, resource2->id);
return -1;
}
@@ -224,7 +223,7 @@ sort_clone_instance(gconstpointer a, gconstpointer b, gpointer data_set)
for (gIter = resource1->parent->rsc_cons; gIter; gIter = gIter->next) {
rsc_colocation_t *constraint = (rsc_colocation_t *) gIter->data;
- do_crm_log_unlikely(level + 1, "Applying %s to %s", constraint->id, resource1->id);
+ crm_trace( "Applying %s to %s", constraint->id, resource1->id);
hash1 = native_merge_weights(constraint->rsc_rh, resource1->id, hash1,
constraint->node_attribute,
@@ -234,7 +233,7 @@ sort_clone_instance(gconstpointer a, gconstpointer b, gpointer data_set)
for (gIter = resource1->parent->rsc_cons_lhs; gIter; gIter = gIter->next) {
rsc_colocation_t *constraint = (rsc_colocation_t *) gIter->data;
- do_crm_log_unlikely(level + 1, "Applying %s to %s", constraint->id, resource1->id);
+ crm_trace( "Applying %s to %s", constraint->id, resource1->id);
hash1 = native_merge_weights(constraint->rsc_lh, resource1->id, hash1,
constraint->node_attribute,
@@ -244,7 +243,7 @@ sort_clone_instance(gconstpointer a, gconstpointer b, gpointer data_set)
for (gIter = resource2->parent->rsc_cons; gIter; gIter = gIter->next) {
rsc_colocation_t *constraint = (rsc_colocation_t *) gIter->data;
- do_crm_log_unlikely(level + 1, "Applying %s to %s", constraint->id, resource2->id);
+ crm_trace( "Applying %s to %s", constraint->id, resource2->id);
hash2 = native_merge_weights(constraint->rsc_rh, resource2->id, hash2,
constraint->node_attribute,
@@ -254,7 +253,7 @@ sort_clone_instance(gconstpointer a, gconstpointer b, gpointer data_set)
for (gIter = resource2->parent->rsc_cons_lhs; gIter; gIter = gIter->next) {
rsc_colocation_t *constraint = (rsc_colocation_t *) gIter->data;
- do_crm_log_unlikely(level + 1, "Applying %s to %s", constraint->id, resource2->id);
+ crm_trace( "Applying %s to %s", constraint->id, resource2->id);
hash2 = native_merge_weights(constraint->rsc_lh, resource2->id, hash2,
constraint->node_attribute,
@@ -270,18 +269,18 @@ sort_clone_instance(gconstpointer a, gconstpointer b, gpointer data_set)
if (node1->weight < node2->weight) {
if (node1->weight < 0) {
- do_crm_log_unlikely(level, "%s > %s: current score", resource1->id, resource2->id);
+ crm_trace( "%s > %s: current score", resource1->id, resource2->id);
rc = -1;
goto out;
} else {
- do_crm_log_unlikely(level, "%s < %s: current score", resource1->id, resource2->id);
+ crm_trace( "%s < %s: current score", resource1->id, resource2->id);
rc = 1;
goto out;
}
} else if (node1->weight > node2->weight) {
- do_crm_log_unlikely(level, "%s > %s: current score", resource1->id, resource2->id);
+ crm_trace( "%s > %s: current score", resource1->id, resource2->id);
rc = -1;
goto out;
}
@@ -305,26 +304,26 @@ sort_clone_instance(gconstpointer a, gconstpointer b, gpointer data_set)
node1 = g_list_nth_data(list1, lpc);
node2 = g_list_nth_data(list2, lpc);
if (node1 == NULL) {
- do_crm_log_unlikely(level, "%s < %s: colocated score NULL", resource1->id,
+ crm_trace( "%s < %s: colocated score NULL", resource1->id,
resource2->id);
rc = 1;
break;
} else if (node2 == NULL) {
- do_crm_log_unlikely(level, "%s > %s: colocated score NULL", resource1->id,
+ crm_trace( "%s > %s: colocated score NULL", resource1->id,
resource2->id);
rc = -1;
break;
}
if (node1->weight < node2->weight) {
- do_crm_log_unlikely(level, "%s < %s: colocated score", resource1->id,
+ crm_trace( "%s < %s: colocated score", resource1->id,
resource2->id);
rc = 1;
break;
} else if (node1->weight > node2->weight) {
- do_crm_log_unlikely(level, "%s > %s: colocated score", resource1->id,
+ crm_trace( "%s > %s: colocated score", resource1->id,
resource2->id);
rc = -1;
break;
@@ -344,7 +343,7 @@ sort_clone_instance(gconstpointer a, gconstpointer b, gpointer data_set)
}
rc = strcmp(resource1->id, resource2->id);
- do_crm_log_unlikely(level, "%s %c %s: default", resource1->id, rc < 0 ? '<' : '>',
+ crm_trace( "%s %c %s: default", resource1->id, rc < 0 ? '<' : '>',
resource2->id);
return rc;
}
View
28 pengine/graph.c
@@ -575,23 +575,21 @@ action2xml(action_t * action, gboolean as_input)
static gboolean
should_dump_action(action_t * action)
{
- int log_filter = LOG_DEBUG_5;
-
CRM_CHECK(action != NULL, return FALSE);
if (is_set(action->flags, pe_action_dumped)) {
- do_crm_log_unlikely(log_filter, "action %d (%s) was already dumped",
+ crm_trace( "action %d (%s) was already dumped",
action->id, action->uuid);
return FALSE;
} else if (is_set(action->flags, pe_action_runnable) == FALSE) {
- do_crm_log_unlikely(log_filter, "action %d (%s) was not runnable",
+ crm_trace( "action %d (%s) was not runnable",
action->id, action->uuid);
return FALSE;
} else if (is_set(action->flags, pe_action_optional)
&& is_set(action->flags, pe_action_print_always) == FALSE) {
- do_crm_log_unlikely(log_filter, "action %d (%s) was optional", action->id, action->uuid);
+ crm_trace( "action %d (%s) was optional", action->id, action->uuid);
return FALSE;
} else if (action->rsc != NULL && is_not_set(action->rsc->flags, pe_rsc_managed)) {
@@ -601,7 +599,7 @@ should_dump_action(action_t * action)
/* make sure probes and recurring monitors go through */
if (safe_str_neq(action->task, RSC_STATUS) && interval == NULL) {
- do_crm_log_unlikely(log_filter, "action %d (%s) was for an unmanaged resource (%s)",
+ crm_trace( "action %d (%s) was for an unmanaged resource (%s)",
action->id, action->uuid, action->rsc->id);
return FALSE;
}
@@ -664,34 +662,32 @@ static gboolean
should_dump_input(int last_action, action_t * action, action_wrapper_t * wrapper)
{
int type = wrapper->type;
- int log_dump = LOG_DEBUG_3;
- int log_filter = LOG_DEBUG_3;
type &= ~pe_order_implies_first_printed;
type &= ~pe_order_implies_then_printed;
type &= ~pe_order_optional;
wrapper->state = pe_link_not_dumped;
if (last_action == wrapper->action->id) {
- do_crm_log_unlikely(log_filter, "Input (%d) %s duplicated for %s",
+ crm_trace( "Input (%d) %s duplicated for %s",
wrapper->action->id, wrapper->action->uuid, action->uuid);
wrapper->state = pe_link_dup;
return FALSE;
} else if (wrapper->type == pe_order_none) {
- do_crm_log_unlikely(log_filter, "Input (%d) %s suppressed for %s",
+ crm_trace( "Input (%d) %s suppressed for %s",
wrapper->action->id, wrapper->action->uuid, action->uuid);
return FALSE;
} else if (is_set(wrapper->action->flags, pe_action_runnable) == FALSE
&& type == pe_order_none && safe_str_neq(wrapper->action->uuid, CRM_OP_PROBED)) {
- do_crm_log_unlikely(log_filter, "Input (%d) %s optional (ordering) for %s",
+ c