Bug 1420437

Summary: cli: automatic CIB upgrade missing for "pcs constraint location add ... resource-discovery=..."
Product: Red Hat Enterprise Linux 7 Reporter: Radek Steiger <rsteiger>
Component: pcsAssignee: Tomas Jelinek <tojeline>
Status: CLOSED ERRATA QA Contact: cluster-qe <cluster-qe>
Severity: unspecified Docs Contact:
Priority: medium    
Version: 7.3CC: cfeist, cluster-maint, idevat, omular, tojeline
Target Milestone: rcKeywords: EasyFix
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: pcs-0.9.160-1.el7 Doc Type: Bug Fix
Doc Text:
Cause: The user specifies a resource-discovery option when creating a location constraint. Consequence: Pcs exits with an error and the constraint is not created. Fix: Automatically upgrade CIB schema version when the resource-discovery option has been used. Result: The location constraint gets created.
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-04-10 15:37:49 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:
Attachments:
Description Flags
proposed fix none

Description Radek Steiger 2017-02-08 16:11:37 UTC
> Description of problem:

When resource-discovery option support has been added to 'constraint location add' and 'constraint location rule', the automatic CIB upgrade to version pacemaker-2.2+ has only been to the rule creation. The former command is missing this step therefore resulting in an invalid CIB.


> Version-Release number of selected component (if applicable):

pcs-0.9.152-10.el7
(upstream also affected)


> How reproducible:

Always


> Steps to Reproduce:
1. have a CIB with validate-with="pacemaker-2.1" or lower
2. pcs resource create MyDummy ocf:heartbeat:Dummy
3. pcs constraint location add MyLoc MyDummy <node> 100 resource-discovery=exclusive


> Actual results:

Error: Unable to update cib
Call cib_replace failed (-203): Update does not conform to the configured schema
...


> Expected results:

Cluster CIB has been upgraded to latest version


> Additional info:

'location rule' code: https://github.com/ClusterLabs/pcs/blob/ba257076bf60ad7a624b645b306711f3525e6b1a/pcs/constraint.py#L729
'location add' code:  https://github.com/ClusterLabs/pcs/blob/ba257076bf60ad7a624b645b306711f3525e6b1a/pcs/constraint.py#L800

Comment 1 Tomas Jelinek 2017-02-09 09:36:51 UTC
We will add CIB upgrade check to that function with respect to rsc-pattern as a part of bz1362493 patch. So we can fix this in the same time.

Comment 3 Tomas Jelinek 2017-09-01 16:05:14 UTC
Created attachment 1321014 [details]
proposed fix

Comment 4 Ivan Devat 2017-10-11 08:12:35 UTC
After Fix:

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

[vm-rhel72-1 ~] $ cat cib-empty.xml
<cib epoch="557" num_updates="122" admin_epoch="0" validate-with="pacemaker-1.2" crm_feature_set="3.0.12" update-origin="rh7-3" update-client="crmd" cib-last-written="Thu Aug 23 16:49:17 2012" have-quorum="0" dc-uuid="2">
  <configuration>
    <crm_config/>
    <nodes>
    </nodes>
    <resources/>
    <constraints/>
  </configuration>
  <status/>
</cib>
[vm-rhel72-1 ~] $ pcs resource create MyDummy ocf:heartbeat:Dummy -f cib-empty.xml
[vm-rhel72-1 ~] $ pcs constraint location add MyLoc MyDummy vm-rhel72-1 100 resource-discovery=exclusive  -f cib-empty.xml
Cluster CIB has been upgraded to latest version
[vm-rhel72-1 ~] $ echo $?
0

Comment 9 errata-xmlrpc 2018-04-10 15:37:49 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-2018:0866