From: Eduardo Habkost Subject: Re: [KVM-AUTOTEST PATCH v2 3/6] [RFC] Introduce exception context strings Date: Wed, 5 Jan 2011 14:36:43 -0200 Message-ID: <20110105163643.GF3361@otherpad.lan.raisama.net> References: <1294242329-11034-1-git-send-email-mgoldish@redhat.com> <1294242329-11034-3-git-send-email-mgoldish@redhat.com> <4D249855.30607@redhat.com> <4D249A8F.8090009@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Michael Goldish , autotest@test.kernel.org, kvm@vger.kernel.org To: Avi Kivity Return-path: Received: from mx1.redhat.com ([209.132.183.28]:48919 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751176Ab1AEQgq (ORCPT ); Wed, 5 Jan 2011 11:36:46 -0500 Content-Disposition: inline In-Reply-To: <4D249A8F.8090009@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Jan 05, 2011 at 06:21:35PM +0200, Avi Kivity wrote: > btw, you can have a decorator for enclosing an entire function in an > error context: > > @function_error_context('migration test') > def migration_test(...): > ... @context_aware does that, but it doesn't let you set the context string (it just initializes it to "(function_name)"). I think it is enough for our purposes (and it keeps the API simple). > > anything in migration_test() is enclosed in that context. But we're > just repeating the ordinary stack trace with something more > readable. The context information is more useful for cases we want to know where exactly we were, inside a single function (e.g. "did we crash before or after migration finished?"). So the API is optimized for the cases where we actually want to change the context string inside the same function. -- Eduardo