From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lucas Meneghel Rodrigues Subject: Re: [Autotest] [PATCH 6/9] KVM test: Raise error when met unknown type in kvm_vm.remote_login(). Date: Thu, 6 May 2010 12:15:26 -0300 Message-ID: References: <20100426095656.26268.50549.stgit@localhost.localdomain> <20100426100410.26268.75724.stgit@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: autotest@test.kernel.org, kvm@vger.kernel.org To: Jason Wang Return-path: Received: from mail-ww0-f46.google.com ([74.125.82.46]:57299 "EHLO mail-ww0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758601Ab0EFPP3 convert rfc822-to-8bit (ORCPT ); Thu, 6 May 2010 11:15:29 -0400 Received: by wwb39 with SMTP id 39so54247wwb.19 for ; Thu, 06 May 2010 08:15:27 -0700 (PDT) In-Reply-To: <20100426100410.26268.75724.stgit@localhost.localdomain> Sender: kvm-owner@vger.kernel.org List-ID: On Mon, Apr 26, 2010 at 7:04 AM, Jason Wang wrote= : > Need to raise the error when met the unknown type of shell_client in > kvm_vm.remote_login() in order to avoid the traceback. In order to keep consistency, please make the function return None instead of throwing an exception. You might log the message as a logging.error() record. > Signed-off-by: Jason Wang > --- > =A0client/tests/kvm/kvm_vm.py | =A0 =A04 +++- > =A01 files changed, 3 insertions(+), 1 deletions(-) > > diff --git a/client/tests/kvm/kvm_vm.py b/client/tests/kvm/kvm_vm.py > index 8f4753f..0cdf925 100755 > --- a/client/tests/kvm/kvm_vm.py > +++ b/client/tests/kvm/kvm_vm.py > @@ -806,7 +806,9 @@ class VM: > =A0 =A0 =A0 =A0 elif client =3D=3D "nc": > =A0 =A0 =A0 =A0 =A0 =A0 session =3D kvm_utils.netcat(address, port, u= sername, password, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0prompt, linesep, timeout) > - > + =A0 =A0 =A0 =A0else: > + =A0 =A0 =A0 =A0 =A0 =A0raise error.TestError("Unknown shell_client = type %s" % client) > + > =A0 =A0 =A0 =A0 if session: > =A0 =A0 =A0 =A0 =A0 =A0 session.set_status_test_command(self.params.g= et("status_test_" > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "command", "")) > > _______________________________________________ > Autotest mailing list > Autotest@test.kernel.org > http://test.kernel.org/cgi-bin/mailman/listinfo/autotest > --=20 Lucas