Re: [PATCH 1/2] Separate out StateAutoStart from StateInitialize

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

 



On Thu, Jul 25, 2013 at 07:39:35PM +0100, Daniel P. Berrange wrote:
> On Thu, Jul 25, 2013 at 02:32:56PM -0400, John Ferlan wrote:
> > Separation allows for dependent drivers to be make a connection during
> > the AutoStart phase of state initialization.
> > ---
> >  src/driver.h  |  4 ++++
> >  src/libvirt.c | 23 ++++++++++++++++++++++-
> >  2 files changed, 26 insertions(+), 1 deletion(-)
> > 
> > diff --git a/src/driver.h b/src/driver.h
> > index cc03e9f..b416902 100644
> > --- a/src/driver.h
> > +++ b/src/driver.h
> > @@ -1801,6 +1801,9 @@ typedef int
> >                           void *opaque);
> >  
> >  typedef int
> > +(*virDrvStateAutoStart)(void);
> > +

Actually, why not just make this 'void' return value. None of the
impls return any error code....


> > @@ -836,6 +840,23 @@ int virStateInitialize(bool privileged,
> >              }
> >          }
> >      }
> > +
> > +    for (i = 0; i < virStateDriverTabCount; i++) {
> > +        if (virStateDriverTab[i]->stateAutoStart) {
> > +            VIR_DEBUG("Running global auto start for %s state driver",
> > +                      virStateDriverTab[i]->name);
> > +            if (virStateDriverTab[i]->stateAutoStart() < 0) {
> > +                virErrorPtr err = virGetLastError();
> > +                VIR_ERROR(_("Auto start for %s driver failed: %s"),
> > +                          virStateDriverTab[i]->name,
> > +                          err && err->message ? err->message :
> > +                                                _("Unknown problem"));
> > +                if (virStateDriverTab[i]->stateCleanup)
> > +                    ignore_value(virStateDriverTab[i]->stateCleanup());
> > +                return -1;
> > +            }

...then all this error handling goes away.

> 
> ACK
> 

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]