Bug 2027370

Summary: Resource ocf:pacemaker:Stateful does not comply with the ocf 1.1 standard
Product: Red Hat Enterprise Linux 8 Reporter: Miroslav Lisik <mlisik>
Component: pacemakerAssignee: Ken Gaillot <kgaillot>
Status: CLOSED ERRATA QA Contact: cluster-qe <cluster-qe>
Severity: low Docs Contact:
Priority: high    
Version: 8.5CC: cluster-maint, msmazova, tojeline
Target Milestone: rcKeywords: Triaged
Target Release: 8.6   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: pacemaker-2.1.2-3.el8 Doc Type: No Doc Update
Doc Text:
This will be invisible to end users
Story Points: ---
Clone Of:
: 2032032 (view as bug list) Environment:
Last Closed: 2022-05-10 14:10:03 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: 2032032    

Description Miroslav Lisik 2021-11-29 13:40:02 UTC
Description of problem:
Resource ocf:pacemaker:Stateful does not comply with the ocf 1.1 standard

Version-Release number of selected component (if applicable):
pacemaker-cli-2.1.0-11.el9.x86_64

How reproducible:
always

Steps to Reproduce:

# wget https://raw.githubusercontent.com/ClusterLabs/OCF-spec/master/ra/1.1/ra-api.rng -O ocf1.1.rng

# crm_resource --show-metadata=ocf:pacemaker:Stateful | xmllint --relaxng ocf1.1.rng - > /dev/null
-:2: warning: failed to load external entity "ra-api-1.dtd"
<!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
                                               ^
-:21: element parameter: Relax-NG validity error : Invalid attribute reloadable for element parameter
-:29: element parameter: Relax-NG validity error : Invalid attribute reloadable for element parameter
- fails to validate

# crm_resource --show-metadata=ocf:pacemaker:Stateful | xmllint --xpath //@reloadable -
 reloadable="true"
 reloadable="true"

Actual results:
Resource metadata fails to validate with the rng scheme of the ocf 1.1 standard.

Expected results:
Resource metadata validate with the rng scheme of the ocf 1.1 standard.


Additional info:

Comment 1 Ken Gaillot 2021-11-29 16:37:27 UTC
Thanks for the report! The issue is that the standard's RNG only allows "0" or "1" for boolean parameters, but Stateful sets reloadable to "true".

As an aside, the warning about DOCTYPE is an issue with nearly all existing resource agents. The standard switched from DTD to RNG as of OCF 1.1, but the agents still output a DOCTYPE referencing the DTD. Unfortunately, there is no DOCTYPE syntax for RNG, so we should probably just drop the DOCTYPE (which is optional, and xmllint doesn't complain when it's gone).

This is an issue in RHEL 8 as well, and for ease of tracking, I'm filing this against RHEL 8.6. The fix should get into RHEL 9.0 as well via the rebase bz.

Comment 2 Tomas Jelinek 2021-11-29 16:59:25 UTC
The DOCTYPE is not an issue for pcs.

What we are after is "true" / "false" instead of "1" / "0". Pcs requires OCF 1.1 agents to comply with the RNG and errors out if that is not the case. That simplifies the OCF parser, as we don't need to care about yes/no, true/false, on/off or recovery when non-optional elements / attributes are missing.

(Pcs actually checks OCF 1.0 agents as well and validates both 1.0 and 1.1 against bundled RNG schemas, which are a bit relaxed compared to official standard ones. This allows custom order of elements, attributes "automatic" and "on_target" used by fence agents, etc.)

Comment 4 Ken Gaillot 2021-12-06 17:19:32 UTC
Fixed upstream by commit 70f46912

Comment 8 Markéta Smazová 2022-02-01 17:36:54 UTC
before fix
-----------

see the bug Description (bug2027370#c0)


after fix
----------

[root@virt-556 ~]# rpm -q pacemaker
pacemaker-2.1.2-3.el8.x86_64
[root@virt-557 ~]# rpm -q pacemaker-cli
pacemaker-cli-2.1.2-3.el8.x86_64

[root@virt-557 ~]# curl -s https://raw.githubusercontent.com/ClusterLabs/OCF-spec/main/ra/1.1/ra-api.rng -o ocf1.1.rng

[root@virt-557 ~]# crm_resource --show-metadata=ocf:pacemaker:Stateful | xmllint --noout --relaxng ocf1.1.rng -
- validates

marking verified in pacemaker-2.1.2-3.el8

Comment 10 errata-xmlrpc 2022-05-10 14:10:03 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 (pacemaker bug fix and enhancement update), 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-2022:1885