From b33d343ff39247d84cf94706b5263fea38273674 Mon Sep 17 00:00:00 2001 From: Ken Gaillot Date: Tue, 4 Apr 2017 16:18:52 -0500 Subject: [PATCH 1/5] Refactor: libcib: use new convenience function for sanitizing ID so we get any future improvements in the sanitization --- lib/cib/cib_attrs.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/lib/cib/cib_attrs.c b/lib/cib/cib_attrs.c index a2b118f00c2..0f5d5a718ed 100644 --- a/lib/cib/cib_attrs.c +++ b/lib/cib/cib_attrs.c @@ -266,20 +266,10 @@ update_attr_delegate(cib_t * the_cib, int call_options, } if (attr_id == NULL) { - int lpc = 0; - local_attr_id = crm_concat(set_name, attr_name, '-'); + crm_xml_sanitize_id(local_attr_id); attr_id = local_attr_id; - /* Minimal attempt at sanitizing automatic IDs */ - for (lpc = 0; local_attr_id[lpc] != 0; lpc++) { - switch (local_attr_id[lpc]) { - case ':': - case '#': - local_attr_id[lpc] = '.'; - } - } - } else if (attr_name == NULL) { attr_name = attr_id; } From b30af11ddd465a299cf1bd66cc3c42a1ce741368 Mon Sep 17 00:00:00 2001 From: Ken Gaillot Date: Tue, 4 Apr 2017 16:22:03 -0500 Subject: [PATCH 2/5] Log: libcrmcommon: more useful message if can't open dump file also avoids a static analysis false positive --- lib/common/schemas.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/common/schemas.c b/lib/common/schemas.c index f1a0238024e..055d1410e01 100644 --- a/lib/common/schemas.c +++ b/lib/common/schemas.c @@ -553,7 +553,10 @@ dump_file(const char *filename) CRM_CHECK(filename != NULL, return); fp = fopen(filename, "r"); - CRM_CHECK(fp != NULL, return); + if (fp == NULL) { + crm_perror(LOG_ERR, "Could not open %s for reading", filename); + return; + } fprintf(stderr, "%4d ", ++line); do { From 9d912a09ca730b9fa9612de850839a2340aeb6d0 Mon Sep 17 00:00:00 2001 From: Ken Gaillot Date: Tue, 4 Apr 2017 16:27:47 -0500 Subject: [PATCH 3/5] Low: libpe_status: only set container hostname if have IP --- lib/pengine/container.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/pengine/container.c b/lib/pengine/container.c index b93d98f6e9b..127b144e4f6 100644 --- a/lib/pengine/container.c +++ b/lib/pengine/container.c @@ -214,8 +214,17 @@ create_docker_resource( create_nvp(xml_obj, "force_kill", "false"); create_nvp(xml_obj, "reuse", "false"); - offset += snprintf(buffer+offset, max-offset, "-h %s-%d --restart=no ", - data->prefix, tuple->offset); + offset += snprintf(buffer+offset, max-offset, " --restart=no"); + + /* Set a container hostname only if we have an IP to map it to. + * The user can set -h or --uts=host themselves if they want a nicer + * name for logs, but this makes applications happy who need their + * hostname to match the IP they bind to. + */ + if (data->ip_range_start != NULL) { + offset += snprintf(buffer+offset, max-offset, " -h %s-%d", + data->prefix, tuple->offset); + } if(data->docker_network) { // offset += snprintf(buffer+offset, max-offset, " --link-local-ip=%s", tuple->ipaddr); From ff8813761d1024de2bba3d813e3e8aacc698bb54 Mon Sep 17 00:00:00 2001 From: Ken Gaillot Date: Tue, 4 Apr 2017 16:44:20 -0500 Subject: [PATCH 4/5] Fix: crmd: don't abandon fencing after one "no devices" failure --- crmd/te_callbacks.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/crmd/te_callbacks.c b/crmd/te_callbacks.c index ff0a664b7ea..6c0670c96c8 100644 --- a/crmd/te_callbacks.c +++ b/crmd/te_callbacks.c @@ -633,7 +633,6 @@ process_te_message(xmlNode * msg, xmlNode * xml_data) GHashTable *stonith_failures = NULL; struct st_fail_rec { int count; - int last_rc; }; gboolean @@ -652,9 +651,6 @@ too_many_st_failures(void) if (value->count > stonith_max_attempts ) { crm_warn("Too many failures to fence %s (%d), giving up", key, value->count); return TRUE; - } else if (value->last_rc == -ENODEV) { - crm_warn("No devices found in cluster to fence %s, giving up", key); - return TRUE; } } return FALSE; @@ -671,7 +667,6 @@ st_fail_count_reset(const char *target) if (rec) { rec->count = 0; - rec->last_rc = 0; } } @@ -697,8 +692,6 @@ st_fail_count_increment(const char *target, int rc) rec->count = 1; g_hash_table_insert(stonith_failures, strdup(target), rec); } - rec->last_rc = rc; - } void From bf4eda2d233f40795ff4141aad8985f0da5a7b0b Mon Sep 17 00:00:00 2001 From: Ken Gaillot Date: Tue, 4 Apr 2017 17:55:59 -0500 Subject: [PATCH 5/5] Test: make new valgrind suppression compatible with older versions --- valgrind-pcmk.suppressions | 1 - 1 file changed, 1 deletion(-) diff --git a/valgrind-pcmk.suppressions b/valgrind-pcmk.suppressions index 48eec9e2af4..33d3b060436 100644 --- a/valgrind-pcmk.suppressions +++ b/valgrind-pcmk.suppressions @@ -31,7 +31,6 @@ { Bash leak in cli regression testing Memcheck:Leak - match-leak-kinds: definite fun:malloc fun:xmalloc obj:/usr/bin/bash