From patchwork Fri Mar 18 20:58:27 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Meneghel Rodrigues X-Patchwork-Id: 644991 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 p2IKwcqP030888 for ; Fri, 18 Mar 2011 20:58:38 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757074Ab1CRU6e (ORCPT ); Fri, 18 Mar 2011 16:58:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50365 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756932Ab1CRU6e (ORCPT ); Fri, 18 Mar 2011 16:58:34 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p2IKwWVT004573 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 18 Mar 2011 16:58:32 -0400 Received: from freedom.redhat.com (vpn-11-179.rdu.redhat.com [10.11.11.179]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p2IKwT5x031938; Fri, 18 Mar 2011 16:58:30 -0400 From: Lucas Meneghel Rodrigues To: autotest@test.kernel.org Cc: kvm@vger.kernel.org, mgoldish@redhat.com, Lucas Meneghel Rodrigues Subject: [PATCH 1/2] KVM test: Create a verify_kernel_crash() VM method v3 Date: Fri, 18 Mar 2011 17:58:27 -0300 Message-Id: <1300481908-4931-1-git-send-email-lmr@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 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]); Fri, 18 Mar 2011 20:58:38 +0000 (UTC) diff --git a/client/tests/kvm/kvm_vm.py b/client/tests/kvm/kvm_vm.py index 43ae79c..8114670 100755 --- a/client/tests/kvm/kvm_vm.py +++ b/client/tests/kvm/kvm_vm.py @@ -105,6 +105,15 @@ class VMDeadError(VMError): (self.status, self.output)) +class VMDeadKernelCrashError(VMError): + def __init__(self, kernel_crash): + VMError.__init__(self, kernel_crash) + self.kernel_crash = kernel_crash + + def __str__(self): + return ("VM is dead due to a kernel crash:\n%s" % self.kernel_crash) + + class VMAddressError(VMError): pass @@ -1158,6 +1167,20 @@ class VM: return not self.process or not self.process.is_alive() + def verify_kernel_crash(self): + """ + Find kernel crash message on the VM serial console. + + @raise: VMDeadKernelCrashError, in case a kernel crash message was + found. + """ + data = self.serial_console.get_output() + match = re.search(r"BUG:.*---\[ end trace .* \]---", data, + re.DOTALL|re.MULTILINE) + if match is not None: + raise VMDeadKernelCrashError(match.group(0)) + + def get_params(self): """ Return the VM's params dict. Most modified params take effect only