Bug 1031832 - corosync-cfgtool -R (reload of corosync.conf) doesn't return status if the config file is invalid
corosync-cfgtool -R (reload of corosync.conf) doesn't return status if the co...
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: corosync (Show other bugs)
7.0
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Jan Friesse
Cluster QE
:
Depends On:
Blocks: 998883
  Show dependency treegraph
 
Reported: 2013-11-18 17:19 EST by Chris Feist
Modified: 2014-06-17 20:31 EDT (History)
4 users (show)

See Also:
Fixed In Version: corosync-2.3.2-3.el7
Doc Type: Bug Fix
Doc Text:
Cause: corosync-cfgtool -R is unsuccessful. Consequence: Return code ($?) is 0. Fix: Properly set return code if failure happens. Result: Unsuccessful corosync-cfgtool -R returns code != 0.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-06-13 08:10:45 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Proposed patch - return error on reload failure (1.71 KB, patch)
2013-11-19 09:34 EST, Jan Friesse
no flags Details | Diff
Proposed patch take 2 - return error on reload failure (1.77 KB, patch)
2013-11-26 09:43 EST, Jan Friesse
no flags Details | Diff

  None (edit)
Description Chris Feist 2013-11-18 17:19:19 EST
We're using 'corosync-cfgtool -R' inside of pcs to reload the corosync.conf file, but if we try to load a bad corosync.conf 'corosync-cfgtool -R' doesn't let us know.  It looks like the only way we can tell of the reload fails is if we look in the system logs.

Is it possible to have corosync-cfgtool -R provide different output if the reload fails?  If not, then we can just close this bug.
Comment 2 Jan Friesse 2013-11-19 09:21:18 EST
Chris,
I'm was trying this:
- Exec corosync
- edit corosync.conf and put "}" line on first line of config file (this is invalid because there is no preceding start of section)
- corosync-cfgtool -R ->

Reloading corosync.conf...
Could not reload configuration 2

and "echo $?" == 0

The return code is definitively problem and should be fixed. But even without this fix, corosync-cfgtool -R output is parseable so there is really no need to watch logs. Or do I missing something?

In short. Is proper return code (> 0) enough to fix this BZ or something more is needed?
Comment 3 Jan Friesse 2013-11-19 09:34:51 EST
Created attachment 826082 [details]
Proposed patch - return error on reload failure
Comment 4 Jan Friesse 2013-11-26 09:43:25 EST
Created attachment 829309 [details]
Proposed patch take 2 - return error on reload failure
Comment 5 Chris Feist 2013-12-02 19:15:22 EST
Jan,

I was just adding garbage at the beginning of the file, but it looks like corosync ignores that (which is why I didn't see an error message).  I tried adding garbage to the middle of the file and I saw the error message.

A return code > 0 would work perfectly for me (then I don't need to worry if the error message ever changes).

Your patch looks like it does exactly what I need.
Comment 6 Jan Friesse 2013-12-04 05:09:20 EST
(In reply to Chris Feist from comment #5)
> Jan,
> 
> I was just adding garbage at the beginning of the file, but it looks like
> corosync ignores that (which is why I didn't see an error message).  I tried
> adding garbage to the middle of the file and I saw the error message.
> 
> A return code > 0 would work perfectly for me (then I don't need to worry if
> the error message ever changes).
> 
> Your patch looks like it does exactly what I need.

Ok, cool.
Comment 10 Ludek Smid 2014-06-13 08:10:45 EDT
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.

Note You need to log in before you can comment on or make changes to this bug.