[PATCH 4/5] virt.kvm_vm: Introduce vm.verify_userspace_crash()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In order to capture any qemu crashes, introduce a method
that scans qemu output and throws an error if a core dump
condition is found.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@xxxxxxxxxx>
---
 client/virt/kvm_vm.py                   |   18 ++++++++++++++++++
 client/virt/libvirt_vm.py               |    7 +++++++
 client/virt/tests/unattended_install.py |    1 +
 3 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/client/virt/kvm_vm.py b/client/virt/kvm_vm.py
index 4a29721..372cfbc 100644
--- a/client/virt/kvm_vm.py
+++ b/client/virt/kvm_vm.py
@@ -10,6 +10,15 @@ from autotest_lib.client.bin import utils
 import virt_utils, virt_vm, virt_test_setup, kvm_monitor, aexpect
 
 
+class QemuSegFaultError(virt_vm.VMError):
+    def __init__(self, crash_message):
+        virt_vm.VMError.__init__(self, crash_message)
+        self.crash_message = crash_message
+
+    def __str__(self):
+        return ("Qemu crashed: %s" % self.crash_message)
+
+
 class VM(virt_vm.BaseVM):
     """
     This class handles all basic VM operations.
@@ -96,6 +105,15 @@ class VM(virt_vm.BaseVM):
             raise virt_vm.VMStatusError("VM status is unexpected")
 
 
+    def verify_userspace_crash(self):
+        """
+        Verify if the userspace component (qemu) crashed.
+        """
+        for line in self.process.get_output().splitlines():
+            if "(core dumped)" in line:
+                raise QemuSegFaultError(line)
+
+
     def clone(self, name=None, params=None, root_dir=None, address_cache=None,
               copy_state=False):
         """
diff --git a/client/virt/libvirt_vm.py b/client/virt/libvirt_vm.py
index 0c32551..760ccef 100644
--- a/client/virt/libvirt_vm.py
+++ b/client/virt/libvirt_vm.py
@@ -324,6 +324,13 @@ class VM(virt_vm.BaseVM):
         return virsh_is_dead(self.name)
 
 
+    def verify_userspace_crash(self):
+        """
+        Doesn't do anything yet.
+        """
+        pass
+
+
     def clone(self, name=None, params=None, root_dir=None, address_cache=None,
               copy_state=False):
         """
diff --git a/client/virt/tests/unattended_install.py b/client/virt/tests/unattended_install.py
index 57161a8..bc5f29f 100644
--- a/client/virt/tests/unattended_install.py
+++ b/client/virt/tests/unattended_install.py
@@ -799,6 +799,7 @@ def run_unattended_install(test, params, env):
                 break
             else:
                 raise e
+        vm.verify_userspace_crash()
         vm.verify_kernel_crash()
         test.verify_background_errors()
         if params.get("wait_no_ack", "no") == "no":
-- 
1.7.7

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux