Bug 1885302

Summary: reflect changes in crm_mon --as-xml
Product: Red Hat Enterprise Linux 8 Reporter: Tomas Jelinek <tojeline>
Component: pcsAssignee: Tomas Jelinek <tojeline>
Status: CLOSED ERRATA QA Contact: cluster-qe <cluster-qe>
Severity: high Docs Contact: Steven J. Levine <slevine>
Priority: high    
Version: 8.3CC: cfeist, cluster-maint, idevat, lmiksik, mlisik, mmazoure, mpospisi, nhostako, omular, slevine, tojeline
Target Milestone: rcKeywords: Triaged
Target Release: 8.5   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: pcs-0.10.8-2.el8 Doc Type: No Doc Update
Doc Text:
This is an internal change which should not be visible to users.
Story Points: ---
Clone Of:
: 1985981 (view as bug list) Environment:
Last Closed: 2021-11-09 17:33: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:
Bug Depends On:    
Bug Blocks: 1985981, 1999022    
Attachments:
Description Flags
proposed fix + tests none

Description Tomas Jelinek 2020-10-05 14:48:32 UTC
From upstream info: https://wiki.clusterlabs.org/wiki/Pacemaker_2.1_Changes

The deprecated crm_mon --as-html, --as-xml, --web-cgi, and --disable-ncurses options might print a deprecation warning when used (and showing the currently supported equivalents). crm_mon.rng, the XML schema corresponding to --as-xml, would also be deprecated.


We need to check if pcs works with the deprecation warning in place or move to the new xml output right away.

Comment 8 Tomas Jelinek 2021-03-04 15:00:09 UTC
Error reporting has changed:

old version:
# crm_mon --as-xml
Not connected
crm_mon: Error: cluster is not available on this node
<crm_mon version="2.0.5"/>
# echo $?
102

new version:
# crm_mon --output-as=xml
<pacemaker-result api-version="2.3" request="crm_mon --output-as=xml">
  <status code="102" message="Not connected">
    <errors>
      <error>crm_mon: Error: cluster is not available on this node</error>
    </errors>
  </status>
</pacemaker-result>
# echo $?
102

In the new version, an xml must be parsed to obtain an error message.

Comment 9 Tomas Jelinek 2021-05-11 14:29:15 UTC
Created attachment 1782051 [details]
proposed fix + tests

Adapt pcs to the new crm_mon XML format. No change should be visible to the users except minor error message changes.

Comment 10 Tomas Jelinek 2021-05-11 14:31:41 UTC
We still need to take a look at the 'pcs status xml' command to see and deal with any impact caused by switching to the new format.

Comment 13 Miroslav Lisik 2021-06-14 14:09:43 UTC
Test:

[root@r8-node-01 ~]# rpm -q pcs
pcs-0.10.8-2.el8.x86_64

This is an internal change and there should be no visible changes. Some
commands with --wait option uses this output for checking cluster state.

[root@r8-node-01 ~]# pcs cluster start --wait --debug | grep 'Running' | grep 'crm_mon'
Running: /usr/sbin/crm_mon --help-all
Running: /usr/sbin/crm_mon --one-shot --inactive --output-as xml

Comment 17 Michal Mazourek 2021-07-02 12:33:57 UTC
BEFORE:
=======

[root@virt-514 ~]# rpm -q pcs
pcs-0.10.8-1.el8.x86_64


[root@virt-514 ~]# pcs cluster start --wait --debug | grep 'crm_mon'
Running: /usr/sbin/crm_mon --one-shot --as-xml --inactive
Finished running: /usr/sbin/crm_mon --one-shot --as-xml --inactive
<crm_mon version="2.0.5">
</crm_mon>
Running: /usr/sbin/crm_mon --one-shot --as-xml --inactive
Finished running: /usr/sbin/crm_mon --one-shot --as-xml --inactive
<crm_mon version="2.0.5">
</crm_mon>
{...}

> pcs using crm_mon --as-xml format


AFTER:
======

[root@virt-042 ~]# rpm -q pcs
pcs-0.10.8-2.el8.x86_64


## Checking, that the internal change is present and the command functionality preserved

[root@virt-042 ~]# pcs cluster start --wait --debug | grep 'Running' | grep 'crm_mon'
Running: /usr/sbin/crm_mon --help-all
Running: /usr/sbin/crm_mon --one-shot --inactive --output-as xml
Running: /usr/sbin/crm_mon --help-all
Running: /usr/sbin/crm_mon --one-shot --inactive --output-as xml
Running: /usr/sbin/crm_mon --help-all
{...}
[root@virt-042 ~]# echo $?
0

[root@virt-049 ~]# pcs resource enable res --wait --debug | grep "Running" | grep "crm_mon"
Running: /usr/sbin/crm_mon --help-all
Running: /usr/sbin/crm_mon --one-shot --inactive --output-as xml
Running: /usr/sbin/crm_mon --help-all
Running: /usr/sbin/crm_mon --one-shot --inactive --output-as xml
[root@virt-049 ~]# echo $?
0

> pcs using new format crm_mon --output-as xml and the functionality of the command preserved
> tested with various pcs commands that using --wait flag (cluster start, resource enable/disable/safe-disable/move/ban/group add, stonith enable/disable)


## Checking error output

[root@virt-042 ~]# pcs cluster destroy
Shutting down pacemaker/corosync services...
Killing any remaining services...
Removing all cluster configuration files...

[root@virt-042 ~]# pcs cluster start --wait --debug 
Error: cluster is not currently configured on this node
[root@virt-042 ~]# echo $?
1

> OK

## on other node

[root@virt-049 ~]# pcs cluster stop
Stopping Cluster (pacemaker)...
Stopping Cluster (corosync)...

[root@virt-049 ~]# pcs cluster start --wait=1 --debug | grep 'crm_mon'
Running: /usr/sbin/crm_mon --help-all
Finished running: /usr/sbin/crm_mon --help-all
  crm_mon [OPTION?]
If this program is called as crm_mon.cgi, --output-as=html --html-cgi will
When run interactively, crm_mon can be told to hide and display various sections
	crm_mon
	crm_mon -1
	crm_mon --group-by-node --inactive
Start crm_mon as a background daemon and have it write the cluster status to an HTML file:
	crm_mon --daemonize --output-as html --output-to /path/to/docroot/filename.html
Start crm_mon and export the current cluster status as XML to stdout, then exit:
	crm_mon --output-as xml
Running: /usr/sbin/crm_mon --one-shot --inactive --output-as xml
Finished running: /usr/sbin/crm_mon --one-shot --inactive --output-as xml
<pacemaker-result api-version="2.9" request="/usr/sbin/crm_mon --one-shot --inactive --output-as xml">
Error: Waiting timeout

> OK, the error messages preserved


Marking as VERIFIED SanityOnly for pcs-0.10.8-2.el8

Comment 19 errata-xmlrpc 2021-11-09 17:33: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 (Low: pcs security, 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/RHSA-2021:4142