bbd996
From 6f7ce4e903eed136cc9038952f9d57d4423736dd Mon Sep 17 00:00:00 2001
bbd996
From: Klaus Wenninger <klaus.wenninger@aon.at>
bbd996
Date: Sun, 4 Nov 2018 23:15:58 +0100
bbd996
Subject: [PATCH 1/2] Refactor: remote_ra: have attribute strings in msg_xml.h
bbd996
bbd996
---
bbd996
 crmd/remote_lrmd_ra.c | 6 +++---
bbd996
 include/crm/msg_xml.h | 3 +++
bbd996
 2 files changed, 6 insertions(+), 3 deletions(-)
bbd996
bbd996
diff --git a/crmd/remote_lrmd_ra.c b/crmd/remote_lrmd_ra.c
bbd996
index 3cdc7f0..a164fc1 100644
bbd996
--- a/crmd/remote_lrmd_ra.c
bbd996
+++ b/crmd/remote_lrmd_ra.c
bbd996
@@ -724,10 +724,10 @@ handle_remote_ra_start(lrm_state_t * lrm_state, remote_ra_cmd_t * cmd, int timeo
bbd996
     int timeout_used = timeout_ms > MAX_START_TIMEOUT_MS ? MAX_START_TIMEOUT_MS : timeout_ms;
bbd996
 
bbd996
     for (tmp = cmd->params; tmp; tmp = tmp->next) {
bbd996
-        if (safe_str_eq(tmp->key, "addr") || safe_str_eq(tmp->key, "server")) {
bbd996
+        if (safe_str_eq(tmp->key, XML_RSC_ATTR_REMOTE_RA_ADDR) ||
bbd996
+            safe_str_eq(tmp->key, XML_RSC_ATTR_REMOTE_RA_SERVER)) {
bbd996
             server = tmp->value;
bbd996
-        }
bbd996
-        if (safe_str_eq(tmp->key, "port")) {
bbd996
+        } else if (safe_str_eq(tmp->key, XML_RSC_ATTR_REMOTE_RA_PORT)) {
bbd996
             port = atoi(tmp->value);
bbd996
         }
bbd996
     }
bbd996
diff --git a/include/crm/msg_xml.h b/include/crm/msg_xml.h
bbd996
index 1ac4302..55f42c4 100644
bbd996
--- a/include/crm/msg_xml.h
bbd996
+++ b/include/crm/msg_xml.h
bbd996
@@ -233,6 +233,9 @@
bbd996
 #  define XML_RSC_ATTR_REMOTE_NODE  	"remote-node"
bbd996
 #  define XML_RSC_ATTR_CLEAR_OP         "clear_failure_op"
bbd996
 #  define XML_RSC_ATTR_CLEAR_INTERVAL   "clear_failure_interval"
bbd996
+#  define XML_RSC_ATTR_REMOTE_RA_ADDR   "addr"
bbd996
+#  define XML_RSC_ATTR_REMOTE_RA_SERVER "server"
bbd996
+#  define XML_RSC_ATTR_REMOTE_RA_PORT   "port"
bbd996
 
bbd996
 #  define XML_REMOTE_ATTR_RECONNECT_INTERVAL "reconnect_interval"
bbd996
 
bbd996
-- 
bbd996
1.8.3.1
bbd996
bbd996
bbd996
From 4dae6746002b034868feda763a85de85e08834e7 Mon Sep 17 00:00:00 2001
bbd996
From: Klaus Wenninger <klaus.wenninger@aon.at>
bbd996
Date: Sun, 4 Nov 2018 23:54:11 +0100
bbd996
Subject: [PATCH 2/2] Fix: pacemaker-remote: skip remote_config_check for
bbd996
 guest-nodes
bbd996
bbd996
This is crucial when watchdog-fencing is enabled as the sbd-check
bbd996
done by pacemaker-remote would fail on guest-containers & bundles
bbd996
(eventually tearing down pacemaker-remote inside the container)
bbd996
and even on system-virtualized-guests the sbd-check doesn't make
bbd996
sense as these guests would be fenced by stop/start-cycling the
bbd996
VM.
bbd996
---
bbd996
 crmd/crmd_lrm.h       |  1 +
bbd996
 crmd/lrm_state.c      | 14 +++++++++-----
bbd996
 crmd/remote_lrmd_ra.c | 20 ++++++++++++++++++++
bbd996
 3 files changed, 30 insertions(+), 5 deletions(-)
bbd996
bbd996
diff --git a/crmd/crmd_lrm.h b/crmd/crmd_lrm.h
bbd996
index 7a74f7a..d115056 100644
bbd996
--- a/crmd/crmd_lrm.h
bbd996
+++ b/crmd/crmd_lrm.h
bbd996
@@ -168,5 +168,6 @@ void remote_ra_fail(const char *node_name);
bbd996
 void remote_ra_process_pseudo(xmlNode *xml);
bbd996
 gboolean remote_ra_is_in_maintenance(lrm_state_t * lrm_state);
bbd996
 void remote_ra_process_maintenance_nodes(xmlNode *xml);
bbd996
+gboolean remote_ra_controlling_guest(lrm_state_t * lrm_state);
bbd996
 
bbd996
 gboolean process_lrm_event(lrm_state_t * lrm_state, lrmd_event_data_t * op, struct recurring_op_s *pending);
bbd996
diff --git a/crmd/lrm_state.c b/crmd/lrm_state.c
bbd996
index 497afe1..40da762 100644
bbd996
--- a/crmd/lrm_state.c
bbd996
+++ b/crmd/lrm_state.c
bbd996
@@ -500,11 +500,15 @@ crmd_remote_proxy_cb(lrmd_t *lrmd, void *userdata, xmlNode *msg)
bbd996
         const char *channel = crm_element_value(msg, F_LRMD_IPC_IPC_SERVER);
bbd996
 
bbd996
         proxy = crmd_remote_proxy_new(lrmd, lrm_state->node_name, session, channel);
bbd996
-        if (proxy != NULL) {
bbd996
-            /* Look up stonith-watchdog-timeout and send to the remote peer for validation */
bbd996
-            int rc = fsa_cib_conn->cmds->query(fsa_cib_conn, XML_CIB_TAG_CRMCONFIG, NULL, cib_scope_local);
bbd996
-            fsa_cib_conn->cmds->register_callback_full(fsa_cib_conn, rc, 10, FALSE, lrmd,
bbd996
-                                                       "remote_config_check", remote_config_check, NULL);
bbd996
+        if (!remote_ra_controlling_guest(lrm_state)) {
bbd996
+            if (proxy != NULL) {
bbd996
+                /* Look up stonith-watchdog-timeout and send to the remote peer for validation */
bbd996
+                int rc = fsa_cib_conn->cmds->query(fsa_cib_conn, XML_CIB_TAG_CRMCONFIG, NULL, cib_scope_local);
bbd996
+                fsa_cib_conn->cmds->register_callback_full(fsa_cib_conn, rc, 10, FALSE, lrmd,
bbd996
+                                                        "remote_config_check", remote_config_check, NULL);
bbd996
+            }
bbd996
+        } else {
bbd996
+            crm_debug("Skipping remote_config_check for guest-nodes");
bbd996
         }
bbd996
 
bbd996
     } else if (safe_str_eq(op, LRMD_IPC_OP_SHUTDOWN_REQ)) {
bbd996
diff --git a/crmd/remote_lrmd_ra.c b/crmd/remote_lrmd_ra.c
bbd996
index a164fc1..0414709 100644
bbd996
--- a/crmd/remote_lrmd_ra.c
bbd996
+++ b/crmd/remote_lrmd_ra.c
bbd996
@@ -85,6 +85,15 @@ typedef struct remote_ra_data_s {
bbd996
                               * so we have it signalled back with the
bbd996
                               * transition from pengine
bbd996
                               */
bbd996
+    gboolean controlling_guest; /* Similar for if we are controlling a guest
bbd996
+                                 * or a bare-metal remote.
bbd996
+                                 * Fortunately there is a meta-attribute in
bbd996
+                                 * the transition already and as the
bbd996
+                                 * situation doesn't change over time we can
bbd996
+                                 * use the resource start for noting down
bbd996
+                                 * the information for later use when the
bbd996
+                                 * attributes aren't at hand.
bbd996
+                                 */
bbd996
 } remote_ra_data_t;
bbd996
 
bbd996
 static int handle_remote_ra_start(lrm_state_t * lrm_state, remote_ra_cmd_t * cmd, int timeout_ms);
bbd996
@@ -721,6 +730,7 @@ handle_remote_ra_start(lrm_state_t * lrm_state, remote_ra_cmd_t * cmd, int timeo
bbd996
     const char *server = NULL;
bbd996
     lrmd_key_value_t *tmp = NULL;
bbd996
     int port = 0;
bbd996
+    remote_ra_data_t *ra_data = lrm_state->remote_ra_data;
bbd996
     int timeout_used = timeout_ms > MAX_START_TIMEOUT_MS ? MAX_START_TIMEOUT_MS : timeout_ms;
bbd996
 
bbd996
     for (tmp = cmd->params; tmp; tmp = tmp->next) {
bbd996
@@ -729,6 +739,8 @@ handle_remote_ra_start(lrm_state_t * lrm_state, remote_ra_cmd_t * cmd, int timeo
bbd996
             server = tmp->value;
bbd996
         } else if (safe_str_eq(tmp->key, XML_RSC_ATTR_REMOTE_RA_PORT)) {
bbd996
             port = atoi(tmp->value);
bbd996
+        } else if (safe_str_eq(tmp->key, CRM_META"_"XML_RSC_ATTR_CONTAINER)) {
bbd996
+            ra_data->controlling_guest = TRUE;
bbd996
         }
bbd996
     }
bbd996
 
bbd996
@@ -1262,3 +1274,11 @@ remote_ra_is_in_maintenance(lrm_state_t * lrm_state)
bbd996
 
bbd996
     return ra_data->is_maintenance;
bbd996
 }
bbd996
+
bbd996
+gboolean
bbd996
+remote_ra_controlling_guest(lrm_state_t * lrm_state)
bbd996
+{
bbd996
+    remote_ra_data_t *ra_data = lrm_state->remote_ra_data;
bbd996
+
bbd996
+    return ra_data->controlling_guest;
bbd996
+}
bbd996
-- 
bbd996
1.8.3.1
bbd996