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

[Xen-changelog] [xen-unstable] Added the clear flag to host.dmesg, and added host.get_log. Use these to



# HG changeset patch
# User Ewan Mellor <ewan@xxxxxxxxxxxxx>
# Date 1173914219 0
# Node ID b39c0a79d4d5d90fd92efb148ad06198cd139f85
# Parent  8645c726ce9c63080fb5a1dd5534f6057f37016e
Added the clear flag to host.dmesg, and added host.get_log.  Use these to
implement xm dmesg and xm log using the Xen-API.

Signed-off-by: Tom Wilkie <tom.wilkie@xxxxxxxxx>
Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>
---
 tools/python/xen/xend/XendAPI.py |   15 ++++++++++++---
 tools/python/xen/xm/main.py      |   28 ++++++++++++++++++++++------
 2 files changed, 34 insertions(+), 9 deletions(-)

diff -r 8645c726ce9c -r b39c0a79d4d5 tools/python/xen/xend/XendAPI.py
--- a/tools/python/xen/xend/XendAPI.py  Wed Mar 14 23:14:19 2007 +0000
+++ b/tools/python/xen/xend/XendAPI.py  Wed Mar 14 23:16:59 2007 +0000
@@ -661,7 +661,8 @@ class XendAPI(object):
                     ('shutdown', None),
                     ('add_to_other_config', None),
                     ('remove_from_other_config', None),
-                    ('dmesg', 'String')]
+                    ('dmesg', 'String'),
+                    ('get_log', 'String')]
     
     host_funcs = [('get_by_name_label', 'Set(host)')]
 
@@ -737,8 +738,16 @@ class XendAPI(object):
             return xen_api_error(XEND_ERROR_HOST_RUNNING)
         return xen_api_error(XEND_ERROR_UNSUPPORTED)        
 
-    def host_dmesg(self, session, host_ref):
-        return xen_api_success(XendDmesg.instance().info())
+    def host_dmesg(self, session, host_ref, clear):
+        if clear:
+            return xen_api_success(XendDmesg.instance().clear())
+        else:
+            return xen_api_success(XendDmesg.instance().info())
+
+    def host_get_log(self, session, host_ref):
+        log_file = open(XendLogging.getLogFilename())
+        log_buffer = log_file.read()
+        return xen_api_success(log_buffer)
 
     def host_get_record(self, session, host_ref):
         node = XendNode.instance()
diff -r 8645c726ce9c -r b39c0a79d4d5 tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py       Wed Mar 14 23:14:19 2007 +0000
+++ b/tools/python/xen/xm/main.py       Wed Mar 14 23:16:59 2007 +0000
@@ -1498,17 +1498,33 @@ def xm_dmesg(args):
         err("No parameter required")
         usage('dmesg')
 
-    if not use_clear:
-        print server.xend.node.dmesg.info()
-    else:
-        server.xend.node.dmesg.clear()
+    if serverType == SERVER_XEN_API:
+        if not use_clear:
+            print server.xenapi.host.dmesg(
+                server.xenapi.session.get_this_host(),0)
+        else:
+            server.xenapi.host.dmesg(
+                server.xenapi.session.get_this_host(),1)
+    else:
+        if not use_clear:
+            print server.xend.node.dmesg.info()
+        else:
+            server.xend.node.dmesg.clear()
 
 def xm_log(args):
     arg_check(args, "log", 0)
-    
-    print server.xend.node.log()
+
+    if serverType == SERVER_XEN_API:
+        print server.xenapi.host.get_log(
+            server.xenapi.session.get_this_host())
+    else:
+        print server.xend.node.log()
 
 def xm_serve(args):
+    if serverType == SERVER_XEN_API:
+        print "Not supported with XenAPI"
+        sys.exit(-1)
+
     arg_check(args, "serve", 0)
 
     from fcntl import fcntl, F_SETFL

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.