Bug 1362493 - pcs does not support rsc-pattern in location constraints
Summary: pcs does not support rsc-pattern in location constraints
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: pcs
Version: 7.3
Hardware: Unspecified
OS: Unspecified
high
unspecified
Target Milestone: rc
: ---
Assignee: Tomas Jelinek
QA Contact: cluster-qe@redhat.com
Steven J. Levine
URL:
Whiteboard:
Keywords: FutureFeature
Depends On:
Blocks: 1424387
TreeView+ depends on / blocked
 
Reported: 2016-08-02 11:11 UTC by Tomas Jelinek
Modified: 2017-12-03 10:09 UTC (History)
9 users (show)

(edit)
Support for regular expressions in `pcs` command line when configuring location constraints

`pcs` now supports regular expressions in location constraints on the command line. These constraints apply to multiple resources based on the regular expression matching resource name. This simplifies cluster management as one constraint may be used where several were needed before.
Clone Of:
: 1424387 (view as bug list)
(edit)
Last Closed: 2017-08-01 18:22:57 UTC


Attachments (Terms of Use)
proposed fix (71.57 KB, patch)
2017-02-17 16:49 UTC, Tomas Jelinek
no flags Details | Diff


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2017:1958 normal SHIPPED_LIVE pcs bug fix and enhancement update 2017-08-01 18:09:47 UTC
Red Hat Bugzilla 1420437 None None None Never

Internal Trackers: 1420437

Description Tomas Jelinek 2016-08-02 11:11:43 UTC
<rsc_location id="location-haproxy-ips" resource-discovery="exclusive" rsc-pattern="^(ip-.*)">
<rsc_location id="location-nova-compute-clone" resource-discovery="exclusive" rsc-pattern="nova-compute-(.*)">

It has been kicking around for a while but mostly in the experimental part of the schema. Now it is in upstream master. Still have to document it, but it is
fairly self-explanatory. Expected in rhel 7.4.

Comment 1 Tomas Jelinek 2016-08-02 15:13:21 UTC
"rsc-pattern" is supported since validate-with=pacemaker-2.6

Comment 3 Tomas Jelinek 2017-02-17 16:49 UTC
Created attachment 1254330 [details]
proposed fix

Tests are included in the patch.

Comment 4 Ivan Devat 2017-04-10 15:48:17 UTC
After Fix:

[vm-rhel72-1 ~] $ rpm -q pcs
pcs-0.9.157-1.el7.x86_64

Setup:
pcs resource create R ocf:heartbeat:Dummy

1)
[vm-rhel72-1 ~] $ pcs constraint location %R prefers vm-rhel72-1
[vm-rhel72-1 ~] $ pcs cluster cib|grep "rsc_location" -B1 -A1
    <constraints>
      <rsc_location id="location-R-vm-rhel72-1-INFINITY" node="vm-rhel72-1" rsc="R" score="INFINITY"/>
    </constraints>
[vm-rhel72-1 ~] $ pcs constraint remove location-R-vm-rhel72-1-INFINITY

2)
[vm-rhel72-1 ~] $ pcs constraint location resource%R prefers vm-rhel72-1
[vm-rhel72-1 ~] $ pcs cluster cib|grep "rsc_location" -B1 -A1
    <constraints>
      <rsc_location id="location-R-vm-rhel72-1-INFINITY" node="vm-rhel72-1" rsc="R" score="INFINITY"/>
    </constraints>
[vm-rhel72-1 ~] $ pcs constraint remove location-R-vm-rhel72-1-INFINITY

3)
[vm-rhel72-1 ~] $ pcs constraint location regexp%res_[0-9] prefers node1
[vm-rhel72-1 ~] $ pcs cluster cib|grep "rsc_location" -B1 -A1
    <constraints>
      <rsc_location id="location-res_0-9-node1-INFINITY" node="node1" rsc-pattern="res_[0-9]" score="INFINITY"/>
    </constraints>
[vm-rhel72-1 ~] $ pcs constraint remove location-res_0-9-node1-INFINITY

4)
[vm-rhel72-1 ~] $ pcs constraint location "regexp%res_[0-9]" avoids node1
[vm-rhel72-1 ~] $ pcs cluster cib|grep "rsc_location" -B1 -A1
    <constraints>
      <rsc_location id="location-res_0-9-node1--INFINITY" node="node1" rsc-pattern="res_[0-9]" score="-INFINITY"/>
    </constraints>
[vm-rhel72-1 ~] $ pcs constraint remove location-res_0-9-node1--INFINITY

5)
[vm-rhel72-1 ~] $ pcs constraint location add my-id "regexp%res_[0-9]" node1 INFINITY
[vm-rhel72-1 ~] $ pcs cluster cib|grep "rsc_location" -B1 -A1
    <constraints>
      <rsc_location id="my-id" node="node1" rsc-pattern="res_[0-9]" score="INFINITY"/>
    </constraints>
[vm-rhel72-1 ~] $ pcs constraint remove my-id

6)
[vm-rhel72-1 ~] $ pcs constraint location "regexp%res_[0-9]"  rule '#uname' eq node1
[vm-rhel72-1 ~] $ pcs cluster cib|grep "<rsc_location" -B1 -A5
    <constraints>
      <rsc_location id="location-res_0-9" rsc-pattern="res_[0-9]">
        <rule id="location-res_0-9-rule" score="INFINITY">
          <expression attribute="#uname" id="location-res_0-9-rule-expr" operation="eq" value="node1"/>
        </rule>
      </rsc_location>
    </constraints>
[vm-rhel72-1 ~] $ pcs constraint remove location-res_0-9

Comment 10 errata-xmlrpc 2017-08-01 18:22:57 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:1958


Note You need to log in before you can comment on or make changes to this bug.