Skip to content

Commit

Permalink
Merge pull request #608 from davidvossel/master
Browse files Browse the repository at this point in the history
resource-discovery documentation and fixes
  • Loading branch information
beekhof committed Nov 13, 2014
2 parents cd7c9ab + fd43a52 commit c191bf3
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 9 deletions.
31 changes: 30 additions & 1 deletion doc/Pacemaker_Explained/en-US/Ch-Constraints.txt
Expand Up @@ -36,28 +36,33 @@ nothing able to run anywhere and selectively enable allowed nodes.
=== Options ===

.Options for Simple Location Constraints
[width="95%",cols="2m,5<",options="header",align="center"]
[width="95%",cols="2m,1,5<",options="header",align="center"]
|=========================================================

|Field
|Default
|Description

|id
|
|A unique name for the constraint
indexterm:[id,Location Constraints]
indexterm:[Constraints,Location,id]

|rsc
|
|A resource name
indexterm:[rsc,Location Constraints]
indexterm:[Constraints,Location,rsc]

|node
|
|A node's name
indexterm:[node,Location Constraints]
indexterm:[Constraints,Location,node]

|score
|
|Positive values indicate the resource should run on this
node. Negative values indicate the resource should not run on this
node.
Expand All @@ -67,6 +72,30 @@ indexterm:[Constraints,Location,node]
indexterm:[score,Location Constraints]
indexterm:[Constraints,Location,score]

|resource-discovery
|+always+
|Indicates whether or not Pacemaker should perform resource discovery
on this node for the specified resource. Limiting resource discovery to
a subset of nodes the resource is physically capable of running on
can significantly boost performance when a large set of nodes are preset.
When pacemaker_remote is in use to expand the node count into the 100s of
nodes range, this option should be considered.

* 'always' - Always perform resource discovery for the specified resource on this node.

* 'never' - Never perform resource discovery for the specified resource on this node.
This option should generally be used with a -INFINITY score. Although that is not strictly
required.

* 'exclusive' - Only perform resource discovery for the specified resource on this node. Multiple
location constraints using 'exclusive' discovery for the same resource across different nodes
creates a subset of nodes resource-discovery is exclusive to. If a resource is marked
for 'exclusive' discovery on one or more nodes, that resource is only allowed to be placed
within that subset of nodes.

indexterm:[Resource Discovery,Location Constraints]
indexterm:[Constraints,Location,Resource Discovery]

|=========================================================

=== Asymmetrical "Opt-In" Clusters ===
Expand Down
10 changes: 6 additions & 4 deletions pengine/constraints.c
Expand Up @@ -52,6 +52,8 @@ enum pe_order_kind {
enum pe_ordering get_flags(const char *id, enum pe_order_kind kind,
const char *action_first, const char *action_then, gboolean invert);
enum pe_ordering get_asymmetrical_flags(enum pe_order_kind kind);
static rsc_to_node_t *generate_location_rule(resource_t * rsc, xmlNode * rule_xml,
const char *discovery, pe_working_set_t * data_set);

gboolean
unpack_constraints(xmlNode * xml_constraints, pe_working_set_t * data_set)
Expand Down Expand Up @@ -687,7 +689,7 @@ unpack_rsc_location(xmlNode * xml_obj, resource_t * rsc_lh, const char * role,
if (crm_str_eq((const char *)rule_xml->name, XML_TAG_RULE, TRUE)) {
empty = FALSE;
crm_trace("Unpacking %s/%s", id, ID(rule_xml));
generate_location_rule(rsc_lh, rule_xml, data_set);
generate_location_rule(rsc_lh, rule_xml, discovery, data_set);
}
}

Expand Down Expand Up @@ -917,8 +919,8 @@ get_node_score(const char *rule, const char *score, gboolean raw, node_t * node)
return score_f;
}

rsc_to_node_t *
generate_location_rule(resource_t * rsc, xmlNode * rule_xml, pe_working_set_t * data_set)
static rsc_to_node_t *
generate_location_rule(resource_t * rsc, xmlNode * rule_xml, const char *discovery, pe_working_set_t * data_set)
{
const char *rule_id = NULL;
const char *score = NULL;
Expand Down Expand Up @@ -960,7 +962,7 @@ generate_location_rule(resource_t * rsc, xmlNode * rule_xml, pe_working_set_t *
do_and = FALSE;
}

location_rule = rsc2node_new(rule_id, rsc, 0, NULL, NULL, data_set);
location_rule = rsc2node_new(rule_id, rsc, 0, discovery, NULL, data_set);

if (location_rule == NULL) {
return NULL;
Expand Down
8 changes: 7 additions & 1 deletion pengine/test10/resource-discovery.xml
Expand Up @@ -97,7 +97,13 @@
<rsc_location id="location-FAKE1-remote1" node="remote1" resource-discovery="never" rsc="FAKE1" score="-INFINITY"/>
<rsc_location id="location-FAKE1-18node1" node="18node1" resource-discovery="never" rsc="FAKE1" score="-INFINITY"/>
<rsc_location id="location-FAKE1-18node2" node="18node2" resource-discovery="never" rsc="FAKE1" score="-INFINITY"/>
<rsc_location id="location-FAKE1-18node3" node="18node3" resource-discovery="never" rsc="FAKE1" score="-INFINITY"/>

<rsc_location id="location-FAKE1-18node3" resource-discovery="never" rsc="FAKE1" >
<rule score="-INFINITY" id="vlan003-on-cluster-nodes-rule">
<expression attribute="#uname" operation="eq" value="18node3" id="vlan003-on-cluster-nodes-rule-expression"/>
</rule>
</rsc_location>

<rsc_location id="location-FAKE2-18node1" node="18node1" resource-discovery="exclusive" rsc="FAKE2" score="10"/>
<rsc_location id="location-FAKE2-18node2" node="18node2" resource-discovery="exclusive" rsc="FAKE2" score="100"/>
<rsc_location id="location-FAKE3-18node3--INFINITY" node="18node3" resource-discovery="exclusive" rsc="FAKE3" score="INFINITY"/>
Expand Down
3 changes: 0 additions & 3 deletions pengine/utils.h
Expand Up @@ -39,9 +39,6 @@ extern gboolean rsc_ticket_new(const char *id, resource_t * rsc_lh, ticket_t * t
const char *state_lh, const char *loss_policy,
pe_working_set_t * data_set);

extern rsc_to_node_t *generate_location_rule(resource_t * rsc, xmlNode * location_rule,
pe_working_set_t * data_set);

extern gint sort_node_weight(gconstpointer a, gconstpointer b, gpointer data_set);

extern gboolean can_run_resources(const node_t * node);
Expand Down

0 comments on commit c191bf3

Please sign in to comment.