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

[Xen-changelog] [xen-unstable] Change xm dmesg -c so that it prints out the current buffer as well as clearing



# HG changeset patch
# User Ewan Mellor <ewan@xxxxxxxxxxxxx>
# Date 1174478622 0
# Node ID c9ac275f8985ebaa1159fa6e01a10989fb704a39
# Parent  f1833268b28fa1d8b6f81c634aeb19143d1cff1e
Change xm dmesg -c so that it prints out the current buffer as well as clearing
it.  This avoids a race so that you don't lose messages, matches the behaviour
of the hypercall, and the Unix dmesg command.

Change the Xen-API binding to use a separate function host.dmesg_clear rather
than a flag on host.dmesg.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>
---
 tools/python/xen/xend/XendAPI.py   |   11 ++++++-----
 tools/python/xen/xend/XendDmesg.py |    3 ++-
 tools/python/xen/xm/main.py        |   19 +++++++++----------
 3 files changed, 17 insertions(+), 16 deletions(-)

diff -r f1833268b28f -r c9ac275f8985 tools/python/xen/xend/XendAPI.py
--- a/tools/python/xen/xend/XendAPI.py  Wed Mar 21 08:51:51 2007 +0000
+++ b/tools/python/xen/xend/XendAPI.py  Wed Mar 21 12:03:42 2007 +0000
@@ -665,6 +665,7 @@ class XendAPI(object):
                     ('add_to_other_config', None),
                     ('remove_from_other_config', None),
                     ('dmesg', 'String'),
+                    ('dmesg_clear', 'String'),
                     ('get_log', 'String'),
                     ('send_debug_keys', None)]
     
@@ -742,11 +743,11 @@ 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, clear):
-        if clear:
-            return xen_api_success(XendDmesg.instance().clear())
-        else:
-            return xen_api_success(XendDmesg.instance().info())
+    def host_dmesg(self, session, host_ref):
+        return xen_api_success(XendDmesg.instance().info())
+
+    def host_dmesg_clear(self, session, host_ref):
+        return xen_api_success(XendDmesg.instance().clear())
 
     def host_get_log(self, session, host_ref):
         log_file = open(XendLogging.getLogFilename())
diff -r f1833268b28f -r c9ac275f8985 tools/python/xen/xend/XendDmesg.py
--- a/tools/python/xen/xend/XendDmesg.py        Wed Mar 21 08:51:51 2007 +0000
+++ b/tools/python/xen/xend/XendDmesg.py        Wed Mar 21 12:03:42 2007 +0000
@@ -13,6 +13,7 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 #============================================================================
 # Copyright (C) 2004, 2005 Mike Wray <mike.wray@xxxxxx>
+# Copyright (C) 2007       XenSource Inc.
 #============================================================================
 
 """Get dmesg output for this node.
@@ -28,7 +29,7 @@ class XendDmesg:
         return self.xc.readconsolering()
 
     def clear(self):
-        self.xc.readconsolering(True)
+        return self.xc.readconsolering(True)
 
 def instance():
     global inst
diff -r f1833268b28f -r c9ac275f8985 tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py       Wed Mar 21 08:51:51 2007 +0000
+++ b/tools/python/xen/xm/main.py       Wed Mar 21 12:03:42 2007 +0000
@@ -217,7 +217,7 @@ SUBCOMMAND_OPTIONS = {
        ('-q', '--quiet', 'Do not print an error message if the domain does not 
exist'),
     ),
     'dmesg': (
-       ('-c', '--clear', 'Clear dmesg buffer'),
+       ('-c', '--clear', 'Clear dmesg buffer as well as printing it'),
     ),
     'vnet-list': (
        ('-l', '--long', 'List Vnets as SXP'),
@@ -1587,17 +1587,16 @@ def xm_dmesg(args):
         usage('dmesg')
 
     if serverType == SERVER_XEN_API:
+        host = server.xenapi.session.get_this_host()
+        if use_clear:
+            print server.xenapi.host.dmesg_clear(host),
+        else:
+            print server.xenapi.host.dmesg(host),
+    else:
         if not use_clear:
-            print server.xenapi.host.dmesg(
-                server.xenapi.session.get_this_host(),0)
+            print server.xend.node.dmesg.info(),
         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()
+            print server.xend.node.dmesg.clear(),
 
 def xm_log(args):
     arg_check(args, "log", 0)

_______________________________________________
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®.