|
|
305287 |
From 169d424cf88594f15e7e66baa705df6b727aa807 Mon Sep 17 00:00:00 2001
|
|
|
305287 |
From: Ken Gaillot <kgaillot@redhat.com>
|
|
|
305287 |
Date: Tue, 4 Jun 2019 16:24:16 -0500
|
|
|
305287 |
Subject: [PATCH 1/4] Log: pacemaker-remoted: use different default log if pid
|
|
|
305287 |
1
|
|
|
305287 |
|
|
|
305287 |
When pacemaker-remoted runs as pid 1 inside a container, there may not be a
|
|
|
305287 |
/var/log/pacemaker directory. To get around this, use a default log of
|
|
|
305287 |
/var/log/pcmk-init.log when running as pid 1.
|
|
|
305287 |
|
|
|
305287 |
This was chosen over alternatives (creating the /var/log/pacemaker directory,
|
|
|
305287 |
or passing the log location as an environment variable when creating the
|
|
|
305287 |
implicit container resource) because it both avoids forcing a restart of
|
|
|
305287 |
active bundles due to configuration change (as well as preserving regression
|
|
|
305287 |
test output) and allows users to configure an explicit log location via the
|
|
|
305287 |
container image or the bundle's extra arguments.
|
|
|
305287 |
---
|
|
|
305287 |
daemons/execd/pacemaker-execd.c | 8 ++++++++
|
|
|
305287 |
1 file changed, 8 insertions(+)
|
|
|
305287 |
|
|
|
305287 |
diff --git a/daemons/execd/pacemaker-execd.c b/daemons/execd/pacemaker-execd.c
|
|
|
305287 |
index e2fdfca..cfa5500 100644
|
|
|
305287 |
--- a/daemons/execd/pacemaker-execd.c
|
|
|
305287 |
+++ b/daemons/execd/pacemaker-execd.c
|
|
|
305287 |
@@ -429,6 +429,14 @@ static void spawn_pidone(int argc, char **argv, char **envp)
|
|
|
305287 |
return;
|
|
|
305287 |
}
|
|
|
305287 |
|
|
|
305287 |
+ /* Containers can be expected to have /var/log, but they may not have
|
|
|
305287 |
+ * /var/log/pacemaker, so use a different default if no value has been
|
|
|
305287 |
+ * explicitly configured in the container's environment.
|
|
|
305287 |
+ */
|
|
|
305287 |
+ if (daemon_option("logfile") == NULL) {
|
|
|
305287 |
+ set_daemon_option("logfile", "/var/log/pcmk-init.log");
|
|
|
305287 |
+ }
|
|
|
305287 |
+
|
|
|
305287 |
sigfillset(&set);
|
|
|
305287 |
sigprocmask(SIG_BLOCK, &set, 0);
|
|
|
305287 |
|
|
|
305287 |
--
|
|
|
305287 |
1.8.3.1
|
|
|
305287 |
|
|
|
305287 |
|
|
|
305287 |
From 7e362387a092b5617b36a69961115f7703e4d801 Mon Sep 17 00:00:00 2001
|
|
|
305287 |
From: Ken Gaillot <kgaillot@redhat.com>
|
|
|
305287 |
Date: Fri, 17 May 2019 12:39:43 -0500
|
|
|
305287 |
Subject: [PATCH 2/4] Refactor: libpe_status: add enum for bundle mount flags
|
|
|
305287 |
|
|
|
305287 |
More readable than 0 or 1
|
|
|
305287 |
---
|
|
|
305287 |
lib/pengine/bundle.c | 17 +++++++++--------
|
|
|
305287 |
lib/pengine/variant.h | 9 ++++++++-
|
|
|
305287 |
2 files changed, 17 insertions(+), 9 deletions(-)
|
|
|
305287 |
|
|
|
305287 |
diff --git a/lib/pengine/bundle.c b/lib/pengine/bundle.c
|
|
|
305287 |
index 3b32f04..b223f03 100644
|
|
|
305287 |
--- a/lib/pengine/bundle.c
|
|
|
305287 |
+++ b/lib/pengine/bundle.c
|
|
|
305287 |
@@ -228,7 +228,7 @@ create_docker_resource(pe_resource_t *parent, pe__bundle_variant_data_t *data,
|
|
|
305287 |
for(GListPtr pIter = data->mounts; pIter != NULL; pIter = pIter->next) {
|
|
|
305287 |
pe__bundle_mount_t *mount = pIter->data;
|
|
|
305287 |
|
|
|
305287 |
- if(mount->flags) {
|
|
|
305287 |
+ if (is_set(mount->flags, pe__bundle_mount_subdir)) {
|
|
|
305287 |
char *source = crm_strdup_printf(
|
|
|
305287 |
"%s/%s-%d", mount->source, data->prefix, replica->offset);
|
|
|
305287 |
|
|
|
305287 |
@@ -396,7 +396,7 @@ create_podman_resource(pe_resource_t *parent, pe__bundle_variant_data_t *data,
|
|
|
305287 |
for(GListPtr pIter = data->mounts; pIter != NULL; pIter = pIter->next) {
|
|
|
305287 |
pe__bundle_mount_t *mount = pIter->data;
|
|
|
305287 |
|
|
|
305287 |
- if(mount->flags) {
|
|
|
305287 |
+ if (is_set(mount->flags, pe__bundle_mount_subdir)) {
|
|
|
305287 |
char *source = crm_strdup_printf(
|
|
|
305287 |
"%s/%s-%d", mount->source, data->prefix, replica->offset);
|
|
|
305287 |
|
|
|
305287 |
@@ -562,7 +562,7 @@ create_rkt_resource(pe_resource_t *parent, pe__bundle_variant_data_t *data,
|
|
|
305287 |
for(GListPtr pIter = data->mounts; pIter != NULL; pIter = pIter->next) {
|
|
|
305287 |
pe__bundle_mount_t *mount = pIter->data;
|
|
|
305287 |
|
|
|
305287 |
- if(mount->flags) {
|
|
|
305287 |
+ if (is_set(mount->flags, pe__bundle_mount_subdir)) {
|
|
|
305287 |
char *source = crm_strdup_printf(
|
|
|
305287 |
"%s/%s-%d", mount->source, data->prefix, replica->offset);
|
|
|
305287 |
|
|
|
305287 |
@@ -894,7 +894,7 @@ create_container(pe_resource_t *parent, pe__bundle_variant_data_t *data,
|
|
|
305287 |
|
|
|
305287 |
static void
|
|
|
305287 |
mount_add(pe__bundle_variant_data_t *bundle_data, const char *source,
|
|
|
305287 |
- const char *target, const char *options, int flags)
|
|
|
305287 |
+ const char *target, const char *options, uint32_t flags)
|
|
|
305287 |
{
|
|
|
305287 |
pe__bundle_mount_t *mount = calloc(1, sizeof(pe__bundle_mount_t));
|
|
|
305287 |
|
|
|
305287 |
@@ -1142,11 +1142,11 @@ pe__unpack_bundle(pe_resource_t *rsc, pe_working_set_t *data_set)
|
|
|
305287 |
const char *source = crm_element_value(xml_child, "source-dir");
|
|
|
305287 |
const char *target = crm_element_value(xml_child, "target-dir");
|
|
|
305287 |
const char *options = crm_element_value(xml_child, "options");
|
|
|
305287 |
- int flags = 0;
|
|
|
305287 |
+ int flags = pe__bundle_mount_none;
|
|
|
305287 |
|
|
|
305287 |
if (source == NULL) {
|
|
|
305287 |
source = crm_element_value(xml_child, "source-dir-root");
|
|
|
305287 |
- flags = 1;
|
|
|
305287 |
+ set_bit(flags, pe__bundle_mount_subdir);
|
|
|
305287 |
}
|
|
|
305287 |
|
|
|
305287 |
if (source && target) {
|
|
|
305287 |
@@ -1251,9 +1251,10 @@ pe__unpack_bundle(pe_resource_t *rsc, pe_working_set_t *data_set)
|
|
|
305287 |
* reasonable.
|
|
|
305287 |
*/
|
|
|
305287 |
mount_add(bundle_data, DEFAULT_REMOTE_KEY_LOCATION,
|
|
|
305287 |
- DEFAULT_REMOTE_KEY_LOCATION, NULL, 0);
|
|
|
305287 |
+ DEFAULT_REMOTE_KEY_LOCATION, NULL, pe__bundle_mount_none);
|
|
|
305287 |
|
|
|
305287 |
- mount_add(bundle_data, CRM_BUNDLE_DIR, "/var/log", NULL, 1);
|
|
|
305287 |
+ mount_add(bundle_data, CRM_BUNDLE_DIR, "/var/log", NULL,
|
|
|
305287 |
+ pe__bundle_mount_subdir);
|
|
|
305287 |
|
|
|
305287 |
port = calloc(1, sizeof(pe__bundle_port_t));
|
|
|
305287 |
if(bundle_data->control_port) {
|
|
|
305287 |
diff --git a/lib/pengine/variant.h b/lib/pengine/variant.h
|
|
|
305287 |
index f46aa11..7f77eef 100644
|
|
|
305287 |
--- a/lib/pengine/variant.h
|
|
|
305287 |
+++ b/lib/pengine/variant.h
|
|
|
305287 |
@@ -51,11 +51,18 @@ typedef struct {
|
|
|
305287 |
pe_resource_t *remote;
|
|
|
305287 |
} pe__bundle_replica_t;
|
|
|
305287 |
|
|
|
305287 |
+enum pe__bundle_mount_flags {
|
|
|
305287 |
+ pe__bundle_mount_none = 0x00,
|
|
|
305287 |
+
|
|
|
305287 |
+ // mount instance-specific subdirectory rather than source directly
|
|
|
305287 |
+ pe__bundle_mount_subdir = 0x01
|
|
|
305287 |
+};
|
|
|
305287 |
+
|
|
|
305287 |
typedef struct {
|
|
|
305287 |
char *source;
|
|
|
305287 |
char *target;
|
|
|
305287 |
char *options;
|
|
|
305287 |
- int flags;
|
|
|
305287 |
+ uint32_t flags; // bitmask of pe__bundle_mount_flags
|
|
|
305287 |
} pe__bundle_mount_t;
|
|
|
305287 |
|
|
|
305287 |
typedef struct {
|
|
|
305287 |
--
|
|
|
305287 |
1.8.3.1
|
|
|
305287 |
|
|
|
305287 |
|
|
|
305287 |
From 87eac95868930ffda4d964c2b6bd9960b6893cc9 Mon Sep 17 00:00:00 2001
|
|
|
305287 |
From: Ken Gaillot <kgaillot@redhat.com>
|
|
|
305287 |
Date: Fri, 17 May 2019 14:13:54 -0500
|
|
|
305287 |
Subject: [PATCH 3/4] Fix: controller: don't check join status after remote
|
|
|
305287 |
node appears
|
|
|
305287 |
|
|
|
305287 |
Only cluster nodes have join state
|
|
|
305287 |
---
|
|
|
305287 |
daemons/controld/controld_callbacks.c | 2 +-
|
|
|
305287 |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
305287 |
|
|
|
305287 |
diff --git a/daemons/controld/controld_callbacks.c b/daemons/controld/controld_callbacks.c
|
|
|
305287 |
index 06ffb9d..3ce7470 100644
|
|
|
305287 |
--- a/daemons/controld/controld_callbacks.c
|
|
|
305287 |
+++ b/daemons/controld/controld_callbacks.c
|
|
|
305287 |
@@ -228,7 +228,7 @@ peer_update_callback(enum crm_status_type type, crm_node_t * node, const void *d
|
|
|
305287 |
crm_trace("Alive=%d, appeared=%d, down=%d",
|
|
|
305287 |
alive, appeared, (down? down->id : -1));
|
|
|
305287 |
|
|
|
305287 |
- if (appeared && (alive > 0)) {
|
|
|
305287 |
+ if (appeared && (alive > 0) && !is_remote) {
|
|
|
305287 |
register_fsa_input_before(C_FSA_INTERNAL, I_NODE_JOIN, NULL);
|
|
|
305287 |
}
|
|
|
305287 |
|
|
|
305287 |
--
|
|
|
305287 |
1.8.3.1
|
|
|
305287 |
|
|
|
305287 |
|
|
|
305287 |
From 5755b63850a17cd91bca28e83c39119378fe1887 Mon Sep 17 00:00:00 2001
|
|
|
305287 |
From: Ken Gaillot <kgaillot@redhat.com>
|
|
|
305287 |
Date: Sat, 18 May 2019 21:59:00 -0500
|
|
|
305287 |
Subject: [PATCH 4/4] Doc: Pacemaker Explained: document effect of SELinux on
|
|
|
305287 |
bundle storage
|
|
|
305287 |
|
|
|
305287 |
---
|
|
|
305287 |
doc/Pacemaker_Explained/en-US/Ch-Advanced-Resources.txt | 15 ++++++++++++---
|
|
|
305287 |
1 file changed, 12 insertions(+), 3 deletions(-)
|
|
|
305287 |
|
|
|
305287 |
diff --git a/doc/Pacemaker_Explained/en-US/Ch-Advanced-Resources.txt b/doc/Pacemaker_Explained/en-US/Ch-Advanced-Resources.txt
|
|
|
305287 |
index e431626..4a181df 100644
|
|
|
305287 |
--- a/doc/Pacemaker_Explained/en-US/Ch-Advanced-Resources.txt
|
|
|
305287 |
+++ b/doc/Pacemaker_Explained/en-US/Ch-Advanced-Resources.txt
|
|
|
305287 |
@@ -999,11 +999,11 @@ association with Docker, Inc. is implied.]
|
|
|
305287 |
|
|
|
305287 |
source-dir="/srv/html"
|
|
|
305287 |
target-dir="/var/www/html"
|
|
|
305287 |
- options="rw"/>
|
|
|
305287 |
+ options="rw,Z"/>
|
|
|
305287 |
|
|
|
305287 |
source-dir-root="/var/log/pacemaker/bundles"
|
|
|
305287 |
target-dir="/etc/httpd/logs"
|
|
|
305287 |
- options="rw"/>
|
|
|
305287 |
+ options="rw,Z"/>
|
|
|
305287 |
</storage>
|
|
|
305287 |
<primitive class="ocf" id="httpd" provider="heartbeat" type="apache"/>
|
|
|
305287 |
</bundle>
|
|
|
305287 |
@@ -1293,7 +1293,8 @@ indexterm:[bundle,storage,storage-mapping]
|
|
|
305287 |
|
|
|
305287 |
|options
|
|
|
305287 |
|
|
|
|
305287 |
-|File system mount options to use when mapping the storage
|
|
|
305287 |
+|A comma-separated list of file system mount options to use when mapping the
|
|
|
305287 |
+ storage
|
|
|
305287 |
indexterm:[options,storage-mapping]
|
|
|
305287 |
indexterm:[storage-mapping,Property,options]
|
|
|
305287 |
|
|
|
305287 |
@@ -1322,6 +1323,14 @@ The +PCMK_authkey_location+ environment variable must not be set to anything
|
|
|
305287 |
other than the default of `/etc/pacemaker/authkey` on any node in the cluster.
|
|
|
305287 |
====
|
|
|
305287 |
|
|
|
305287 |
+[IMPORTANT]
|
|
|
305287 |
+====
|
|
|
305287 |
+If SELinux is used in enforcing mode on the host, you must ensure the container
|
|
|
305287 |
+is allowed to use any storage you mount into it. For Docker and podman bundles,
|
|
|
305287 |
+adding "Z" to the mount options will create a container-specific label for the
|
|
|
305287 |
+mount that allows the container access.
|
|
|
305287 |
+====
|
|
|
305287 |
+
|
|
|
305287 |
=== Bundle Primitive ===
|
|
|
305287 |
|
|
|
305287 |
A bundle may optionally contain one +<primitive>+ resource
|
|
|
305287 |
--
|
|
|
305287 |
1.8.3.1
|
|
|
305287 |
|