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

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

 



get_event() looks for and returns a single event matching the given name,
or None if none is found.

Signed-off-by: Michael Goldish <mgoldish@xxxxxxxxxx>
---
 client/tests/kvm/kvm_monitor.py |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

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.
-- 
1.5.4.1

--
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