I'm sorry.

Because a code for debugging was left, I deleted it.

I attach a new thing.

(2011/07/12 20:40), Yuusuke IIDA wrote:
Hi, Yan

I report a new problem of "placement-strategy".

I set colocation in resource grpPostgreSQLDB1 which provided service and
"clnPingd" resource.

grpPostgreSQLDB1 depends on clnPingd.

When clnPingd of node "act1" stopped, grpPostgreSQLDB1 hoped that I moved to
node "sby1".

However, it was not carried out.

I made a patch to solve this problem.

There is the correction in conjunction with the correction of the group 
resource.

Please confirm whether you do not have any problem by this correction.

Best Regards,
Yuusuke



_______________________________________________
Pacemaker mailing list: Pacemaker@oss.clusterlabs.org
http://oss.clusterlabs.org/mailman/listinfo/pacemaker

Project Home: http://www.clusterlabs.org
Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
Bugs: http://developerbugs.linux-foundation.org/enter_bug.cgi?product=Pacemaker

--
----------------------------------------
METRO SYSTEMS CO., LTD

Yuusuke Iida
Mail: iiday...@intellilink.co.jp
----------------------------------------
diff -r 75575ce39861 pengine/allocate.c
--- a/pengine/allocate.c	Tue Jun 21 15:54:20 2011 +0200
+++ b/pengine/allocate.c	Wed Jul 13 13:12:35 2011 +0900
@@ -923,6 +923,7 @@
     const resource_t *resource2 = (const resource_t*)b;
     const GListPtr nodes = (GListPtr)data;
     GListPtr gIter = NULL;
+    GListPtr gIter2 = NULL;
 
     if(a == NULL && b == NULL) { return 0; }
     if(a == NULL) { return 1; }
@@ -960,11 +961,59 @@
 	    resource1_weight = resource1_node->weight;
 	}
 
+	if(resource1->variant == pe_group && resource1->children != NULL) {
+	    for(gIter2 = resource1->children; gIter2 != NULL; gIter2 = gIter2->next) {
+		resource_t *child_rsc = (resource_t *)gIter2->data;
+		node_t *child_node = g_hash_table_lookup(child_rsc->allowed_nodes, resource1_node->details->id);
+		if(child_node && child_node->weight > resource1_weight) {
+		    resource1_weight = child_node->weight;
+		} else if(child_node && child_node->weight == -INFINITY) {
+		    resource1_weight = child_node->weight;
+		    break;
+		}
+	    }
+	}
+
+	if(resource1->rsc_cons) {
+	    for(gIter2 = resource1->rsc_cons; gIter2 != NULL; gIter2 = gIter2->next) {
+		rsc_colocation_t *constraint = (rsc_colocation_t*)gIter2->data;
+		node_t *cons_node = g_hash_table_lookup(constraint->rsc_rh->allowed_nodes, node->details->uname);
+		if(cons_node && cons_node->weight == -INFINITY) {
+		    resource1_weight = cons_node->weight;
+		    break;
+		}
+	    }
+	}
+
 	resource2_node = g_hash_table_lookup(resource2->allowed_nodes, node->details->id);
 	if (resource2_node) {
 	    resource2_weight = resource2_node->weight;
 	}
 
+	if(resource2->variant == pe_group && resource2->children != NULL) {
+	    for(gIter2 = resource2->children; gIter2 != NULL; gIter2 = gIter2->next) {
+		resource_t *child_rsc = (resource_t *)gIter2->data;
+		node_t *child_node = g_hash_table_lookup(child_rsc->allowed_nodes, resource2_node->details->id);
+		if(child_node && child_node->weight > resource2_weight) {
+		    resource2_weight = child_node->weight;
+		} else if(child_node && child_node->weight == -INFINITY) {
+		    resource2_weight = child_node->weight;
+		    break;
+		}
+	    }
+	}
+
+	if(resource2->rsc_cons) {
+	    for(gIter2 = resource2->rsc_cons; gIter2 != NULL; gIter2 = gIter2->next) {
+		rsc_colocation_t *constraint = (rsc_colocation_t*)gIter2->data;
+		node_t *cons_node = g_hash_table_lookup(constraint->rsc_rh->allowed_nodes, node->details->uname);
+		if(cons_node && cons_node->weight == -INFINITY) {
+		    resource2_weight = cons_node->weight;
+		    break;
+		}
+	    }
+	}
+
 	if(resource1_weight > resource2_weight) {
 	    do_crm_log_unlikely(level, "%s (%d) > %s (%d) on %s: score",
 			    resource1->id, resource1_weight,
_______________________________________________
Pacemaker mailing list: Pacemaker@oss.clusterlabs.org
http://oss.clusterlabs.org/mailman/listinfo/pacemaker

Project Home: http://www.clusterlabs.org
Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
Bugs: http://developerbugs.linux-foundation.org/enter_bug.cgi?product=Pacemaker

Reply via email to