@@ -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",
@@ -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()
@@ -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()