Re: [PATCH] netcf: Don't complain when cleanup is called before init

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

 



On Thu, Oct 17, 2013 at 03:57:19PM +0200, Christophe Fergeau wrote:
> netcfStateInitialize() initializes the driverState variable,
> and when netcfStateCleanup is called, it will call virReportError()
> if driverState is NULL.
> This is not consistent with what other state objects are doing,
> they return -1 without reporting an error in such cases.
> 
> See also
> https://www.redhat.com/archives/libvir-list/2013-October/msg00809.html:
> 
> On Thu, Oct 17, 2013 at 01:40:19PM +0100, Daniel P. Berrange wrote:
> > We don't want virStateCleanup to skip execution if virStateInitialize
> > has failed though - every callback in virStateCleanup should be written
> > to be safe if its corresponding init function hasn't run.
> ---
>  src/interface/interface_backend_netcf.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/src/interface/interface_backend_netcf.c b/src/interface/interface_backend_netcf.c
> index fac059d..c4e18c4 100644
> --- a/src/interface/interface_backend_netcf.c
> +++ b/src/interface/interface_backend_netcf.c
> @@ -100,11 +100,8 @@ netcfStateInitialize(bool privileged ATTRIBUTE_UNUSED,
>  static int
>  netcfStateCleanup(void)
>  {
> -    if (!driverState) {
> -        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> -                       _("Attempt to close netcf state driver already closed"));
> +    if (!driverState)
>          return -1;
> -    }
>  
>      if (virObjectUnref(driverState)) {
>          virReportError(VIR_ERR_INTERNAL_ERROR, "%s",

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]