Skip to content

Cannot create two colocation constraints on the same resource. #8

Description

@kristvanbesien

When I declare two constraints on the same resrource only one gets created.

For example:

pacemaker::constraint::base{'mysql-avoid':
constraint_type => 'location',
first_resource => $mysql_resource_group_name,
location => $cluster_quorum_host,
score => '-INFINITY'
}
pacemaker::constraint::base{'mysql-prefer':
constraint_type => 'location',
first_resource => $mysql_resource_group_name,
location => $mysql_preferred_host,
score => 'INFINITY'
}

The idea here is to make mysql prefer one host, and avoid another. However, only one constraint gets created.

The reason is that in the base.pp the "unless" clause tests on the presence of the resource name in the ouutput of "pcs location show". As a result the second resource is not created on the host.

My solution was the following modification:

replace:
unless => "/usr/sbin/pcs constraint location show | grep ${first_resource} > /dev/null 2>&1",
with:
unless => "/usr/sbin/pcs constraint location show --full | grep ${name}",

I can send a patch if you want (but I'm a complete git newbie...)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions