Skip to content

Commit

Permalink
Merge pull request #1259 from kgaillot/fixes
Browse files Browse the repository at this point in the history
Don't set container hostname without IP, with other minor fixes
  • Loading branch information
kgaillot committed Apr 5, 2017
2 parents e4d588c + bf4eda2 commit 71dbd12
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 22 deletions.
7 changes: 0 additions & 7 deletions crmd/te_callbacks.c
Expand Up @@ -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
Expand All @@ -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;
Expand All @@ -671,7 +667,6 @@ st_fail_count_reset(const char *target)

if (rec) {
rec->count = 0;
rec->last_rc = 0;
}
}

Expand All @@ -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
Expand Down
12 changes: 1 addition & 11 deletions lib/cib/cib_attrs.c
Expand Up @@ -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;
}
Expand Down
5 changes: 4 additions & 1 deletion lib/common/schemas.c
Expand Up @@ -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 {
Expand Down
13 changes: 11 additions & 2 deletions lib/pengine/container.c
Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion valgrind-pcmk.suppressions
Expand Up @@ -31,7 +31,6 @@
{
Bash leak in cli regression testing
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
fun:xmalloc
obj:/usr/bin/bash
Expand Down

0 comments on commit 71dbd12

Please sign in to comment.