[Libguestfs] [PATCH] v2v: Fix error on exit unmounting transfer ISO

Matthew Booth mbooth at redhat.com
Wed Apr 7 11:05:45 UTC 2010


If the transfer iso was mounted during conversion, virt-v2v would always give
the following error on shutdown:

    (in cleanup) umount: /tmp/transferb7icam: umount:
    /sysroot/tmp/transferb7icam: not found at
    /home/mbooth/src/virt-v2v/blib/lib/Sys/VirtV2V/GuestOS/RedHat.pm line 1171.

This was because the GuestOS::RedHat cleanup was being called implicitly on
exit, which is after umount_all has been called explicitly on the libguestfs
handle.  This change garbage collects the guestos explicitly before the
libguestfs handle.
---
 v2v/virt-v2v.pl |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/v2v/virt-v2v.pl b/v2v/virt-v2v.pl
index 08f1c8d..c7ebad3 100755
--- a/v2v/virt-v2v.pl
+++ b/v2v/virt-v2v.pl
@@ -366,6 +366,9 @@ END {
 
 sub close_guest_handle
 {
+    # Perform GuestOS cleanup before closing the handle
+    $guestos = undef;
+
     if (defined($g)) {
         $g->umount_all();
         $g->sync();
-- 
1.6.6.1




More information about the Libguestfs mailing list