[Libguestfs] [PATCH] Improve cleanup of libguestfs handle with Sys::VirtV2V::GuestfsHandle

Richard W.M. Jones rjones at redhat.com
Fri Jun 18 09:36:25 UTC 2010


On Thu, Jun 17, 2010 at 05:05:09PM +0100, Matthew Booth wrote:
> This change replaces all direct usage of a Sys::Guestfs object in virt-v2v with
> a Sys::VirtV2V::GuestfsHandle proxy object. The proxy does 3 things:
> 
> * Holds handle initialisation code
> * Adds the ability to explicitly close the handle
> * Adds the ability to register a callback to be executed before close
> 
> The cleanup code in Sys::VirtV2V::Config is updated to use the new callback
> mechanism.
> 
> Additionally, the initialisation code improves handling of failure while
> virt-v2v is running with uid:gid == 36:36. If cleanup handlers are called in
> this context they can fail due to insufficient permissions. If this code dies,
> permissions will be restored before the die is propagated. If this code receives
> a user signal it will be postponed until after the code has completed.

This all seems reasonable.  I think the only thing I might have
changed would be to try a subclass, but the proxy / AUTOLOAD method
should also work fine.

ACK.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://et.redhat.com/~rjones/libguestfs/
See what it can do: http://et.redhat.com/~rjones/libguestfs/recipes.html




More information about the Libguestfs mailing list