Skip to content

Commit

Permalink
Merge branch '1.1' of github.com:ClusterLabs/pacemaker into 1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
beekhof committed Jun 19, 2015
2 parents 26180cd + a0449d4 commit 2a1847e
Show file tree
Hide file tree
Showing 10 changed files with 233 additions and 11 deletions.
4 changes: 3 additions & 1 deletion fencing/remote.c
Expand Up @@ -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);
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/cib/cib_utils.c
Expand Up @@ -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... */
Expand Down
11 changes: 9 additions & 2 deletions lib/common/xml.c
Expand Up @@ -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;
}

Expand Down Expand Up @@ -4552,6 +4552,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;
Expand All @@ -4570,8 +4572,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) {
Expand Down
2 changes: 2 additions & 0 deletions pengine/regression.sh
Expand Up @@ -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"
Expand Down
19 changes: 19 additions & 0 deletions 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"]
}
112 changes: 112 additions & 0 deletions pengine/test10/utilization-check-allowed-nodes.exp
@@ -0,0 +1,112 @@
<transition_graph cluster-delay="60s" stonith-timeout="60s" failed-stop-offset="INFINITY" failed-start-offset="INFINITY" transition_id="0">
<synapse id="0">
<action_set>
<rsc_op id="11" operation="start" operation_key="rsc1_start_0" on_node="node2" on_node_uuid="node2">
<primitive id="rsc1" class="ocf" provider="pacemaker" type="Dummy"/>
<attributes CRM_meta_timeout="20000" />
</rsc_op>
</action_set>
<inputs>
<trigger>
<pseudo_event id="4" operation="probe_complete" operation_key="probe_complete"/>
</trigger>
</inputs>
</synapse>
<synapse id="1">
<action_set>
<rsc_op id="9" operation="monitor" operation_key="rsc1_monitor_0" on_node="node2" on_node_uuid="node2">
<primitive id="rsc1" class="ocf" provider="pacemaker" type="Dummy"/>
<attributes CRM_meta_op_target_rc="7" CRM_meta_timeout="20000" />
</rsc_op>
</action_set>
<inputs/>
</synapse>
<synapse id="2">
<action_set>
<rsc_op id="6" operation="monitor" operation_key="rsc1_monitor_0" on_node="node1" on_node_uuid="node1">
<primitive id="rsc1" class="ocf" provider="pacemaker" type="Dummy"/>
<attributes CRM_meta_op_target_rc="7" CRM_meta_timeout="20000" />
</rsc_op>
</action_set>
<inputs/>
</synapse>
<synapse id="3">
<action_set>
<rsc_op id="10" operation="monitor" operation_key="rsc2_monitor_0" on_node="node2" on_node_uuid="node2">
<primitive id="rsc2" class="ocf" provider="pacemaker" type="Dummy"/>
<attributes CRM_meta_op_target_rc="7" CRM_meta_timeout="20000" />
</rsc_op>
</action_set>
<inputs/>
</synapse>
<synapse id="4">
<action_set>
<rsc_op id="7" operation="monitor" operation_key="rsc2_monitor_0" on_node="node1" on_node_uuid="node1">
<primitive id="rsc2" class="ocf" provider="pacemaker" type="Dummy"/>
<attributes CRM_meta_op_target_rc="7" CRM_meta_timeout="20000" />
</rsc_op>
</action_set>
<inputs/>
</synapse>
<synapse id="5" priority="1000000">
<action_set>
<rsc_op id="8" operation="probe_complete" operation_key="probe_complete-node2" on_node="node2" on_node_uuid="node2">
<attributes CRM_meta_op_no_wait="true" />
</rsc_op>
</action_set>
<inputs>
<trigger>
<rsc_op id="9" operation="monitor" operation_key="rsc1_monitor_0" on_node="node2" on_node_uuid="node2"/>
</trigger>
<trigger>
<rsc_op id="10" operation="monitor" operation_key="rsc2_monitor_0" on_node="node2" on_node_uuid="node2"/>
</trigger>
</inputs>
</synapse>
<synapse id="6" priority="1000000">
<action_set>
<rsc_op id="5" operation="probe_complete" operation_key="probe_complete-node1" on_node="node1" on_node_uuid="node1">
<attributes CRM_meta_op_no_wait="true" />
</rsc_op>
</action_set>
<inputs>
<trigger>
<rsc_op id="6" operation="monitor" operation_key="rsc1_monitor_0" on_node="node1" on_node_uuid="node1"/>
</trigger>
<trigger>
<rsc_op id="7" operation="monitor" operation_key="rsc2_monitor_0" on_node="node1" on_node_uuid="node1"/>
</trigger>
</inputs>
</synapse>
<synapse id="7">
<action_set>
<pseudo_event id="4" operation="probe_complete" operation_key="probe_complete">
<attributes />
</pseudo_event>
</action_set>
<inputs>
<trigger>
<rsc_op id="5" operation="probe_complete" operation_key="probe_complete-node1" on_node="node1" on_node_uuid="node1"/>
</trigger>
<trigger>
<rsc_op id="8" operation="probe_complete" operation_key="probe_complete-node2" on_node="node2" on_node_uuid="node2"/>
</trigger>
</inputs>
</synapse>
<synapse id="8">
<action_set>
<pseudo_event id="3" operation="load_stopped_node1" operation_key="load_stopped_node1">
<attributes />
</pseudo_event>
</action_set>
<inputs/>
</synapse>
<synapse id="9">
<action_set>
<pseudo_event id="2" operation="load_stopped_node2" operation_key="load_stopped_node2">
<attributes />
</pseudo_event>
</action_set>
<inputs/>
</synapse>
</transition_graph>
5 changes: 5 additions & 0 deletions 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
26 changes: 26 additions & 0 deletions 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

39 changes: 39 additions & 0 deletions pengine/test10/utilization-check-allowed-nodes.xml
@@ -0,0 +1,39 @@
<cib epoch="1" num_updates="36" admin_epoch="0" validate-with="pacemaker-1.2" cib-last-written="Fri Dec 7 15:42:31 2012" have-quorum="1">
<configuration>
<crm_config>
<cluster_property_set id="cib-bootstrap-options">
<nvpair id="cib-bootstrap-options-stonith-enabled" name="stonith-enabled" value="false"/>
<nvpair id="cib-bootstrap-options-no-quorum-policy" name="no-quorum-policy" value="ignore"/>
<nvpair id="cib-bootstrap-options-placement-strategy" name="placement-strategy" value="utilization"/>
</cluster_property_set>
</crm_config>
<nodes>
<node id="node1" uname="node1">
<utilization id="node1-utlization">
<nvpair id="node1-utlization-cpu" name="cpu" value="4"/>
</utilization>
</node>
<node id="node2" uname="node2">
<utilization id="node2-utlization">
<nvpair id="node2-utlization-cpu" name="cpu" value="2"/>
</utilization>
</node>
</nodes>
<resources>
<primitive id="rsc1" class="ocf" provider="pacemaker" type="Dummy"/>
<primitive id="rsc2" class="ocf" provider="pacemaker" type="Dummy">
<utilization id="rsc2-utlization">
<nvpair id="rsc2-utlization-cpu" name="cpu" value="4"/>
</utilization>
</primitive>
</resources>
<constraints>
<rsc_location id="rsc1-location" rsc="rsc1" node="node1" score="-INFINITY"/>
<rsc_colocation id="rsc2-with-rsc1" rsc="rsc2" with-rsc="rsc1" score="INFINITY"/>
</constraints>
</configuration>
<status>
<node_state id="node1" uname="node1" in_ccm="true" crmd="online" join="member" expected="member" crm-debug-origin="crm_simulate"/>
<node_state id="node2" uname="node2" in_ccm="true" crmd="online" join="member" expected="member" crm-debug-origin="crm_simulate"/>
</status>
</cib>
24 changes: 17 additions & 7 deletions pengine/utilization.c
Expand Up @@ -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) {
Expand All @@ -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;
Expand All @@ -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",
Expand All @@ -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",
Expand Down

0 comments on commit 2a1847e

Please sign in to comment.