Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 2123727

Summary: XML output of `crm_resource --validate` doesn't conform to XML schema
Product: Red Hat Enterprise Linux 9 Reporter: Ondrej Mular <omular>
Component: pacemakerAssignee: Reid Wahl <nwahl>
Status: CLOSED ERRATA QA Contact: cluster-qe <cluster-qe>
Severity: low Docs Contact:
Priority: high    
Version: 9.1CC: cluster-maint, jrehova, kgaillot, msmazova, nwahl
Target Milestone: rcKeywords: Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: pacemaker-2.1.5-1.el9 Doc Type: Bug Fix
Doc Text:
Cause: XML schemas for validating command output were written in such a way that never allowed for commands that produce an error to be validated. Consequence: XML output produced by `crm_resource --validate` commands that produce an error don't conform to the pacemaker API XML schema. Fix: XML schemas for command output were rearranged to match the expected output. Result: Output conforms to the pacemaker API XML schema.
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-05-09 07:18:17 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: 2112270, 2112271    

Description Ondrej Mular 2022-09-02 12:27:53 UTC
Description of problem:
XML output produced by `crm_resource --validate` commands doesn't conform to pacemaker API XML schema.

Version-Release number of selected component (if applicable):
[root@rhel91-devel1 ~]# rpm -qa pacemaker
pacemaker-2.1.4-5.el9.x86_64

How reproducible:
always

Steps to Reproduce:
[root@rhel91-devel1 ~]# /usr/sbin/crm_resource --output-as xml --validate --class ocf --agent IPaddr2 --provider heartbeat | xmllint --relaxng /usr/share/pacemaker/api/api-result.rng -
<?xml version="1.0"?>
<pacemaker-result api-version="2.22" request="/usr/sbin/crm_resource --output-as xml --validate --class ocf --agent IPaddr2 --provider heartbeat">
  <resource-agent-action action="validate" class="ocf" type="IPaddr2" provider="heartbeat">
    <overrides/>
    <agent-status code="6" message="not configured" execution_code="0" execution_message="complete" reason="IP address (the ip parameter) is mandatory"/>
    <command code="6">
      <output source="stderr">ocf-exit-reason:IP address (the ip parameter) is mandatory
</output>
    </command>
  </resource-agent-action>
  <status code="6" message="Not configured">
    <errors>
      <error>crm_resource: Error performing operation: Not configured</error>
    </errors>
  </status>
</pacemaker-result>
-:1: element pacemaker-result: Relax-NG validity error : Expecting element status, got resource-agent-action
-:1: element pacemaker-result: Relax-NG validity error : Element pacemaker-result failed to validate content
- fails to validate
[root@rhel91-devel1 ~]# echo $?
3

Actual results:
Produced XML doesn't conform to the XML schema

Expected results:
Output conform to the pacemaker API XML schema

Comment 2 Reid Wahl 2022-09-06 23:31:44 UTC
Resolved by upstream commit 16cbddef

Comment 9 jrehova 2022-12-09 18:12:54 UTC
Version of pacemaker:
 
> [root@virt-533 ~]# rpm -q pacemaker
> pacemaker-2.1.5-2.el9.x86_64

Result: Output conform to the pacemaker API XML schema
  
> [root@virt-533 ~]# /usr/sbin/crm_resource --output-as xml --validate --class ocf --agent IPaddr2 --provider heartbeat | xmllint --relaxng /usr/share/pacemaker/api/api-result.rng -
> <?xml version="1.0"?>
> <pacemaker-result api-version="2.25" request="/usr/sbin/crm_resource --output-as xml --validate --class ocf --agent IPaddr2 --provider heartbeat">
>   <resource-agent-action action="validate" class="ocf" type="IPaddr2" provider="heartbeat">
>     <overrides/>
>     <agent-status code="6" message="not configured" execution_code="0" execution_message="complete" reason="IP address (the ip parameter) is mandatory"/>
>     <command code="6">
>       <output source="stderr">ocf-exit-reason:IP address (the ip parameter) is mandatory
> </output>
>     </command>
>   </resource-agent-action>
>   <status code="6" message="Not configured">
>     <errors>
>       <error>crm_resource: Error performing operation: Not configured</error>
>     </errors>
>   </status>
> </pacemaker-result>
> - validates
> [root@virt-533 ~]# echo $?
> 0
  
> [root@virt-533 ~]# /usr/sbin/crm_resource --output-as xml --validate --class ocf --agent apache --provider heartbeat | xmllint --relaxng /usr/share/pacemaker/api/api-result.rng -
> <?xml version="1.0"?>
> <pacemaker-result api-version="2.25" request="/usr/sbin/crm_resource --output-as xml --validate --class ocf --agent apache --provider heartbeat">
>   <resource-agent-action action="validate" class="ocf" type="apache" provider="heartbeat">
>     <overrides/>
>     <agent-status code="5" message="not installed" execution_code="0" execution_message="complete" reason="environment is invalid, resource considered stopped"/>
>     <command code="5">
>       <output source="stderr">ocf-exit-reason:apache httpd program not found
> ocf-exit-reason:environment is invalid, resource considered stopped
> </output>
>     </command>
>   </resource-agent-action>
>   <status code="5" message="Not installed">
>     <errors>
>       <error>crm_resource: Error performing operation: Not installed</error>
>     </errors>
>   </status>
> </pacemaker-result>
> - validates
> [root@virt-533 ~]# echo $?
> 0

> [root@virt-533 ~]# /usr/sbin/crm_resource --output-as xml --validate --class ocf --agent Dummy --provider pacemaker | xmllint --relaxng /usr/share/pacemaker/api/api-result.rng -
> <?xml version="1.0"?>
> <pacemaker-result api-version="2.25" request="/usr/sbin/crm_resource --output-as xml --validate --class ocf --agent Dummy --provider pacemaker">
>   <resource-agent-action action="validate" class="ocf" type="Dummy" provider="pacemaker">
>     <overrides/>
>     <agent-status code="0" message="ok" execution_code="0" execution_message="complete"/>
>   </resource-agent-action>
>   <status code="0" message="OK"/>
> </pacemaker-result>
> - validates
> [root@virt-533 ~]# echo $?
> 0

Comment 11 errata-xmlrpc 2023-05-09 07:18:17 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-2023:2150