Bug 2050259

Summary: Pacemaker does not convert & to & when generating metadata for non-ocf agents
Product: Red Hat Enterprise Linux 9 Reporter: Tomas Jelinek <tojeline>
Component: pacemakerAssignee: Chris Lumens <clumens>
Status: CLOSED ERRATA QA Contact: cluster-qe <cluster-qe>
Severity: low Docs Contact:
Priority: medium    
Version: 9.0CC: cluster-maint, kgaillot, msmazova
Target Milestone: rcKeywords: Triaged
Target Release: 9.1Flags: pm-rhel: mirror+
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: pacemaker-2.1.3-1.el9 Doc Type: Bug Fix
Doc Text:
Cause: Pacemaker used systemd unit descriptions literally in meta-data for systemd resources. Consequence: Descriptions with special characters (such as an amperand) would fail to produce valid meta-data XML. Fix: Pacemaker now escapes characters properly in systemd resource meta-data. Result: Systemd resource meta-data is valid XML even when the systemd unit description contains special characters.
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-11-15 09:49:38 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:

Description Tomas Jelinek 2022-02-03 15:04:31 UTC
Description of problem:
Pacemaker does not convert & to &amp; when generating metadata for non-ocf agents. Not sure if other characters which need to be converted to XML entities are converted properly. This makes the agent metadata not valid.


Version-Release number of selected component (if applicable):
pacemaker-2.1.2-4.el9.x86_64


How reproducible:
always, easily


Steps to Reproduce:
1. curl -s https://raw.githubusercontent.com/ClusterLabs/OCF-spec/main/ra/1.1/ra-api.rng -o ocf1.1.rng
2. crm_resource --show-metadata=systemd:systemd-timedated | xmllint --noout --relaxng ocf1.1.rng -


Actual results:
-:6: parser error : xmlParseEntityRef: no name
    Time & Date Service
          ^

Expected results:
no errors

Comment 1 Chris Lumens 2022-02-11 19:05:52 UTC
Does this require a specific OS version to reproduce?  Locally, testing on RHEL 8, I'm not even getting the full description that would contain the ampersand.  Instead I'm seeing this:

(systemd_unit_metadata)         info: XXX: desc = systemd-timedated.service
(services_action_sync)  trace:  > systemd-timedated_meta-data_0: systemd-dbus = 0
(services_action_sync)  trace:  >  stdout: <?xml version="1.0"?>
<!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
<resource-agent name="systemd-timedated" version="0.1">
  <version>1.1</version>
  <longdesc lang="en">
    systemd-timedated.service
  </longdesc>
  <shortdesc lang="en">systemd unit file for systemd-timedated</shortdesc>
  <parameters/>
  <actions>
    <action name="start"     timeout="100" />
    <action name="stop"      timeout="100" />
    <action name="status"    timeout="100" />
    <acti...

In other words, the description of the service is just systemd-timedated.service.

Regardless, this looks pretty easy to fix blindly.  I'd just love to be able to reproduce it first.

Comment 2 Tomas Jelinek 2022-02-14 08:57:34 UTC
(In reply to Chris Lumens from comment #1)
> Does this require a specific OS version to reproduce?  Locally, testing on RHEL 8, I'm not even getting the full description that would contain the ampersand.

This may be specific to RHEL 9. I'm getting this:

# rpm -q systemd
systemd-249-9.el9.x86_64

# crm_resource --show-metadata=systemd:systemd-timedated
<?xml version="1.0"?>
<!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
<resource-agent name="systemd-timedated" version="0.1">
  <version>1.1</version>
  <longdesc lang="en">
    Time & Date Service
  </longdesc>
  <shortdesc lang="en">systemd unit file for systemd-timedated</shortdesc>
  <parameters/>
  <actions>
    <action name="start"     timeout="100" />
    <action name="stop"      timeout="100" />
    <action name="status"    timeout="100" />
    <action name="monitor"   timeout="100" interval="60"/>
    <action name="meta-data" timeout="5"   />
  </actions>
  <special tag="systemd"/>
</resource-agent>

Sorry for not providing this info in the initial comment.

Comment 3 Ken Gaillot 2022-02-15 20:59:58 UTC
Fixed upstream by commit 13d00a74

Comment 9 Markéta Smazová 2022-06-16 15:33:29 UTC
[root@virt-527 ~]# rpm -q pacemaker
pacemaker-2.1.3-2.el9.x86_64

[root@virt-527 ~]# crm_resource --show-metadata=systemd:systemd-timedated
<?xml version="1.0"?>
<!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
<resource-agent name="systemd-timedated" version="0.1">
  <version>1.1</version>
  <longdesc lang="en">
    Time &amp; Date Service
  </longdesc>
  <shortdesc lang="en">systemd unit file for systemd-timedated</shortdesc>
  <parameters/>
  <actions>
    <action name="start"     timeout="100" />
    <action name="stop"      timeout="100" />
    <action name="status"    timeout="100" />
    <action name="monitor"   timeout="100" interval="60"/>
    <action name="meta-data" timeout="5"   />
  </actions>
  <special tag="systemd"/>
</resource-agent>

[root@virt-527 ~]# pcs resource describe systemd:systemd-timedated
systemd:systemd-timedated - systemd unit file for systemd-timedated

Time & Date Service

Default operations:
  start: interval=0s timeout=100
  stop: interval=0s timeout=100
  monitor: interval=60 timeout=100


verified in pacemaker-2.1.3-2.el9

Comment 11 errata-xmlrpc 2022-11-15 09:49:38 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:7937