Bug 1110166
| Summary: | [RFE] allow user to specify constraint id on its creation | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | michal novacek <mnovacek> | ||||
| Component: | pcs | Assignee: | Tomas Jelinek <tojeline> | ||||
| Status: | CLOSED ERRATA | QA Contact: | Cluster QE <mspqa-list> | ||||
| Severity: | medium | Docs Contact: | |||||
| Priority: | medium | ||||||
| Version: | 7.0 | CC: | cfeist, cluster-maint, rsteiger, slevine, tojeline | ||||
| Target Milestone: | rc | Keywords: | FutureFeature | ||||
| Target Release: | --- | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | pcs-0.9.132-1.el7 | Doc Type: | Enhancement | ||||
| Doc Text: |
Feature:
Allow user to specify constraint id when creating a constraint.
Reason:
When user uses some automated tool to work with constraints it is easier to specify a constraint id instead of detecting what id has been automatically created by pcs.
Result:
User is able to set constraint id when creating a constraint.
|
Story Points: | --- | ||||
| Clone Of: | |||||||
| : | 1129857 (view as bug list) | Environment: | |||||
| Last Closed: | 2015-03-05 09:19:57 UTC | Type: | Bug | ||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Embargoed: | |||||||
| Bug Depends On: | |||||||
| Bug Blocks: | 1129857 | ||||||
| Attachments: |
|
||||||
Created attachment 943699 [details]
proposed fix
Before Fix:
[root@rh70-node1 ~]# rpm -q pcs
pcs-0.9.115-32.el7.x86_64
[root@rh70-node1:~]# pcs constraint location dummy1 rule constraint-id=con1 defined pingd
Error: Unable to update cib
Call cib_replace failed (-203): Update does not conform to the configured schema
<cib admin_epoch="0" cib-last-written="Tue Oct 14 11:11:33 2014" crm_feature_set="3.0.9" epoch="7370" have-quorum="1" num_updates="0" update-client="cibadmin" update-origin="rh70-node1" validate-with="pacemaker-1.2" dc-uuid="2">
{output trimmed}
[root@rh70-node1:~]# man pcs | tr -s ' ' | grep -C1 'order \[action\]'
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 and symmetrical=true/false
[root@rh70-node1:~]# pcs constraint order dummy1 then dummy2 id=con2
Adding dummy1 dummy2 (kind: Mandatory) (Options: id=con2 first-action=start then-action=start)
[root@rh70-node1:~]# pcs constraint order set dummy1 dummy2 setoptions id=con3
Error: Unable to update cib
Call cib_replace failed (-203): Update does not conform to the configured schema
<cib admin_epoch="0" cib-last-written="Tue Oct 14 11:15:11 2014" crm_feature_set="3.0.9" epoch="7371" have-quorum="1" num_updates="0" update-client="cibadmin" update-origin="rh70-node1" validate-with="pacemaker-1.2" dc-uuid="2">
{output trimmed}
[root@rh70-node1:~]# man pcs | tr -s ' ' | grep -C0 'colocation add'
colocation add [master|slave] <source resource id> with [master|slave]
[root@rh70-node1:~]# pcs constraint colocation add dummy1 with dummy2 id=con4
[root@rh70-node1:~]# man pcs | tr -s ' ' | grep -C1 'colocation set'
colocation set <resource1> <resource2> [resourceN]... [setoptions] ...
[set <resourceX> <resourceY> ...] [setoptions <name>=<value>...] Create a colocation constraint with a resource set
[root@rh70-node1:~]# pcs constraint colocation set dummy1 dummy2 setoptions id=con5
[root@rh70-node1:~]# pcs constraint --full
Location Constraints:
Ordering Constraints:
start dummy1 then start dummy2 (Mandatory) (id:con2)
Colocation Constraints:
dummy1 with dummy2 (INFINITY) (id:con4)
Resource Sets:
set dummy1 dummy2 (id:pcs_rsc_set_dummy1_dummy2) setoptions score=INFINITY (id:con5)
After Fix:
[root@rh70-node1:~]# rpm -q pcs
pcs-0.9.132-1.el7.x86_64
[root@rh70-node1:~]# pcs constraint location dummy1 rule constraint-id=con1 defined pingd
[root@rh70-node1:~]# man pcs | tr -s ' ' | grep -C1 'order \[action\]'
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 and id=<constraint-id>.
[root@rh70-node1:~]# pcs constraint order dummy1 then dummy2 id=con2
Adding dummy1 dummy2 (kind: Mandatory) (Options: id=con2 first-action=start then-action=start)
[root@rh70-node1:~]# pcs constraint order set dummy1 dummy2 setoptions id=con3
root@rh70-node1:~]# man pcs | tr -s ' ' | grep -C0 'colocation add'
colocation add [master|slave] <source resource id> with [master|slave] <target resource id> [score] [options] [id=constraint-id]
[root@rh70-node1:~]# pcs constraint colocation add dummy1 with dummy2 id=con4
[root@rh70-node1:~]# man pcs | tr -s ' ' | grep -C1 'colocation set'
colocation set <resource1> <resource2> [resourceN]... [options] [set <resourceX> <resourceY> ... [options]] [setoptions [constraint_options]]
Create a colocation constraint with a resource set. Available options are sequential=true/false, require-all=true/false, action=start/promote/demote/stop and role=Stopped/Started/Master/Slave. Available constraint_options are id, score, score-
[root@rh70-node1:~]# pcs constraint colocation set dummy1 dummy2 setoptions id=con5
[root@rh70-node1:~]# pcs constraint --full
Location Constraints:
Resource: dummy1
Constraint: con1
Rule: score=INFINITY (id:con1-rule)
Expression: defined pingd (id:con1-rule-expr)
Ordering Constraints:
start dummy1 then start dummy2 (kind:Mandatory) (id:con2)
Resource Sets:
set dummy1 dummy2 (id:pcs_rsc_set_dummy1_dummy2) (id:con3)
Colocation Constraints:
dummy1 with dummy2 (score:INFINITY) (id:con4)
Resource Sets:
set dummy1 dummy2 (id:pcs_rsc_set_dummy1_dummy2-1) setoptions score=INFINITY (id:con5)
If this Feature should be included in the 7.1 Release Notes, could you please change the Doc Type from Enhancement to "Release Note"? Note that the Release Notes are intended to list the most prominent and customer-relevant new features rather than every single enhancement. Cheers, Jirka Jiri, I think this feature is not important enough to be included in the Release Notes, users usually do not need to care about ids and the feature was meant mainly to make automated testing easier. For reasons similar to those that Tomas notes, we did not document this feature in the pcs reference manual either, for reasons explained in BZ#1129857. 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://rhn.redhat.com/errata/RHBA-2015-0415.html |
Description of problem: At this moment (pcs-0.9.115-32.el7.x86_64) the automated (script) deletion of constraints in the cluster is quite uncomfortable when you want to delete a specific constraint referencing a resource that has more than one constraint. This gets even more tricky by the fact that we can have the exactly same consrtaints severel times and possible given by two different means: order r1 then r2 VS order set r1 r2. The workflow of our automated script is as follows: 1) create cluster and resources 2) create some constraints 3) verify that everything is correctly running 4) verify that all the constraints are seen in 'pcs cluster cib' and that colocation and location constraints are really fulfilled What we do now is that we list all constraint ids in cluster configuration before and after adding a new constraint to find out its id. Would it be possible to add something like '--id=...' to 'pcs constraint' to give the user ability to specify the id of the constraint being created?