Bug 1712347

Summary: pcs cluster verify suggests -V which is not working
Product: Red Hat Enterprise Linux 8 Reporter: Michele Baldessari <michele>
Component: pcsAssignee: Miroslav Lisik <mlisik>
Status: CLOSED CURRENTRELEASE QA Contact: cluster-qe <cluster-qe>
Severity: low Docs Contact:
Priority: medium    
Version: 8.0CC: cfeist, cluster-maint, idevat, lmiksik, nhostako, omular, tojeline
Target Milestone: rcKeywords: EasyFix
Target Release: 8.0Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: pcs-0.10.3-1.el8 Doc Type: Bug Fix
Doc Text:
Cause: Command 'pcs cluster verify' suggest -V option for more details in case when cib is not valid. Consequence: The user is confused because -V option is not recognized by pcs. Fix: Suggest --full option instead of -V option in case of invalid cib file for more details. Result: Option --full provides more details about invalid cib file.
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-05-15 09:22: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 Michele Baldessari 2019-05-21 11:32:39 UTC
Description of problem:
On an invalid CIB we get this:

[root@controller-0 ~]# pcs cluster verify  -f cib.xml    
Error: invalid cib:                                      
Warnings found during check: config may not be valid     
  Use -V -V for more details                             

But then adding '-V' anywhere on the command line does not work.

Maybe we should mask the output of '/usr/sbin/crm_verify --xml-file /tmp/foo' which is what is producing -V -V?

Version-Release number of selected component (if applicable):
pcs-0.10.1-4.el8.x86_64

Comment 1 Tomas Jelinek 2019-05-24 14:24:09 UTC
The "-V" option of the "pcs cluster verify" has been replaced with the "--full" option in pcs in RHEL 8.0. Pcs should replace "-V" in crm_verify output with "--full".

Also, check how many "-V" should be provided to crm_verify as it seems from the message that the more "-V"s the more details are provided. Replace "-V"s in the message with one "--full" and make sure enough "-V"s are specified when pcs runs crm_verify.

Comment 7 Miroslav Lisik 2019-10-16 10:57:55 UTC
Created attachment 1626427 [details]
proposed fix

Test:
1. Get valid cib xml file.
2. Do some modifications which made cib file invalid.
3. Run `pcs cluster verify -f <your_cib_file>`.
4. pcs should suggest --full option instead of -V option.

Comment 8 Miroslav Lisik 2019-10-29 13:43:37 UTC
After fix:

[root@r81-node-01 ~]# rpm -q pcs
pcs-0.10.3-1.el8.x86_64

Configuration: A running cluster with fencing (fence_xvm).

> 1) Warning

[root@r81-node-01 ~]# rc=0
[root@r81-node-01 ~]# while [ $rc = 0 ]; do pcs cluster verify; rc=$?; pcs cluster cib > cib.xml; sleep 1; done

> On the other node do:

[root@r81-node-02 ~]# reboot -f
Rebooting.

> Results from r81-node-01:

[root@r81-node-01 ~]# while [ $rc = 0 ]; do pcs cluster verify; rc=$?; pcs cluster cib > cib.xml; sleep 1; done
Error: invalid cib:
Warnings found during check: config may not be valid


Use --full for more details.

> With --full option:

[root@r81-node-01 ~]# while [ $rc = 0 ]; do pcs cluster verify --full; rc=$?; pcs cluster cib > cib.xml; sleep 1; done
Error: invalid cib:
(pe_fence_node)         warning: Cluster node r81-node-02 will be fenced: peer is no longer part of the cluster
(determine_online_status)       warning: Node r81-node-02 is unclean
(custom_action)         warning: Action fence-r81-node-02_stop_0 on r81-node-02 is unrunnable (offline)
(custom_action)         warning: Action d-02_stop_0 on r81-node-02 is unrunnable (offline)
(stage6)        warning: Scheduling Node r81-node-02 for STONITH
Warnings found during check: config may not be valid


> 2) Error

> Configure a resource:

[root@r81-node-01 ~]# pcs resource
 d-01   (ocf::pacemaker:Dummy): Started r81-node-01

> Save a cib

[root@r81-node-01 ~]# pcs cluster cib > cib.xml

> Duplicate <privmitive> element in cib

[root@r81-node-01 ~]# vim cib.xml 

> Run "cluster verify" commands:

[root@r81-node-01 ~]# pcs cluster verify -f cib.xml 
Error: invalid cib:
/tmp/tmp0656hwj7.pcs:52: element primitive: Relax-NG validity error : ID d-01 redefined
/tmp/tmp0656hwj7.pcs:52: element primitive: Relax-NG validity error : Invalid sequence in interleave
/tmp/tmp0656hwj7.pcs:52: element primitive: Relax-NG validity error : Element primitive failed to validate content
/tmp/tmp0656hwj7.pcs:22: element primitive: Relax-NG validity error : Element resources has extra content: primitive
Errors found during check: config not valid


Use --full for more details.
[root@r81-node-01 ~]# echo $?
1

[root@r81-node-01 ~]# pcs cluster verify -f cib.xml --full
Error: invalid cib:
/tmp/tmpqtuqkrnw.pcs:52: element primitive: Relax-NG validity error : ID d-01 redefined
/tmp/tmpqtuqkrnw.pcs:52: element primitive: Relax-NG validity error : Invalid sequence in interleave
/tmp/tmpqtuqkrnw.pcs:52: element primitive: Relax-NG validity error : Element primitive failed to validate content
/tmp/tmpqtuqkrnw.pcs:22: element primitive: Relax-NG validity error : Element resources has extra content: primitive
(main)  error: CIB did not pass schema validation
Errors found during check: config not valid

[root@r81-node-01 ~]# echo $?
1