From 9020865cbdfbaea44aca3e66e78c93558e9bff8a Mon Sep 17 00:00:00 2001 From: Hideo Yamauchi Date: Thu, 14 May 2015 14:56:37 +0900 Subject: [PATCH 1/6] Low : fencing : Correction of the log output of the practice node of stonith. When there is not stonith device or when a host does not exist, the patch does the log output of the executant in "". --- fencing/remote.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fencing/remote.c b/fencing/remote.c index 8331cec2866..49cb459db42 100644 --- a/fencing/remote.c +++ b/fencing/remote.c @@ -278,10 +278,12 @@ remote_op_done(remote_fencing_op_t * op, xmlNode * data, int rc, int dup) goto remote_op_done_cleanup; } - if (!op->delegate && data) { + if (!op->delegate && data && rc != -ENODEV && rc != -EHOSTUNREACH) { xmlNode *ndata = get_xpath_object("//@" F_STONITH_DELEGATE, data, LOG_TRACE); if(ndata) { op->delegate = crm_element_value_copy(ndata, F_STONITH_DELEGATE); + } else { + op->delegate = crm_element_value_copy(data, F_ORIG); } } From b207154064ca81c991af82f114b09662061a2cf7 Mon Sep 17 00:00:00 2001 From: "Gao,Yan" Date: Sat, 16 May 2015 14:51:26 +0200 Subject: [PATCH 2/6] Fix: xml: Prevent potential use-of-NULL Maybe I'm paranoid. Better safe than sorry. --- lib/common/xml.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/common/xml.c b/lib/common/xml.c index e1f90ac6ee5..84a6557f3c7 100644 --- a/lib/common/xml.c +++ b/lib/common/xml.c @@ -3416,7 +3416,7 @@ dump_xml_attr(xmlAttrPtr attr, int options, char **buffer, int *offset, int *max } p = attr->_private; - if (is_set(p->flags, xpf_deleted)) { + if (p && is_set(p->flags, xpf_deleted)) { return; } From a2148b95c49ea2392316b8bd2eb7283e4a4f8f50 Mon Sep 17 00:00:00 2001 From: "Gao,Yan" Date: Sun, 17 May 2015 15:09:47 +0200 Subject: [PATCH 3/6] Fix: xml: Correctly create v1 patchsets when deleting attributes --- lib/common/xml.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/common/xml.c b/lib/common/xml.c index e1f90ac6ee5..0db1319e6ea 100644 --- a/lib/common/xml.c +++ b/lib/common/xml.c @@ -4548,6 +4548,8 @@ subtract_xml_object(xmlNode * parent, xmlNode * left, xmlNode * right, /* changes to name/value pairs */ for (xIter = crm_first_attr(left); xIter != NULL; xIter = xIter->next) { const char *prop_name = (const char *)xIter->name; + xmlAttrPtr right_attr = NULL; + xml_private_t *p = NULL; if (strcmp(prop_name, XML_ATTR_ID) == 0) { continue; @@ -4566,8 +4568,13 @@ subtract_xml_object(xmlNode * parent, xmlNode * left, xmlNode * right, continue; } + right_attr = xmlHasProp(right, (const xmlChar *)prop_name); + if (right_attr) { + p = right_attr->_private; + } + right_val = crm_element_value(right, prop_name); - if (right_val == NULL) { + if (right_val == NULL || (p && is_set(p->flags, xpf_deleted))) { /* new */ *changed = TRUE; if (full) { From e3d157a9e96359a8c192df60aa1b247ff08c0391 Mon Sep 17 00:00:00 2001 From: "Gao,Yan" Date: Sun, 17 May 2015 21:59:10 +0200 Subject: [PATCH 4/6] Fix: cib: Correctly add "update-origin", "update-client" and "update-user" attributes for cib Schema "pacemaker-1.1" has a larger index number than the regular schemas now. --- lib/cib/cib_utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cib/cib_utils.c b/lib/cib/cib_utils.c index ea37c4b7bc1..774f2d0f06e 100644 --- a/lib/cib/cib_utils.c +++ b/lib/cib/cib_utils.c @@ -531,7 +531,7 @@ cib_perform_op(const char *op, int call_options, cib_op_t * fn, gboolean is_quer int current_schema = get_schema_version(schema); if (minimum_schema == 0) { - minimum_schema = get_schema_version("pacemaker-1.1"); + minimum_schema = get_schema_version("pacemaker-1.2"); } /* Does the CIB support the "update-*" attributes... */ From 9c3b681323c3db6c8bdf0229fa339cec3a08323b Mon Sep 17 00:00:00 2001 From: "Gao,Yan" Date: Tue, 19 May 2015 16:30:20 +0200 Subject: [PATCH 5/6] Fix: pengine: cl#5130 - Only check the capacities of the nodes that are allowed to run the resource --- pengine/utilization.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/pengine/utilization.c b/pengine/utilization.c index 982fcc96b42..db41b211338 100644 --- a/pengine/utilization.c +++ b/pengine/utilization.c @@ -344,9 +344,10 @@ process_utilization(resource_t * rsc, node_t ** prefer, pe_working_set_t * data_ int alloc_details = scores_log_level + 1; if (safe_str_neq(data_set->placement_strategy, "default")) { - GListPtr gIter = NULL; + GHashTableIter iter; GListPtr colocated_rscs = NULL; gboolean any_capable = FALSE; + node_t *node = NULL; colocated_rscs = find_colocated_rscs(colocated_rscs, rsc, rsc); if (colocated_rscs) { @@ -356,8 +357,11 @@ process_utilization(resource_t * rsc, node_t ** prefer, pe_working_set_t * data_ unallocated_utilization = sum_unallocated_utilization(rsc, colocated_rscs); - for (gIter = data_set->nodes; gIter != NULL; gIter = gIter->next) { - node_t *node = (node_t *) gIter->data; + g_hash_table_iter_init(&iter, rsc->allowed_nodes); + while (g_hash_table_iter_next(&iter, NULL, (void **)&node)) { + if (can_run_resources(node) == FALSE || node->weight < 0) { + continue; + } if (have_enough_capacity(node, rscs_id, unallocated_utilization)) { any_capable = TRUE; @@ -371,8 +375,11 @@ process_utilization(resource_t * rsc, node_t ** prefer, pe_working_set_t * data_ } if (any_capable) { - for (gIter = data_set->nodes; gIter != NULL; gIter = gIter->next) { - node_t *node = (node_t *) gIter->data; + g_hash_table_iter_init(&iter, rsc->allowed_nodes); + while (g_hash_table_iter_next(&iter, NULL, (void **)&node)) { + if (can_run_resources(node) == FALSE || node->weight < 0) { + continue; + } if (have_enough_capacity(node, rscs_id, unallocated_utilization) == FALSE) { pe_rsc_debug(rsc, "Resource %s and its colocated resources cannot be allocated to node %s: no enough capacity", @@ -394,8 +401,11 @@ process_utilization(resource_t * rsc, node_t ** prefer, pe_working_set_t * data_ } if (any_capable == FALSE) { - for (gIter = data_set->nodes; gIter != NULL; gIter = gIter->next) { - node_t *node = (node_t *) gIter->data; + g_hash_table_iter_init(&iter, rsc->allowed_nodes); + while (g_hash_table_iter_next(&iter, NULL, (void **)&node)) { + if (can_run_resources(node) == FALSE || node->weight < 0) { + continue; + } if (have_enough_capacity(node, rsc->id, rsc->utilization) == FALSE) { pe_rsc_debug(rsc, "Resource %s cannot be allocated to node %s: no enough capacity", From 65c4f3aa4dcda3ac89e29762fe3af51d227b7767 Mon Sep 17 00:00:00 2001 From: "Gao,Yan" Date: Tue, 19 May 2015 18:18:46 +0200 Subject: [PATCH 6/6] Test: pengine: cl#5130 - Only check the capacities of the nodes that are allowed to run the resource (regression test) --- pengine/regression.sh | 2 + .../utilization-check-allowed-nodes.dot | 19 +++ .../utilization-check-allowed-nodes.exp | 112 ++++++++++++++++++ .../utilization-check-allowed-nodes.scores | 5 + .../utilization-check-allowed-nodes.summary | 26 ++++ .../utilization-check-allowed-nodes.xml | 39 ++++++ 6 files changed, 203 insertions(+) create mode 100644 pengine/test10/utilization-check-allowed-nodes.dot create mode 100644 pengine/test10/utilization-check-allowed-nodes.exp create mode 100644 pengine/test10/utilization-check-allowed-nodes.scores create mode 100644 pengine/test10/utilization-check-allowed-nodes.summary create mode 100644 pengine/test10/utilization-check-allowed-nodes.xml diff --git a/pengine/regression.sh b/pengine/regression.sh index a88a08435fd..7b287d0746a 100755 --- a/pengine/regression.sh +++ b/pengine/regression.sh @@ -564,6 +564,8 @@ do_test colocated-utilization-primitive-2 "Colocated Utilization - Choose the mo do_test colocated-utilization-group "Colocated Utilization - Group" do_test colocated-utilization-clone "Colocated Utilization - Clone" +do_test utilization-check-allowed-nodes "Only check the capacities of the nodes that can run the resource" + echo "" do_test reprobe-target_rc "Ensure correct target_rc for reprobe of inactive resources" do_test node-maintenance-1 "cl#5128 - Node maintenance" diff --git a/pengine/test10/utilization-check-allowed-nodes.dot b/pengine/test10/utilization-check-allowed-nodes.dot new file mode 100644 index 00000000000..d09efbc0973 --- /dev/null +++ b/pengine/test10/utilization-check-allowed-nodes.dot @@ -0,0 +1,19 @@ +digraph "g" { +"load_stopped_node1 node1" [ style=bold color="green" fontcolor="orange"] +"load_stopped_node2 node2" [ style=bold color="green" fontcolor="orange"] +"probe_complete node1" -> "probe_complete" [ style = bold] +"probe_complete node1" [ style=bold color="green" fontcolor="black"] +"probe_complete node2" -> "probe_complete" [ style = bold] +"probe_complete node2" [ style=bold color="green" fontcolor="black"] +"probe_complete" -> "rsc1_start_0 node2" [ style = bold] +"probe_complete" [ style=bold color="green" fontcolor="orange"] +"rsc1_monitor_0 node1" -> "probe_complete node1" [ style = bold] +"rsc1_monitor_0 node1" [ style=bold color="green" fontcolor="black"] +"rsc1_monitor_0 node2" -> "probe_complete node2" [ style = bold] +"rsc1_monitor_0 node2" [ style=bold color="green" fontcolor="black"] +"rsc1_start_0 node2" [ style=bold color="green" fontcolor="black"] +"rsc2_monitor_0 node1" -> "probe_complete node1" [ style = bold] +"rsc2_monitor_0 node1" [ style=bold color="green" fontcolor="black"] +"rsc2_monitor_0 node2" -> "probe_complete node2" [ style = bold] +"rsc2_monitor_0 node2" [ style=bold color="green" fontcolor="black"] +} diff --git a/pengine/test10/utilization-check-allowed-nodes.exp b/pengine/test10/utilization-check-allowed-nodes.exp new file mode 100644 index 00000000000..134ccb383cc --- /dev/null +++ b/pengine/test10/utilization-check-allowed-nodes.exp @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pengine/test10/utilization-check-allowed-nodes.scores b/pengine/test10/utilization-check-allowed-nodes.scores new file mode 100644 index 00000000000..26887e2f624 --- /dev/null +++ b/pengine/test10/utilization-check-allowed-nodes.scores @@ -0,0 +1,5 @@ +Allocation scores: +native_color: rsc1 allocation score on node1: -INFINITY +native_color: rsc1 allocation score on node2: 0 +native_color: rsc2 allocation score on node1: -INFINITY +native_color: rsc2 allocation score on node2: 0 diff --git a/pengine/test10/utilization-check-allowed-nodes.summary b/pengine/test10/utilization-check-allowed-nodes.summary new file mode 100644 index 00000000000..12bf19a9cda --- /dev/null +++ b/pengine/test10/utilization-check-allowed-nodes.summary @@ -0,0 +1,26 @@ + +Current cluster status: +Online: [ node1 node2 ] + + rsc1 (ocf::pacemaker:Dummy): Stopped + rsc2 (ocf::pacemaker:Dummy): Stopped + +Transition Summary: + * Start rsc1 (node2) + +Executing cluster transition: + * Resource action: rsc1 monitor on node2 + * Resource action: rsc1 monitor on node1 + * Resource action: rsc2 monitor on node2 + * Resource action: rsc2 monitor on node1 + * Pseudo action: probe_complete + * Pseudo action: load_stopped_node1 + * Pseudo action: load_stopped_node2 + * Resource action: rsc1 start on node2 + +Revised cluster status: +Online: [ node1 node2 ] + + rsc1 (ocf::pacemaker:Dummy): Started node2 + rsc2 (ocf::pacemaker:Dummy): Stopped + diff --git a/pengine/test10/utilization-check-allowed-nodes.xml b/pengine/test10/utilization-check-allowed-nodes.xml new file mode 100644 index 00000000000..39cf51f9b63 --- /dev/null +++ b/pengine/test10/utilization-check-allowed-nodes.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +