Skip to content

Commit 6945262

Browse files
authored
Merge pull request #1211 from kgaillot/fixes
Fix crm_diff --no-version
2 parents 2817a20 + 88472dc commit 6945262

File tree

7 files changed

+218
-145
lines changed

7 files changed

+218
-145
lines changed

crmd/lrm.c

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
#define START_DELAY_THRESHOLD 5 * 60 * 1000
3838
#define MAX_LRM_REG_FAILS 30
3939

40+
#define s_if_plural(i) (((i) == 1)? "" : "s")
41+
4042
struct delete_event_s {
4143
int rc;
4244
const char *rsc;
@@ -372,8 +374,10 @@ do_lrm_control(long long action,
372374

373375
if (ret != pcmk_ok) {
374376
if (lrm_state->num_lrm_register_fails < MAX_LRM_REG_FAILS) {
375-
crm_warn("Failed to sign on to the LRM %d"
376-
" (%d max) times", lrm_state->num_lrm_register_fails, MAX_LRM_REG_FAILS);
377+
crm_warn("Failed to connect to the LRM %d time%s (%d max)",
378+
lrm_state->num_lrm_register_fails,
379+
s_if_plural(lrm_state->num_lrm_register_fails),
380+
MAX_LRM_REG_FAILS);
377381

378382
crm_timer_start(wait_timer);
379383
crmd_fsa_stall(FALSE);
@@ -382,8 +386,9 @@ do_lrm_control(long long action,
382386
}
383387

384388
if (ret != pcmk_ok) {
385-
crm_err("Failed to sign on to the LRM %d" " (max) times",
386-
lrm_state->num_lrm_register_fails);
389+
crm_err("Failed to connect to the LRM the max allowed %d time%s",
390+
lrm_state->num_lrm_register_fails,
391+
s_if_plural(lrm_state->num_lrm_register_fails));
387392
register_fsa_error(C_FSA_INTERNAL, I_ERROR, NULL);
388393
return;
389394
}
@@ -425,8 +430,8 @@ lrm_state_verify_stopped(lrm_state_t * lrm_state, enum crmd_fsa_state cur_state,
425430
guint nremaining = g_hash_table_size(lrm_state->pending_ops);
426431

427432
if (removed || nremaining) {
428-
crm_notice("Stopped %u recurring operations at %s (%u operations remaining)",
429-
removed, when, nremaining);
433+
crm_notice("Stopped %u recurring operation%s at %s (%u remaining)",
434+
removed, s_if_plural(removed), when, nremaining);
430435
}
431436
}
432437

@@ -441,7 +446,8 @@ lrm_state_verify_stopped(lrm_state_t * lrm_state, enum crmd_fsa_state cur_state,
441446
}
442447

443448
if (counter > 0) {
444-
do_crm_log(log_level, "%d pending LRM operations at %s", counter, when);
449+
do_crm_log(log_level, "%d pending LRM operation%s at %s",
450+
counter, s_if_plural(counter), when);
445451

446452
if (cur_state == S_TERMINATE || !is_set(fsa_input_register, R_SENT_RSC_STOP)) {
447453
g_hash_table_iter_init(&gIter, lrm_state->pending_ops);
@@ -459,7 +465,7 @@ lrm_state_verify_stopped(lrm_state_t * lrm_state, enum crmd_fsa_state cur_state,
459465
return rc;
460466
}
461467

462-
if (cur_state == S_TERMINATE || is_set(fsa_input_register, R_SHUTDOWN)) {
468+
if (is_set(fsa_input_register, R_SHUTDOWN)) {
463469
/* At this point we're not waiting, we're just shutting down */
464470
when = "shutdown";
465471
}
@@ -472,7 +478,11 @@ lrm_state_verify_stopped(lrm_state_t * lrm_state, enum crmd_fsa_state cur_state,
472478
}
473479

474480
counter++;
475-
crm_trace("Found %s active", entry->id);
481+
if (log_level == LOG_ERR) {
482+
crm_info("Found %s active at %s", entry->id, when);
483+
} else {
484+
crm_trace("Found %s active at %s", entry->id, when);
485+
}
476486
if (lrm_state->pending_ops) {
477487
GHashTableIter hIter;
478488

@@ -488,7 +498,8 @@ lrm_state_verify_stopped(lrm_state_t * lrm_state, enum crmd_fsa_state cur_state,
488498
}
489499

490500
if (counter) {
491-
crm_err("%d resources were active at %s.", counter, when);
501+
crm_err("%d resource%s active at %s",
502+
counter, (counter == 1)? " was" : "s were", when);
492503
}
493504

494505
return rc;
@@ -1489,8 +1500,8 @@ do_lrm_invoke(long long action,
14891500
lrm_state = lrm_state_find(target_node);
14901501

14911502
if (lrm_state == NULL && is_remote_node) {
1492-
crm_err("no lrmd connection for remote node %s found on cluster node %s. Can not process request.",
1493-
target_node, fsa_our_uname);
1503+
crm_err("Failing action because remote node %s has no connection to cluster node %s",
1504+
target_node, fsa_our_uname);
14941505

14951506
/* The action must be recorded here and in the CIB as failed */
14961507
synthesize_lrmd_failure(NULL, input->xml, PCMK_OCF_CONNECTION_DIED);
@@ -1785,7 +1796,7 @@ do_lrm_invoke(long long action,
17851796
lrmd_free_rsc_info(rsc);
17861797

17871798
} else {
1788-
crm_err("Operation was neither a lrm_query, nor a rsc op. %s", crm_str(crm_op));
1799+
crm_err("Cannot perform operation %s of unknown type", crm_str(crm_op));
17891800
register_fsa_error(C_FSA_INTERNAL, I_ERROR, NULL);
17901801
}
17911802
}
@@ -2108,8 +2119,8 @@ do_lrm_rsc_op(lrm_state_t * lrm_state, lrmd_rsc_info_t * rsc, const char *operat
21082119
lrm_state->pending_ops, stop_recurring_action_by_rsc, &data);
21092120

21102121
if (removed) {
2111-
crm_debug("Stopped %u recurring operations in preparation for %s_%s_%d",
2112-
removed, rsc->id, operation, op->interval);
2122+
crm_debug("Stopped %u recurring operation%s in preparation for %s_%s_%d",
2123+
removed, s_if_plural(removed), rsc->id, operation, op->interval);
21132124
}
21142125
}
21152126

crmd/te_actions.c

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,6 @@ cib_action_update(crm_action_t * action, int status, int op_rc)
292292

293293
int rc = pcmk_ok;
294294

295-
const char *name = NULL;
296-
const char *value = NULL;
297295
const char *rsc_id = NULL;
298296
const char *task = crm_element_value(action->xml, XML_LRM_ATTR_TASK);
299297
const char *target = crm_element_value(action->xml, XML_LRM_ATTR_TARGET);
@@ -341,15 +339,10 @@ cib_action_update(crm_action_t * action, int status, int op_rc)
341339
rsc = create_xml_node(rsc, XML_LRM_TAG_RESOURCE);
342340
crm_xml_add(rsc, XML_ATTR_ID, rsc_id);
343341

344-
name = XML_ATTR_TYPE;
345-
value = crm_element_value(action_rsc, name);
346-
crm_xml_add(rsc, name, value);
347-
name = XML_AGENT_ATTR_CLASS;
348-
value = crm_element_value(action_rsc, name);
349-
crm_xml_add(rsc, name, value);
350-
name = XML_AGENT_ATTR_PROVIDER;
351-
value = crm_element_value(action_rsc, name);
352-
crm_xml_add(rsc, name, value);
342+
343+
crm_copy_xml_element(action_rsc, rsc, XML_ATTR_TYPE);
344+
crm_copy_xml_element(action_rsc, rsc, XML_AGENT_ATTR_CLASS);
345+
crm_copy_xml_element(action_rsc, rsc, XML_AGENT_ATTR_PROVIDER);
353346

354347
op = convert_graph_action(NULL, action, status, op_rc);
355348
op->call_id = -1;

doc/Pacemaker_Remote/en-US/Ch-Intro.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ version):
107107
* Support for transient node attributes
108108
* Support for clusters with mixed endian architectures
109109

110+
.1.1.10
111+
* remote-connect-timeout for guest nodes
112+
110113
.1.1.9
111114
* Initial version to include pacemaker_remote
112115
* Limited to guest nodes in KVM/LXC environments using only IPv4;

include/crm/common/xml.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,24 @@ crm_element_name(xmlNode *xml)
210210

211211
const char *crm_element_value(xmlNode * data, const char *name);
212212

213+
/*!
214+
* \brief Copy an element from one XML object to another
215+
*
216+
* \param[in] obj1 Source XML
217+
* \param[in,out] obj2 Destination XML
218+
* \param[in] element Name of element to copy
219+
*
220+
* \return Pointer to copied value (from source)
221+
*/
222+
static inline const char *
223+
crm_copy_xml_element(xmlNode *obj1, xmlNode *obj2, const char *element)
224+
{
225+
const char *value = crm_element_value(obj1, element);
226+
227+
crm_xml_add(obj2, element, value);
228+
return value;
229+
}
230+
213231
void xml_validate(const xmlNode * root);
214232

215233
gboolean xml_has_children(const xmlNode * root);

tools/Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ crm_simulate_LDADD = $(top_builddir)/lib/pengine/libpe_status.la \
8787
$(top_builddir)/lib/transition/libtransitioner.la \
8888
$(COMMONLIBS)
8989

90-
crm_diff_SOURCES = xml_diff.c
90+
crm_diff_SOURCES = crm_diff.c
9191
crm_diff_LDADD = $(COMMONLIBS)
9292

9393
crm_mon_SOURCES = crm_mon.c

0 commit comments

Comments
 (0)