[ovirt-devel] custom exit codes from engine-setup/cleanup

Yedidyah Bar David didi at redhat.com
Sun Feb 15 08:42:49 UTC 2015


----- Original Message -----
> From: "Doron Fediuck" <dfediuck at redhat.com>
> To: "Sandro Bonazzola" <sbonazzo at redhat.com>, "Yedidyah Bar David" <didi at redhat.com>, "devel" <devel at ovirt.org>,
> "infra" <infra at ovirt.org>
> Sent: Thursday, February 12, 2015 6:31:35 PM
> Subject: Re: [ovirt-devel] custom exit codes from engine-setup/cleanup
> 
> 
> 
> On 12/02/15 12:41, Sandro Bonazzola wrote:
> > Adding infra.
> > 
> > Il 12/02/2015 11:29, Yedidyah Bar David ha scritto:
> >> Hi all,
> >>
> >> The patch [1] for [2] is mostly ready.
> >>
> >> The patch [3] for otopi was already merged (by Alon) to master.
> >> It includes the following codes:
> >> 0 - success
> >> 1 - general error - the default if there was an error
> >> 2 - initialization error - returned if there was an error while loading
> >> plugins, before actually starting to run them
> >>
> >> These apply to all otopi-based tools.
> >>
> >> patch [1], not merged yet, currently adds this code, affecting
> >> engine-cleanup:
> >> 11 - cleanup called without setup.
> >> Returned in addition to the existing message:
> >> Could not detect a completed product setup
> >> Please use the cleanup utility only after a setup or after an upgrade from
> >> an older installation.
> >>
> >> Comments are welcome:
> >>
> >> What other codes do you want to see?
> >> For automated testing or any other use?
> >>
> >> Do you think we should group them and allocate somehow?
> >> Just add a code whenever needed?
> >>
> >> If last is 'Yes', no need to think very much about the previous ones...
> >>
> >> [1] http://gerrit.ovirt.org/35503
> >> [2] https://bugzilla.redhat.com/show_bug.cgi?id=1079726
> >> [3] http://gerrit.ovirt.org/35632
> >>
> >> Thanks,
> >>
> > 
> > 
> 
> Based on [1], it seems that it would be worth it to reserve some of the
> codes for future use (like the usr codes).

The linked page refers to a library. In our case, we have otopi, which
might be treated as a library, our tools (engine-setup etc), and potential
other users that build on our code and extend it.

For otopi, I think it will be safe to assume that 10 exit codes will be
enough, and so reserve 1-10 to it. That's why I pushed the patch for
engine-cleanup to use 11.

For engine-setup/cleanup, I agree we might limit ourselves to some set of
codes, that's what I asked about :-) Not sure which, though. Perhaps first
decide if we want anything else.

> Additionally, we should consider if we want to limit ourselves to 256
> codes, to make sure we do not overflow someone. If this is needed, we
> can reserve 255 to indicate overflow as mentioned in [2].

I do not think we should touch this.

We'll obviously limit our used codes to 1-255 (perhaps less, depending on
this discussion), but would rather not make otopi check for and prevent
more than 255. Code that uses more than that will get the usual semantics,
which depend on whether the caller used wait (8 bits) or waitid (> 8 bits,
appears in linux 2.6.8+ and python 3.3+).

Any other more-specific groups of codes we want?

Do we want to set a range for each of setup, cleanup, common?

Do we want to go over all the calls to 'raise' and think if they should
get their own code?

Just allocating a code when needed?

Anything else?

Also added an etherpad [1] to track questions/status.

[1] http://etherpad.ovirt.org/p/exit-codes

Thanks,
-- 
Didi



More information about the Devel mailing list