[KVM-AUTOTEST PATCH 3/4] KVM test: don't re-raise a background exception if something went wrong in the main thread

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

 



Signed-off-by: Michael Goldish <mgoldish@xxxxxxxxxx>
---
 .../kvm/tests/migration_with_file_transfer.py      |    7 ++++++-
 client/tests/kvm/tests/migration_with_reboot.py    |    7 ++++++-
 client/tests/kvm/tests/vmstop.py                   |    5 +----
 3 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/client/tests/kvm/tests/migration_with_file_transfer.py b/client/tests/kvm/tests/migration_with_file_transfer.py
index 4064b4a..734fe35 100644
--- a/client/tests/kvm/tests/migration_with_file_transfer.py
+++ b/client/tests/kvm/tests/migration_with_file_transfer.py
@@ -46,7 +46,12 @@ def run_migration_with_file_transfer(test, params, env):
                     logging.info("File transfer not ended, starting a round of "
                                  "migration...")
                     vm.migrate(mig_timeout, mig_protocol, mig_cancel_delay)
-            finally:
+            except:
+                # If something bad happened in the main thread, ignore
+                # exceptions raised in the background thread
+                bg.join(suppress_exception=True)
+                raise
+            else:
                 bg.join()
 
         error.context("transferring file to guest while migrating",
diff --git a/client/tests/kvm/tests/migration_with_reboot.py b/client/tests/kvm/tests/migration_with_reboot.py
index 671f1ef..0688282 100644
--- a/client/tests/kvm/tests/migration_with_reboot.py
+++ b/client/tests/kvm/tests/migration_with_reboot.py
@@ -35,7 +35,12 @@ def run_migration_with_reboot(test, params, env):
         try:
             while bg.is_alive():
                 vm.migrate(mig_timeout, mig_protocol, mig_cancel_delay)
-        finally:
+        except:
+            # If something bad happened in the main thread, ignore exceptions
+            # raised in the background thread
+            bg.join(suppress_exception=True)
+            raise
+        else:
             session = bg.join()
     finally:
         session.close()
diff --git a/client/tests/kvm/tests/vmstop.py b/client/tests/kvm/tests/vmstop.py
index 4d47471..1dd6dcf 100644
--- a/client/tests/kvm/tests/vmstop.py
+++ b/client/tests/kvm/tests/vmstop.py
@@ -70,10 +70,7 @@ def run_vmstop(test, params, env):
             if md5_save1 != md5_save2:
                 raise error.TestFail("The produced state files differ")
         finally:
-            try:
-                bg.join()
-            except:
-                pass
+            bg.join(suppress_exception=True)
 
     finally:
         session.close()
-- 
1.7.3.4

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux