RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1500012 - provide a hint about the "set" option for cmds containing multiple "then" keywords in their constraint definitions
Summary: provide a hint about the "set" option for cmds containing multiple "then" key...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: pcs
Version: 7.4
Hardware: x86_64
OS: Linux
medium
low
Target Milestone: rc
: ---
Assignee: Tomas Jelinek
QA Contact: cluster-qe@redhat.com
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-10-09 16:00 UTC by Corey Marthaler
Modified: 2020-03-31 19:10 UTC (History)
8 users (show)

Fixed In Version: pcs-0.9.168-3.el7
Doc Type: Bug Fix
Doc Text:
Cause: The user specifies multiple resources in the 'pcs constraint colocation add' or 'pcs constraint order' commands. Consequence: A constraint for the first two resources is created, the other resources are silently ignored, no error is reported. Fix: Improve command line parsing and validation in the commands. Result: The user is informed that exactly two resources may be specified in the commands. They are advised to use set constraints instead to set constraints for multiple resources.
Clone Of:
: 1734361 (view as bug list)
Environment:
Last Closed: 2020-03-31 19:09:37 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
proposed fix + tests (21.58 KB, patch)
2019-08-01 09:05 UTC, Tomas Jelinek
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2020:0996 0 None None None 2020-03-31 19:10:00 UTC

Description Corey Marthaler 2017-10-09 16:00:29 UTC
Description of problem:
After further manual reading, I learned when defining order constraints for multiple resources at once, you need to use the "set" command. However, until I learned that, pcs was fine letting me think I had done everything correctly with multiple "then"'s in my cmd.

 
[root@host-081 ~]# pcs resource show
 Clone Set: dlm_for_lvmlockd-clone [dlm_for_lvmlockd]
     Started: [ host-081 host-094 host-095 ]
 Clone Set: lvmlockd-clone [lvmlockd]
     Started: [ host-081 host-094 host-095 ]
 Clone Set: QA-lvmlockd-activation-clone [QA-lvmlockd-activation]
     Started: [ host-081 host-094 host-095 ]

[root@host-081 ~]# pcs constraint order start dlm_for_lvmlockd-clone then start lvmlockd-clone then start QA-lvmlockd-activation-clone Serialize
Adding dlm_for_lvmlockd-clone lvmlockd-clone (kind: Mandatory) (Options: first-action=start then-action=start)

[root@host-081 ~]# pcs constraint show --full
Location Constraints:
Ordering Constraints:
  start dlm_for_lvmlockd-clone then start lvmlockd-clone (kind:Mandatory) (id:order-dlm_for_lvmlockd-clone-lvmlockd-clone-mandatory)
Colocation Constraints:
Ticket Constraints:

[root@host-081 ~]# pcs constraint  remove order-dlm_for_lvmlockd-clone-lvmlockd-clone-mandatory
[root@host-081 ~]# pcs constraint show --full
Location Constraints:
Ordering Constraints:
Colocation Constraints:
Ticket Constraints:

# This cmd resulted in the exact same thing as above since the final "then" is just getting dropped
[root@host-081 ~]# pcs constraint order start dlm_for_lvmlockd-clone then start lvmlockd-clone Serialize
Adding dlm_for_lvmlockd-clone lvmlockd-clone (kind: Mandatory) (Options: first-action=start then-action=start)
[root@host-081 ~]# pcs constraint show --full
Location Constraints:
Ordering Constraints:
  start dlm_for_lvmlockd-clone then start lvmlockd-clone (kind:Mandatory) (id:order-dlm_for_lvmlockd-clone-lvmlockd-clone-mandatory)
Colocation Constraints:
Ticket Constraints:

[root@host-081 ~]# pcs constraint  remove order-dlm_for_lvmlockd-clone-lvmlockd-clone-mandatory

# This should fail:
[root@host-081 ~]# pcs constraint order start dlm_for_lvmlockd-clone then start nonexistentresource-clone Serialize
Error: Resource 'nonexistentresource-clone' does not exist

# As should this I would think:
[root@host-081 ~]# pcs constraint order start dlm_for_lvmlockd-clone then start lvmlockd-clone then start nonexistentresource-clone Serialize
Adding dlm_for_lvmlockd-clone lvmlockd-clone (kind: Mandatory) (Options: first-action=start then-action=start)
[root@host-081 ~]# echo $?
0


# After further reading, I found that the "set" option is what I was looking for.
order set <resource1> [resourceN]

[root@host-081 ~]# pcs constraint order set dlm_for_lvmlockd-clone lvmlockd-clone nonexistentresource-clone
Error: resource 'nonexistentresource-clone' does not exist

[root@host-081 ~]# pcs constraint order set dlm_for_lvmlockd-clone lvmlockd-clone QA-lvmlockd-activation-clone sequential=true
[root@host-081 ~]# pcs constraint show --full
Location Constraints:
Ordering Constraints:
  Resource Sets:
    set dlm_for_lvmlockd-clone lvmlockd-clone QA-lvmlockd-activation-clone sequential=true (id:pcs_rsc_set_dlm_for_lvmlockd-clone_lvmlockd-clone_QA-lvmlockd-activation-clone) (id:pcs_rsc_order_set_dlm_for_lvmlockd-clone_lvmlockd-clone_QA-lvmlockd-activation-clone)
Colocation Constraints:
Ticket Constraints:


Version-Release number of selected component (if applicable):
pcs-0.9.158-6.el7.x86_64

Comment 3 Tomas Jelinek 2017-10-10 07:37:35 UTC
Order constraints cmdline parsing needs to be fixed to only accept a pair of resources. If more than two resources are specified, pcs should exit with an error. The error should, apart from telling the syntax is not valid, hint that a set constraint may be used instead.

The same should be done for colocation constraints.

Comment 5 Tomas Jelinek 2019-08-01 09:05:51 UTC
Created attachment 1596887 [details]
proposed fix + tests

In order to fix the reported issue properly a few more fixes had to be implemented:
* 'pcs constraint colocation add': report an error when multiple "with"s are specified, provide a hint that 'pcs constraint colocation set' should be used instead
* 'pcs constraint colocation add': report an error when specified resource roles are not valid
* 'pcs constraint colocation add': missing 'name' or '=value' in name=value options is reported as an error
* 'pcs constraint order': report an error when multiple "then"s are used, provide a hint that 'pcs constraint order set' should be used instead
* 'pcs constraint order': missing 'name' or '=value' in name=value options is reported as an error

Comment 6 Ivan Devat 2019-08-05 11:10:04 UTC
After Fix:

[kid76 ~] $ rpm -q pcs
pcs-0.9.168-1.el7.x86_64

[kid76 ~] $ pcs resource
 A      (ocf::heartbeat:Dummy): Started kid76
 B      (ocf::heartbeat:Dummy): Started lion76
 C      (ocf::heartbeat:Dummy): Started mule76

[kid76 ~] $ pcs constraint colocation add A with B with C

Usage: pcs constraint [constraints]...
    colocation add [master|slave] <source resource id> with [master|slave]
                   <target resource id> [score] [options] [id=constraint-id]
        Request <source resource> to run on the same node where pacemaker has
        determined <target resource> should run.  Positive values of score
        mean the resources should be run on the same node, negative values
        mean the resources should not be run on the same node.  Specifying
        'INFINITY' (or '-INFINITY') for the score forces <source resource> to
        run (or not run) with <target resource> (score defaults to "INFINITY").
        A role can be master or slave (if no role is specified, it defaults to
        'started').

Error: Multiple 'with's cannot be specified.
Hint: Use the 'pcs constraint colocation set' command if you want to create a constraint for more than two resources.


[kid76 ~] $ pcs constraint colocation add aster A with B
Error: invalid role value 'aster', allowed values are: 'Master', 'Slave', 'Started', 'Stopped'

[kid76 ~] $ pcs constraint colocation add A with B a=b name
Error: missing value of 'name' option

[kid76 ~] $ pcs constraint colocation add A with B "=value"
Error: missing key in '=value' option

[kid76 ~] $ pcs constraint order A then B then C

Usage: pcs constraint [constraints]...
    order [show] [--full]
        List all current ordering constraints (if --full is specified show
        the internal constraint id's as well).

    order [action] <resource id> then [action] <resource id> [options]
        Add an ordering constraint specifying actions (start, stop, promote,
        demote) and if no action is specified the default action will be
        start.
        Available options are kind=Optional/Mandatory/Serialize,
        symmetrical=true/false, require-all=true/false and id=<constraint-id>.

    order set <resource1> [resourceN]... [options] [set
              <resourceX> ... [options]]
              [setoptions [constraint_options]]
        Create an ordered set of resources.
        Available options are sequential=true/false, require-all=true/false and
        action=start/promote/demote/stop. Available constraint_options are
        id=<constraint-id>, kind=Optional/Mandatory/Serialize and
        symmetrical=true/false.

    order remove <resource1> [resourceN]...
        Remove resource from any ordering constraint

Error: Multiple 'then's cannot be specified.
Hint: Use the 'pcs constraint order set' command if you want to create a constraint for more than two resources.

[kid76 ~] $ pcs constraint order A then B "=value"
Error: missing key in '=value' option

[kid76 ~] $ pcs constraint order A then B a=b name
Error: missing value of 'name' option

Comment 15 Ivan Devat 2019-11-05 08:08:37 UTC
After Fix

[kid76 ~] $ rpm -q pcs
pcs-0.9.168-3.el7.x86_64

[kid76 ~] $ pcs constraint order A then B a=b name=
Error: value of 'name' option is empty

Comment 19 errata-xmlrpc 2020-03-31 19:09:37 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-2020:0996


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