Bug 1031832

Summary: corosync-cfgtool -R (reload of corosync.conf) doesn't return status if the config file is invalid
Product: Red Hat Enterprise Linux 7 Reporter: Chris Feist <cfeist>
Component: corosyncAssignee: Jan Friesse <jfriesse>
Status: CLOSED CURRENTRELEASE QA Contact: Cluster QE <mspqa-list>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.0CC: ccaulfie, cfeist, cluster-maint, jkortus
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
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 12:10:45 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: 998883    
Attachments:
Description Flags
Proposed patch - return error on reload failure
none
Proposed patch take 2 - return error on reload failure none

Description Chris Feist 2013-11-18 22:19:19 UTC
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 14:21:18 UTC
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 14:34:51 UTC
Created attachment 826082 [details]
Proposed patch - return error on reload failure

Comment 4 Jan Friesse 2013-11-26 14:43:25 UTC
Created attachment 829309 [details]
Proposed patch take 2 - return error on reload failure

Comment 5 Chris Feist 2013-12-03 00:15:22 UTC
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 10:09:20 UTC
(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 12:10:45 UTC
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.