[ClusterLabs] Command to show location constraints?

Tomas Jelinek tojeline at redhat.com
Wed Aug 28 03:16:38 EDT 2019


Dne 28. 08. 19 v 6:07 Andrei Borzenkov napsal(a):
> 27.08.2019 18:24, Casey & Gina пишет:
>> Hi, I'm looking for a way to show just location constraints, if they exist, for a cluster.  I'm looking for the same data shown in the output of `pcs config` under the "Location Constraints:" header, but without all the rest, so that I can write a script that checks if there are any set.
>>
>> The situation is that sometimes people will perform a failover with `pcs resource move --master <resource>`, but then forget to follow it up with `pcs resource clear <resource>`, and then it causes unnecessary failbacks later.  As we never want to have any particular node in the cluster preferred for this resource, I'd like to write a script that can automatically check for any location constraints being set and either alert or clear it automatically.
>>
>> Thank you for any advice!
>>
> 
> crm configure show type:location
> 
> to see all location constraints

pcs constraint location
to see all location constraints

pcs constraint location show
allows you to filter by resources or nodes

> crm configure show type:location and cli-*
> 
> to see constraints that are create by crm_resource --move or --ban.

There is no alternative to this in pcs. You can add --full to the pcs 
commands above to make them show constraint ids and then look for ids 
starting with cli-.


Regards,
Tomas

> But you can also simply run "crm_resource --clear" periodically, this
> will remove all move/ban constraints on all resources.


More information about the Users mailing list