Permalink
Browse files

Merge pull request #717 from gao-yan/utilization-check-allowed-nodes

Fix: pengine: cl#5130 - Only check the capacities of the nodes that are allowed to run the resource
  • Loading branch information...
beekhof committed May 19, 2015
2 parents 677f532 + 65c4f3a commit 1370c92e9e840d3e289313a9f58c4c74777f1f7e
View
@@ -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"
@@ -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"]
}
@@ -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>
@@ -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
@@ -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
@@ -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>
View
@@ -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",

0 comments on commit 1370c92

Please sign in to comment.