diff mbox

[KVM-AUTOTEST,03/18] KVM test: kvm_monitor.py: add convenience method get_event()

Message ID 1276820075-31310-3-git-send-email-mgoldish@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Michael Goldish June 18, 2010, 12:14 a.m. UTC
None
diff mbox

Patch

diff --git a/client/tests/kvm/kvm_monitor.py b/client/tests/kvm/kvm_monitor.py
index 12cf773..c2c6261 100644
--- a/client/tests/kvm/kvm_monitor.py
+++ b/client/tests/kvm/kvm_monitor.py
@@ -566,6 +566,18 @@  class QMPMonitor(Monitor):
             self._lock.release()
 
 
+    def get_event(self, name):
+        """
+        Look for an event with the given name in the list of events.
+
+        @param name: The name of the event to look for (e.g. 'RESET')
+        @return: An event object or None if none is found
+        """
+        for e in self.get_events():
+            if e.get("event") == name:
+                return e
+
+
     def clear_events(self):
         """
         Clear the list of asynchronous events.