|
|
60de42 |
From c0ddb31cd04837216e36768f027cc1b1b3ac95a3 Mon Sep 17 00:00:00 2001
|
|
|
60de42 |
From: Andrew Beekhof <andrew@beekhof.net>
|
|
|
60de42 |
Date: Fri, 5 May 2017 18:02:32 +1000
|
|
|
60de42 |
Subject: [PATCH 1/4] lrmd: Ensure verbosity options are handled after
|
|
|
60de42 |
crm_log_init()
|
|
|
60de42 |
|
|
|
60de42 |
---
|
|
|
60de42 |
lrmd/main.c | 8 +++++++-
|
|
|
60de42 |
1 file changed, 7 insertions(+), 1 deletion(-)
|
|
|
60de42 |
|
|
|
60de42 |
diff --git a/lrmd/main.c b/lrmd/main.c
|
|
|
60de42 |
index 412ce24..110bef5 100644
|
|
|
60de42 |
--- a/lrmd/main.c
|
|
|
60de42 |
+++ b/lrmd/main.c
|
|
|
60de42 |
@@ -532,6 +532,7 @@ main(int argc, char **argv, char **envp)
|
|
|
60de42 |
{
|
|
|
60de42 |
int flag = 0;
|
|
|
60de42 |
int index = 0;
|
|
|
60de42 |
+ int bump_log_num = 0;
|
|
|
60de42 |
const char *option = NULL;
|
|
|
60de42 |
|
|
|
60de42 |
/* If necessary, create PID1 now before any FDs are opened */
|
|
|
60de42 |
@@ -563,7 +564,7 @@ main(int argc, char **argv, char **envp)
|
|
|
60de42 |
setenv("PCMK_remote_port", optarg, 1);
|
|
|
60de42 |
break;
|
|
|
60de42 |
case 'V':
|
|
|
60de42 |
- crm_bump_log_level(argc, argv);
|
|
|
60de42 |
+ bump_log_num++;
|
|
|
60de42 |
break;
|
|
|
60de42 |
case '?':
|
|
|
60de42 |
case '$':
|
|
|
60de42 |
@@ -577,6 +578,11 @@ main(int argc, char **argv, char **envp)
|
|
|
60de42 |
|
|
|
60de42 |
crm_log_init(NULL, LOG_INFO, TRUE, FALSE, argc, argv, FALSE);
|
|
|
60de42 |
|
|
|
60de42 |
+ while (bump_log_num > 0) {
|
|
|
60de42 |
+ crm_bump_log_level(argc, argv);
|
|
|
60de42 |
+ bump_log_num--;
|
|
|
60de42 |
+ }
|
|
|
60de42 |
+
|
|
|
60de42 |
option = daemon_option("logfacility");
|
|
|
60de42 |
if(option && safe_str_neq(option, "none")) {
|
|
|
60de42 |
setenv("HA_LOGFACILITY", option, 1); /* Used by the ocf_log/ha_log OCF macro */
|
|
|
60de42 |
--
|
|
|
60de42 |
1.8.3.1
|
|
|
60de42 |
|
|
|
60de42 |
|
|
|
60de42 |
From 4d19e6e14d0b4a95673bfc3f04cacaae1fa8bae0 Mon Sep 17 00:00:00 2001
|
|
|
60de42 |
From: Andrew Beekhof <andrew@beekhof.net>
|
|
|
60de42 |
Date: Fri, 5 May 2017 18:03:00 +1000
|
|
|
60de42 |
Subject: [PATCH 2/4] Containers: Remove redundant constraint
|
|
|
60de42 |
|
|
|
60de42 |
---
|
|
|
60de42 |
pengine/container.c | 6 ++----
|
|
|
60de42 |
1 file changed, 2 insertions(+), 4 deletions(-)
|
|
|
60de42 |
|
|
|
60de42 |
diff --git a/pengine/container.c b/pengine/container.c
|
|
|
60de42 |
index 8c70f54..49b288a 100644
|
|
|
60de42 |
--- a/pengine/container.c
|
|
|
60de42 |
+++ b/pengine/container.c
|
|
|
60de42 |
@@ -188,10 +188,8 @@ container_internal_constraints(resource_t * rsc, pe_working_set_t * data_set)
|
|
|
60de42 |
id = crm_strdup_printf("%s-remote-with-ip-%d", rsc->id, tuple->offset);
|
|
|
60de42 |
rsc_colocation_new(id, NULL, INFINITY, tuple->remote, tuple->ip, NULL, NULL, data_set);
|
|
|
60de42 |
free(id);
|
|
|
60de42 |
- } else {
|
|
|
60de42 |
- id = crm_strdup_printf("%s-remote-with-docker-%d", rsc->id, tuple->offset);
|
|
|
60de42 |
- rsc_colocation_new(id, NULL, INFINITY, tuple->remote, tuple->docker, NULL, NULL, data_set);
|
|
|
60de42 |
- free(id);
|
|
|
60de42 |
+// } else {
|
|
|
60de42 |
+ // remote-with-docker is already handled in native_internal_constraints() by 'resource-with-container'
|
|
|
60de42 |
}
|
|
|
60de42 |
}
|
|
|
60de42 |
|
|
|
60de42 |
--
|
|
|
60de42 |
1.8.3.1
|
|
|
60de42 |
|
|
|
60de42 |
|
|
|
60de42 |
From 42f9f877c0745697de144d55a93297e570ace7a6 Mon Sep 17 00:00:00 2001
|
|
|
60de42 |
From: Andrew Beekhof <andrew@beekhof.net>
|
|
|
60de42 |
Date: Fri, 5 May 2017 18:04:32 +1000
|
|
|
60de42 |
Subject: [PATCH 3/4] Containers: Ensure remote resources are only allocated to
|
|
|
60de42 |
full cluster nodes
|
|
|
60de42 |
|
|
|
60de42 |
---
|
|
|
60de42 |
lib/pengine/container.c | 9 +++++++++
|
|
|
60de42 |
1 file changed, 9 insertions(+)
|
|
|
60de42 |
|
|
|
60de42 |
diff --git a/lib/pengine/container.c b/lib/pengine/container.c
|
|
|
60de42 |
index 45eadea..a7aeb43 100644
|
|
|
60de42 |
--- a/lib/pengine/container.c
|
|
|
60de42 |
+++ b/lib/pengine/container.c
|
|
|
60de42 |
@@ -342,6 +342,7 @@ create_remote_resource(
|
|
|
60de42 |
pe_working_set_t * data_set)
|
|
|
60de42 |
{
|
|
|
60de42 |
if (tuple->child && valid_network(data)) {
|
|
|
60de42 |
+ GHashTableIter gIter;
|
|
|
60de42 |
node_t *node = NULL;
|
|
|
60de42 |
xmlNode *xml_obj = NULL;
|
|
|
60de42 |
xmlNode *xml_remote = NULL;
|
|
|
60de42 |
@@ -412,6 +413,14 @@ create_remote_resource(
|
|
|
60de42 |
return FALSE;
|
|
|
60de42 |
}
|
|
|
60de42 |
|
|
|
60de42 |
+ g_hash_table_iter_init(&gIter, tuple->remote->allowed_nodes);
|
|
|
60de42 |
+ while (g_hash_table_iter_next(&gIter, NULL, (void **)&node)) {
|
|
|
60de42 |
+ if(is_remote_node(node)) {
|
|
|
60de42 |
+ /* Remote resources can only run on 'normal' cluster node */
|
|
|
60de42 |
+ node->weight = -INFINITY;
|
|
|
60de42 |
+ }
|
|
|
60de42 |
+ }
|
|
|
60de42 |
+
|
|
|
60de42 |
tuple->node->details->remote_rsc = tuple->remote;
|
|
|
60de42 |
parent->children = g_list_append(parent->children, tuple->remote);
|
|
|
60de42 |
}
|
|
|
60de42 |
--
|
|
|
60de42 |
1.8.3.1
|
|
|
60de42 |
|
|
|
60de42 |
|
|
|
60de42 |
From b71a458dbd2ae06a86c5f99cbdd1e8010094e22d Mon Sep 17 00:00:00 2001
|
|
|
60de42 |
From: Andrew Beekhof <andrew@beekhof.net>
|
|
|
60de42 |
Date: Fri, 5 May 2017 18:05:14 +1000
|
|
|
60de42 |
Subject: [PATCH 4/4] Containers: Relax docker/remote colocation constraint
|
|
|
60de42 |
when appropriate
|
|
|
60de42 |
|
|
|
60de42 |
We prefer the remote resource to be allocated to the same node as the
|
|
|
60de42 |
corresponding container, but there are situations where it is safe to
|
|
|
60de42 |
allow it to run elsewhere.
|
|
|
60de42 |
|
|
|
60de42 |
We may want to expand this capability to other scenarios in the future,
|
|
|
60de42 |
but for now limit it to bundle resources since we generate the resources
|
|
|
60de42 |
for those and know they are safe.
|
|
|
60de42 |
---
|
|
|
60de42 |
include/crm/pengine/status.h | 2 ++
|
|
|
60de42 |
lib/pengine/container.c | 13 +++++++++++++
|
|
|
60de42 |
pengine/native.c | 7 +++++--
|
|
|
60de42 |
3 files changed, 20 insertions(+), 2 deletions(-)
|
|
|
60de42 |
|
|
|
60de42 |
diff --git a/include/crm/pengine/status.h b/include/crm/pengine/status.h
|
|
|
60de42 |
index 4cc3919..b9032b5 100644
|
|
|
60de42 |
--- a/include/crm/pengine/status.h
|
|
|
60de42 |
+++ b/include/crm/pengine/status.h
|
|
|
60de42 |
@@ -192,6 +192,8 @@ struct node_s {
|
|
|
60de42 |
# define pe_rsc_try_reload 0x00001000ULL
|
|
|
60de42 |
# define pe_rsc_reload 0x00002000ULL
|
|
|
60de42 |
|
|
|
60de42 |
+# define pe_rsc_allow_remote_remotes 0x00004000ULL
|
|
|
60de42 |
+
|
|
|
60de42 |
# define pe_rsc_failed 0x00010000ULL
|
|
|
60de42 |
# define pe_rsc_shutdown 0x00020000ULL
|
|
|
60de42 |
# define pe_rsc_runnable 0x00040000ULL
|
|
|
60de42 |
diff --git a/lib/pengine/container.c b/lib/pengine/container.c
|
|
|
60de42 |
index a7aeb43..1280227 100644
|
|
|
60de42 |
--- a/lib/pengine/container.c
|
|
|
60de42 |
+++ b/lib/pengine/container.c
|
|
|
60de42 |
@@ -446,6 +446,19 @@ create_container(
|
|
|
60de42 |
add_hash_param(tuple->child->meta, "external-ip", tuple->ipaddr);
|
|
|
60de42 |
}
|
|
|
60de42 |
|
|
|
60de42 |
+ if(tuple->remote) {
|
|
|
60de42 |
+ /*
|
|
|
60de42 |
+ * Allow the remote connection resource to be allocated to a
|
|
|
60de42 |
+ * different node than the one on which the docker container
|
|
|
60de42 |
+ * is active.
|
|
|
60de42 |
+ *
|
|
|
60de42 |
+ * Makes it possible to have remote nodes, running docker
|
|
|
60de42 |
+ * containers with pacemaker_remoted inside in order to start
|
|
|
60de42 |
+ * services inside those containers.
|
|
|
60de42 |
+ */
|
|
|
60de42 |
+ set_bit(tuple->remote->flags, pe_rsc_allow_remote_remotes);
|
|
|
60de42 |
+ }
|
|
|
60de42 |
+
|
|
|
60de42 |
return FALSE;
|
|
|
60de42 |
}
|
|
|
60de42 |
|
|
|
60de42 |
diff --git a/pengine/native.c b/pengine/native.c
|
|
|
60de42 |
index d0cebb3..f3ea1c5 100644
|
|
|
60de42 |
--- a/pengine/native.c
|
|
|
60de42 |
+++ b/pengine/native.c
|
|
|
60de42 |
@@ -1466,7 +1466,7 @@ native_internal_constraints(resource_t * rsc, pe_working_set_t * data_set)
|
|
|
60de42 |
}
|
|
|
60de42 |
}
|
|
|
60de42 |
} else {
|
|
|
60de42 |
-
|
|
|
60de42 |
+ int score = 10000; /* Highly preferred but not essential */
|
|
|
60de42 |
crm_trace("Generating order and colocation rules for rsc %s with container %s", rsc->id, rsc->container->id);
|
|
|
60de42 |
custom_action_order(rsc->container, generate_op_key(rsc->container->id, RSC_START, 0), NULL,
|
|
|
60de42 |
rsc, generate_op_key(rsc->id, RSC_START, 0), NULL,
|
|
|
60de42 |
@@ -1476,7 +1476,10 @@ native_internal_constraints(resource_t * rsc, pe_working_set_t * data_set)
|
|
|
60de42 |
rsc->container, generate_op_key(rsc->container->id, RSC_STOP, 0), NULL,
|
|
|
60de42 |
pe_order_implies_first, data_set);
|
|
|
60de42 |
|
|
|
60de42 |
- rsc_colocation_new("resource-with-container", NULL, INFINITY, rsc, rsc->container, NULL,
|
|
|
60de42 |
+ if(is_not_set(rsc->flags, pe_rsc_allow_remote_remotes)) {
|
|
|
60de42 |
+ score = INFINITY; /* Force them to run on the same host */
|
|
|
60de42 |
+ }
|
|
|
60de42 |
+ rsc_colocation_new("resource-with-container", NULL, score, rsc, rsc->container, NULL,
|
|
|
60de42 |
NULL, data_set);
|
|
|
60de42 |
}
|
|
|
60de42 |
}
|
|
|
60de42 |
--
|
|
|
60de42 |
1.8.3.1
|
|
|
60de42 |
|