[Libguestfs] [PATCH v3 09/13] v2v: drop redundant umount_all() and shutdown()

Richard W.M. Jones rjones at redhat.com
Tue Oct 20 14:16:21 UTC 2015


On Tue, Oct 20, 2015 at 04:08:17PM +0300, Roman Kagan wrote:
> umount_all() and shutdown() are performed by guestfs automatically on
> close(), so drop explicit calls to them right before close().
> 
> Also umount_all() in the middle of processing doesn't look justified so
> drop it, too.
> (The only step following it is do_fstrim() which does mounting/umounting
> on its own).
> 
> Signed-off-by: Roman Kagan <rkagan at virtuozzo.com>
> ---
>  v2v/v2v.ml | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/v2v/v2v.ml b/v2v/v2v.ml
> index cc36422..c28905d 100644
> --- a/v2v/v2v.ml
> +++ b/v2v/v2v.ml
> @@ -87,8 +87,6 @@ let rec main () =
>    let keep_serial_console = output#keep_serial_console in
>    let guestcaps = do_convert g inspect source keep_serial_console in
>  
> -  g#umount_all ();
> -
>    if no_trim <> ["*"] && (do_copy || debug_overlays) then (
>      (* Doing fstrim on all the filesystems reduces the transfer size
>       * because unused blocks are marked in the overlay and thus do
> @@ -99,8 +97,6 @@ let rec main () =
>    );
>  
>    message (f_"Closing the overlay");
> -  g#umount_all ();
> -  g#shutdown ();

NACK - the call to g#shutdown is required here to avoid data
corruption if qemu crashes.

See:

https://www.redhat.com/archives/libguestfs/2012-July/msg00008.html
http://libguestfs.org/guestfs.3.html#guestfs_close

Calling g#umount_all is not necessary, but also shouldn't do any harm.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v




More information about the Libguestfs mailing list