Bug 1501924

Summary: crm_mon -X output does not conform to the schema due to recent changes in bundles
Product: Red Hat Enterprise Linux 7 Reporter: Tomas Jelinek <tojeline>
Component: pacemakerAssignee: Ken Gaillot <kgaillot>
Status: CLOSED ERRATA QA Contact: cluster-qe <cluster-qe>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 7.5CC: abeekhof, cluster-maint, mnovacek
Target Milestone: rcKeywords: Regression
Target Release: 7.5   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: pacemaker-1.1.18-2.el7 Doc Type: No Doc Update
Doc Text:
The version with this issue was never released
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-04-10 15:32:51 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 2017-10-13 13:27:44 UTC
Description of problem:
crm_mon -X output does not conform to the schema due to recent changes in bundles. More specifically, allowed values for the type attribute of a bundle element are "docker" and "rkt", while the actual value is "Docker".


Version-Release number of selected component (if applicable):
pacemaker-1.1.18-1.el7.x86_64


How reproducible:
always, easily


Steps to Reproduce:
1. Configure a bundle resource using docker container
# pcs resource show httpd-bundle
 Bundle: httpd-bundle
  Docker: image=pcmktest:http options=--log-driver=journald replicas=3
  Network: host-netmask=24 ip-range-start=192.168.122.145
  Port Mapping:
   port=80 (httpd-port)
  Storage Mapping:
   options=rw source-dir-root=/root/docker/httpd-root target-dir=/var/www/html (httpd-root)
   options=rw source-dir-root=/root/docker/httpd-logs target-dir=/etc/httpd/logs (httpd-logs)
  Resource: apa (class=ocf provider=heartbeat type=apache)
   Operations: monitor interval=10 timeout=20s (apa-monitor-interval-10)
               start interval=0s timeout=40s (apa-start-interval-0s)
               stop interval=0s timeout=60s (apa-stop-interval-0s)

2. Get the status xml and validate it:
# crm_mon -X > state.xml
# jing /usr/share/pacemaker/crm_mon.rng state.xml
state.xml:29:117: error: value of attribute "type" is invalid; must be equal to "docker" or "rkt"
# awk 'NR==29 {print}' state.xml 
        <bundle id="httpd-bundle" type="Docker" image="pcmktest:http" unique="false" managed="true" failed="false" >


Actual results:
The status xml does not conform to the schema.


Expected results:
The status xml conforms to the schema.


Additional info:
This causes issues when pcs works with cluster status xml, for example:
# pcs resource enable dummy
Warning: xml with cluster status does not conform to the crm_mon schema

Comment 2 Ken Gaillot 2017-10-13 14:57:41 UTC
Thanks again for the catch. In this case, the schema is correct, but the value changed when rkt support was added, because we were focused on maintaining the text output ("Docker container"). I'll lowercase the value for XML, to maintain backward compatibility with the last release.

Comment 5 michal novacek 2017-12-11 10:32:18 UTC
I have verified that the output of 'crm_mon -X' is valid against the
/usr/shared/pacemaker/crm_mon.rng schema in pacemaker-1.1.18-6.el7.x86.

-----
Common part:

>virt-153# pcs resource show 
 Docker container: http-bundle [httpd]
   http-bundle-docker-0 (ocf::heartbeat:docker):        Started virt-153


Before the fix (pacemaker-1.1.18-1)
===================================

>virt-153# crm_mon -X >/tmp/crm_mon.xml

>virt-153# grep \<bundle /tmp/crm_mon.xml
        <bundle id="http-bundle" type="Docker" image="httpd" unique="false" managed="true" failed="false" >

>virt-153# jing /usr/share/pacemaker/crm_mon.rng /tmp/crm_mon.xml 
/tmp/crm_mon.xml:27:108: error: value of attribute "type" is invalid; must be equal to "docker" or "rkt"

>virt-153# echo $?
1



After the fix (pacemaker-1.1.18-6)
==================================

>virt-153# rmp -q pacemaker
pacemaker-1.1.18-6.el7.x86_64

>virt-153# crm_mon -X >/tmp/crm_mon.xml

>virt-153# grep \<bundle /tmp/crm_mon.xml
        <bundle id="http-bundle" type="docker" image="httpd" unique="false" managed="true" failed="false" >

>virt-153# jing /usr/share/pacemaker/crm_mon.rng /tmp/crm_mon.xml
>virt-153# echo $?
0

Comment 8 errata-xmlrpc 2018-04-10 15:32:51 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/RHEA-2018:0860