[Gluster-devel] Returning right ret codes in case of failure of a glusterd command

Niels de Vos ndevos at redhat.com
Tue Apr 21 14:31:18 UTC 2015


On Tue, Apr 21, 2015 at 06:07:00PM +0530, Atin Mukherjee wrote:
> 
> 
> On 04/21/2015 05:47 PM, Avra Sengupta wrote:
> > Hi,
> > 
> > Today whenever a gluster command fails the ret code is always 1.
> > Irrespective of the failure. I have sent the following patch which takes
> > a first step towards bringing some order to this chaos.
> Could you explain a bit more about the current problem if we do not have
> separate ret code?

Different return values for a command is quite common. One of the major
examples is documented in 'man 8 mount' in the 'RETURN CODES' chapter.

Scripts and other applications can then use the return code to inform
the users/admins and act in a more suitable way.

Cheers,
Niels

> 
> ~Atin
> > http://review.gluster.org/10313
> > 
> > It addresses the following scenarios:
> > 
> > 1. Invalid Syntax: I have incorporated this for the snapshot commands
> > only for now. In case of an invalid syntax the retcode will be 2.
> > 2. Another transaction in progress errors: In case the command fails to
> > acquire a lock, because another transaction is in progress the retcode
> > will be 3.
> > 
> > If the approach is fine, and it's fine to go with such incremental
> > retcodes, then once this patch gets accepted, I will send further
> > patches on top of this one. I would also urge other component owners to
> > block retcodes for their components in "glusterd-errno.h", and start
> > doing the same.
> > 
> > Regards,
> > Avra
> > _______________________________________________
> > Gluster-devel mailing list
> > Gluster-devel at gluster.org
> > http://www.gluster.org/mailman/listinfo/gluster-devel
> 
> -- 
> ~Atin
> _______________________________________________
> Gluster-devel mailing list
> Gluster-devel at gluster.org
> http://www.gluster.org/mailman/listinfo/gluster-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://www.gluster.org/pipermail/gluster-devel/attachments/20150421/e8e20061/attachment-0001.sig>


More information about the Gluster-devel mailing list