[libvirt] [PATCH] esx: don't ignore failure on close

Daniel Veillard veillard at redhat.com
Wed Mar 3 10:25:39 UTC 2010


On Tue, Mar 02, 2010 at 11:38:16PM +0100, Matthias Bolte wrote:
> 2010/3/2 Eric Blake <eblake at redhat.com>:
> > Another warning caught by coverity.  Continue to perform best-effort
> > closing and resource release, but warn the caller about the failure.
> >
> > * src/esx/esx_driver.c (esxClose): Return an error on failure to
> > close.
> > ---
> >  src/esx/esx_driver.c |   18 +++++++++++-------
> >  1 files changed, 11 insertions(+), 7 deletions(-)
> >
> > diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
> > index e125a09..45b389f 100644
> > --- a/src/esx/esx_driver.c
> > +++ b/src/esx/esx_driver.c
> > @@ -2,6 +2,7 @@
> >  /*
> >  * esx_driver.c: core driver methods for managing VMware ESX hosts
> >  *
> > + * Copyright (C) 2010 Red Hat, Inc.
> >  * Copyright (C) 2009, 2010 Matthias Bolte <matthias.bolte at googlemail.com>
> >  * Copyright (C) 2009 Maximilian Wilhelm <max at rfc2324.org>
> >  *
> > @@ -559,16 +560,19 @@ static int
> >  esxClose(virConnectPtr conn)
> >  {
> >     esxPrivate *priv = conn->privateData;
> > +    int result = 0;
> >
> > -    esxVI_EnsureSession(priv->host);
> > -
> > -    esxVI_Logout(priv->host);
> > +    if (esxVI_EnsureSession(priv->host) < 0 ||
> > +        esxVI_Logout(priv->host) < 0) {
> > +        result = -1;
> > +    }
> >     esxVI_Context_Free(&priv->host);
> >
> >     if (priv->vCenter != NULL) {
> > -        esxVI_EnsureSession(priv->vCenter);
> > -
> > -        esxVI_Logout(priv->vCenter);
> > +        if (esxVI_EnsureSession(priv->vCenter) < 0 ||
> > +            esxVI_Logout(priv->vCenter) < 0) {
> > +            result = -1;
> > +        }
> >         esxVI_Context_Free(&priv->vCenter);
> >     }
> >
> > @@ -579,7 +583,7 @@ esxClose(virConnectPtr conn)
> >
> >     conn->privateData = NULL;
> >
> > -    return 0;
> > +    return result;
> >  }
> >
> >
> > --
> > 1.6.6.1
> >
> 
> ACK.
> 
> But as this is not critical, we can delay it until after the 0.7.7 release.

 not critical, but in that case I think it's safe and I just pushed it

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/




More information about the libvir-list mailing list