ia64/xen-unstable

changeset 14497:c9ac275f8985

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@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Wed Mar 21 12:03:42 2007 +0000 (2007-03-21)
parents f1833268b28f
children e9a5ba552808
files tools/python/xen/xend/XendAPI.py tools/python/xen/xend/XendDmesg.py tools/python/xen/xm/main.py
line diff
     1.1 --- a/tools/python/xen/xend/XendAPI.py	Wed Mar 21 08:51:51 2007 +0000
     1.2 +++ b/tools/python/xen/xend/XendAPI.py	Wed Mar 21 12:03:42 2007 +0000
     1.3 @@ -665,6 +665,7 @@ class XendAPI(object):
     1.4                      ('add_to_other_config', None),
     1.5                      ('remove_from_other_config', None),
     1.6                      ('dmesg', 'String'),
     1.7 +                    ('dmesg_clear', 'String'),
     1.8                      ('get_log', 'String'),
     1.9                      ('send_debug_keys', None)]
    1.10      
    1.11 @@ -742,11 +743,11 @@ class XendAPI(object):
    1.12              return xen_api_error(XEND_ERROR_HOST_RUNNING)
    1.13          return xen_api_error(XEND_ERROR_UNSUPPORTED)        
    1.14  
    1.15 -    def host_dmesg(self, session, host_ref, clear):
    1.16 -        if clear:
    1.17 -            return xen_api_success(XendDmesg.instance().clear())
    1.18 -        else:
    1.19 -            return xen_api_success(XendDmesg.instance().info())
    1.20 +    def host_dmesg(self, session, host_ref):
    1.21 +        return xen_api_success(XendDmesg.instance().info())
    1.22 +
    1.23 +    def host_dmesg_clear(self, session, host_ref):
    1.24 +        return xen_api_success(XendDmesg.instance().clear())
    1.25  
    1.26      def host_get_log(self, session, host_ref):
    1.27          log_file = open(XendLogging.getLogFilename())
     2.1 --- a/tools/python/xen/xend/XendDmesg.py	Wed Mar 21 08:51:51 2007 +0000
     2.2 +++ b/tools/python/xen/xend/XendDmesg.py	Wed Mar 21 12:03:42 2007 +0000
     2.3 @@ -13,6 +13,7 @@
     2.4  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
     2.5  #============================================================================
     2.6  # Copyright (C) 2004, 2005 Mike Wray <mike.wray@hp.com>
     2.7 +# Copyright (C) 2007       XenSource Inc.
     2.8  #============================================================================
     2.9  
    2.10  """Get dmesg output for this node.
    2.11 @@ -28,7 +29,7 @@ class XendDmesg:
    2.12          return self.xc.readconsolering()
    2.13  
    2.14      def clear(self):
    2.15 -        self.xc.readconsolering(True)
    2.16 +        return self.xc.readconsolering(True)
    2.17  
    2.18  def instance():
    2.19      global inst
     3.1 --- a/tools/python/xen/xm/main.py	Wed Mar 21 08:51:51 2007 +0000
     3.2 +++ b/tools/python/xen/xm/main.py	Wed Mar 21 12:03:42 2007 +0000
     3.3 @@ -217,7 +217,7 @@ SUBCOMMAND_OPTIONS = {
     3.4         ('-q', '--quiet', 'Do not print an error message if the domain does not exist'),
     3.5      ),
     3.6      'dmesg': (
     3.7 -       ('-c', '--clear', 'Clear dmesg buffer'),
     3.8 +       ('-c', '--clear', 'Clear dmesg buffer as well as printing it'),
     3.9      ),
    3.10      'vnet-list': (
    3.11         ('-l', '--long', 'List Vnets as SXP'),
    3.12 @@ -1587,17 +1587,16 @@ def xm_dmesg(args):
    3.13          usage('dmesg')
    3.14  
    3.15      if serverType == SERVER_XEN_API:
    3.16 -        if not use_clear:
    3.17 -            print server.xenapi.host.dmesg(
    3.18 -                server.xenapi.session.get_this_host(),0)
    3.19 +        host = server.xenapi.session.get_this_host()
    3.20 +        if use_clear:
    3.21 +            print server.xenapi.host.dmesg_clear(host),
    3.22          else:
    3.23 -            server.xenapi.host.dmesg(
    3.24 -                server.xenapi.session.get_this_host(),1)
    3.25 +            print server.xenapi.host.dmesg(host),
    3.26      else:
    3.27          if not use_clear:
    3.28 -            print server.xend.node.dmesg.info()
    3.29 +            print server.xend.node.dmesg.info(),
    3.30          else:
    3.31 -            server.xend.node.dmesg.clear()
    3.32 +            print server.xend.node.dmesg.clear(),
    3.33  
    3.34  def xm_log(args):
    3.35      arg_check(args, "log", 0)