[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] libvirt.c: fix virStateActive return value; document ...



On Mon, Nov 24, 2008 at 06:05:37PM +0100, Jim Meyering wrote:
> "Daniel P. Berrange" <berrange redhat com> wrote:
> ...
> >> + * Run each virtualization driver's "active" method.
> >> + *
> >> + * Return 0 if successful, -1 upon error.
> >> + */
> >>  int virStateActive(void) {
> >>      int i, ret = 0;
> >>
> >>      for (i = 0 ; i < virStateDriverTabCount ; i++) {
> >>          if (virStateDriverTab[i]->active &&
> >>              virStateDriverTab[i]->active())
> >> -            ret = 1;
> >> +            ret = -1;
> >
> > This is *not* an error condition. This method is basically asking
> > whether the driver is 'active' - eg, does it have any domains
> > running. It returns 0 if it isn't active, or 1 if it is active.
> >
> > There is no error scenario - it can never fail.
> 
> Ah.  I see what you mean.
> This is better:
> 
> From a85968eed75cdbcf8848ea62b2739469fd6a9d60 Mon Sep 17 00:00:00 2001
> From: Jim Meyering <meyering redhat com>
> Date: Mon, 24 Nov 2008 15:52:55 +0100
> Subject: [PATCH 1/3] libvirt.c: document the virState* functions

ACK.

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]