From patchwork Tue Jan 11 18:33:21 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Goldish X-Patchwork-Id: 472271 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p0BIX11T011715 for ; Tue, 11 Jan 2011 18:33:01 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756247Ab1AKScz (ORCPT ); Tue, 11 Jan 2011 13:32:55 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54778 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752777Ab1AKScx (ORCPT ); Tue, 11 Jan 2011 13:32:53 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id p0BIWqqm027083 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 11 Jan 2011 13:32:53 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p0BIWq0I019334; Tue, 11 Jan 2011 13:32:52 -0500 Received: from qu0061.eng.lab.tlv.redhat.com ([10.35.16.61]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id p0BIWmpT024581; Tue, 11 Jan 2011 13:32:51 -0500 From: Michael Goldish To: autotest@test.kernel.org, kvm@vger.kernel.org Cc: 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> In-Reply-To: <1294770802-1501-1-git-send-email-mgoldish@redhat.com> References: <1294770802-1501-1-git-send-email-mgoldish@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Tue, 11 Jan 2011 18:33:01 +0000 (UTC) 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()