File pacemaker-pengine-unmanage-guest-container-puts-guest-in-maintenance.patch of Package pacemaker.14737
commit f5a8c701b81b6e4bde989feeef93fb5b1e539d28
Author: Klaus Wenninger <klaus.wenninger@aon.at>
Date: Thu May 4 19:48:06 2017 +0200
Feature: pengine: unmanage guest-container puts guest in maintenance
sync managed-state of connection-resource with container
can be used to do - otherwise not possible - cleanup of connection
Fixes rhbz#1303742
Index: pacemaker/lib/pengine/unpack.c
===================================================================
--- pacemaker.orig/lib/pengine/unpack.c
+++ pacemaker/lib/pengine/unpack.c
@@ -71,11 +71,21 @@ pe_fence_node(pe_working_set_t * data_se
if (is_container_remote_node(node)) {
resource_t *rsc = node->details->remote_rsc->container;
if (is_set(rsc->flags, pe_rsc_failed) == FALSE) {
- crm_warn("Guest node %s will be fenced (by recovering %s) %s",
- node->details->uname, rsc->id, reason);
- /* node->details->unclean = TRUE; */
- node->details->remote_requires_reset = TRUE;
- set_bit(rsc->flags, pe_rsc_failed);
+ if (!is_set(rsc->flags, pe_rsc_managed)) {
+ crm_notice("Not fencing guest node %s because the container is "
+ "unmanaged, otherwise we would do so recovering %s "
+ "%s", node->details->uname, rsc->id, reason);
+ } else {
+ crm_warn("Guest node %s will be fenced (by recovering %s) %s",
+ node->details->uname, rsc->id, reason);
+
+ /* We don't mark the node as unclean because that would prevent the
+ * node from running resources. We want to allow it to run resources
+ * in this transition if the recovery succeeds.
+ */
+ node->details->remote_requires_reset = TRUE;
+ set_bit(rsc->flags, pe_rsc_failed);
+ }
}
} else if (is_dangling_container_remote_node(node)) {
crm_info("Cleaning up dangling connection resource for guest node %s %s"
@@ -375,6 +385,7 @@ expand_remote_rsc_meta(xmlNode *xml_obj,
const char *connect_timeout = "60s";
const char *remote_allow_migrate=NULL;
char *tmp_id = NULL;
+ const char *container_managed = NULL;
for (attr_set = __xml_first_child(xml_obj); attr_set != NULL; attr_set = __xml_next_element(attr_set)) {
if (safe_str_neq((const char *)attr_set->name, XML_TAG_META_SETS)) {
@@ -395,6 +406,8 @@ expand_remote_rsc_meta(xmlNode *xml_obj,
connect_timeout = value;
} else if (safe_str_eq(name, "remote-allow-migrate")) {
remote_allow_migrate=value;
+ } else if (safe_str_eq(name, XML_RSC_ATTR_MANAGED)) {
+ container_managed = value;
}
}
}
@@ -455,6 +468,15 @@ expand_remote_rsc_meta(xmlNode *xml_obj,
free(tmp_id);
}
+ if (container_managed) {
+ attr = create_xml_node(xml_tmp, XML_CIB_TAG_NVPAIR);
+ tmp_id = crm_concat(remote_name, "meta-attributes-managed", '_');
+ crm_xml_add(attr, XML_ATTR_ID, tmp_id);
+ crm_xml_add(attr, XML_NVPAIR_ATTR_NAME, XML_RSC_ATTR_MANAGED);
+ crm_xml_add(attr, XML_NVPAIR_ATTR_VALUE, container_managed);
+ free(tmp_id);
+ }
+
xml_tmp = create_xml_node(xml_rsc, "operations");
attr = create_xml_node(xml_tmp, XML_ATTR_OP);
tmp_id = crm_concat(remote_name, "monitor-interval-30s", '_');