[libvirt] [test-API PATCH 3/7] domainAPI: Add wrapper method to work with domain's console connections

Peter Krempa pkrempa at redhat.com
Wed Mar 21 12:46:34 UTC 2012


This patch adds a wrapper that enables work with consoles in the
test-API.
---
 lib/domainAPI.py |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/lib/domainAPI.py b/lib/domainAPI.py
index 91f2ba3..bc0069b 100644
--- a/lib/domainAPI.py
+++ b/lib/domainAPI.py
@@ -878,6 +878,15 @@ class DomainAPI(object):
             code = e.get_error_code()
             raise exception.LibvirtAPI(message, code)

+    def openConsole(self, domname, device, stream, flags = 0):
+        try:
+            dom_obj = self.get_domain_by_name(domname)
+            st_obj = stream.getStream()
+            return dom_obj.openConsole(device, st_obj, flags)
+        except libvirt.libvirtError, e:
+            message = e.get_error_message()
+            code = e.get_error_code()
+            raise exception.LibvirtAPI(message, code)

 # DomainState
 VIR_DOMAIN_NOSTATE = 0
-- 
1.7.3.4




More information about the libvir-list mailing list