Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 1362493 - pcs does not support rsc-pattern in location constraints
pcs does not support rsc-pattern in location constraints
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: pcs (Show other bugs)
7.3
Unspecified Unspecified
high Severity unspecified
: rc
: ---
Assigned To: Tomas Jelinek
cluster-qe@redhat.com
Steven J. Levine
: FutureFeature
Depends On:
Blocks: 1424387
  Show dependency treegraph
 
Reported: 2016-08-02 07:11 EDT by Tomas Jelinek
Modified: 2017-12-03 05:09 EST (History)
9 users (show)

See Also:
Fixed In Version: pcs-0.9.157-1.el7
Doc Type: Release Note
Doc Text:
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.
Story Points: ---
Clone Of:
: 1424387 (view as bug list)
Environment:
Last Closed: 2017-08-01 14:22:57 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
proposed fix (71.57 KB, patch)
2017-02-17 11:49 EST, 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 14:09:47 EDT

  None (edit)
Description Tomas Jelinek 2016-08-02 07:11:43 EDT
<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 11:13:21 EDT
"rsc-pattern" is supported since validate-with=pacemaker-2.6
Comment 3 Tomas Jelinek 2017-02-17 11:49 EST
Created attachment 1254330 [details]
proposed fix

Tests are included in the patch.
Comment 4 Ivan Devat 2017-04-10 11:48:17 EDT
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 14:22:57 EDT
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.