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

[Libguestfs] [PATCH] Fix cleanup if Ctrl-C kills guestfs qemu process



If a user kills v2v with Ctrl-C during the conversion stage, there is a high
likelihood that the qemu process will die before v2v cleanup completes. When
this happens, the unmount_all and sync calls will fail. This causes all further
cleanup to be aborted, which is undesirable.

Additional fix to RHBZ#596015
---
 v2v/virt-v2v.pl |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/v2v/virt-v2v.pl b/v2v/virt-v2v.pl
index 1ab8fdc..726cd50 100755
--- a/v2v/virt-v2v.pl
+++ b/v2v/virt-v2v.pl
@@ -414,11 +414,18 @@ sub close_guest_handle
     $guestos = undef;
 
     if (defined($g)) {
-        $g->umount_all();
-        $g->sync();
-
         my $retval = $?;
 
+        eval {
+            $g->umount_all();
+            $g->sync();
+        };
+        if ($@) {
+            warn(user_message(__x("Error cleaning up guest handle: {error}",
+                                  error => $@)));
+            $retval ||= 1;
+        }
+
         # Note that this undef is what actually causes the underlying handle to
         # be closed. This is required to allow the RHEV target's temporary mount
         # directory to be unmounted and deleted prior to exit.
-- 
1.7.0.1


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