From: Michael Goldish Subject: [KVM-AUTOTEST PATCH 3/4] KVM test: don't re-raise a background exception if something went wrong in the main thread Date: Tue, 11 Jan 2011 20:33:21 +0200 Message-ID: <1294770802-1501-3-git-send-email-mgoldish@redhat.com> References: <1294770802-1501-1-git-send-email-mgoldish@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: autotest@test.kernel.org, kvm@vger.kernel.org Return-path: In-Reply-To: <1294770802-1501-1-git-send-email-mgoldish@redhat.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: autotest-bounces@test.kernel.org Errors-To: autotest-bounces@test.kernel.org List-Id: kvm.vger.kernel.org Signed-off-by: Michael Goldish --- .../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