debuggers.hg

changeset 21232:2c2591185f8c

xend: make NUMA in xm info optional (dependent on new -n switch)

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Apr 15 13:16:17 2010 +0100 (2010-04-15)
parents fddff17c7c74
children 3e56823eb209
files tools/python/xen/xend/XendNode.py tools/python/xen/xm/main.py
line diff
     1.1 --- a/tools/python/xen/xend/XendNode.py	Thu Apr 15 13:06:48 2010 +0100
     1.2 +++ b/tools/python/xen/xend/XendNode.py	Thu Apr 15 13:16:17 2010 +0100
     1.3 @@ -835,8 +835,8 @@ class XendNode:
     1.4      # Getting host information.
     1.5      #
     1.6  
     1.7 -    def info(self):
     1.8 -        return (self.nodeinfo() + self.physinfo() + self.xeninfo() +
     1.9 +    def info(self, show_numa = 1):
    1.10 +        return (self.nodeinfo() + self.physinfo(show_numa) + self.xeninfo() +
    1.11                  self.xendinfo())
    1.12  
    1.13      def nodeinfo(self):
    1.14 @@ -915,7 +915,7 @@ class XendNode:
    1.15              str='none\n'
    1.16          return str[:-1];
    1.17  
    1.18 -    def physinfo(self):
    1.19 +    def physinfo(self, show_numa):
    1.20          info = self.xc.physinfo()
    1.21          tinfo = self.xc.topologyinfo()
    1.22          ninfo = self.xc.numainfo()
    1.23 @@ -926,12 +926,6 @@ class XendNode:
    1.24          info['total_memory'] = info['total_memory'] / 1024
    1.25          info['free_memory']  = info['free_memory'] / 1024
    1.26  
    1.27 -        info['cpu_topology']  = \
    1.28 -             self.format_cpu_to_core_socket_node(tinfo)
    1.29 -
    1.30 -        info['numa_info']  = \
    1.31 -             self.format_numa_info(ninfo)
    1.32 -
    1.33          ITEM_ORDER = ['nr_cpus',
    1.34                        'nr_nodes',
    1.35                        'cores_per_socket',
    1.36 @@ -941,10 +935,17 @@ class XendNode:
    1.37                        'virt_caps',
    1.38                        'total_memory',
    1.39                        'free_memory',
    1.40 -                      'cpu_topology',
    1.41 -                      'numa_info',
    1.42                        ]
    1.43  
    1.44 +        if show_numa != 0:
    1.45 +            info['cpu_topology']  = \
    1.46 +                 self.format_cpu_to_core_socket_node(tinfo)
    1.47 +
    1.48 +            info['numa_info']  = \
    1.49 +                 self.format_numa_info(ninfo)
    1.50 +
    1.51 +            ITEM_ORDER += [ 'cpu_topology', 'numa_info' ]
    1.52 +
    1.53          return [[k, info[k]] for k in ITEM_ORDER]
    1.54  
    1.55      def pciinfo(self):
    1.56 @@ -1056,7 +1057,7 @@ class XendNode:
    1.57      def xeninfo_dict(self):
    1.58          return dict(self.xeninfo())
    1.59      def physinfo_dict(self):
    1.60 -        return dict(self.physinfo())
    1.61 +        return dict(self.physinfo(1))
    1.62      def info_dict(self):
    1.63          return dict(self.info())
    1.64  
     2.1 --- a/tools/python/xen/xm/main.py	Thu Apr 15 13:06:48 2010 +0100
     2.2 +++ b/tools/python/xen/xm/main.py	Thu Apr 15 13:16:17 2010 +0100
     2.3 @@ -145,7 +145,8 @@ SUBCOMMAND_HELP = {
     2.4      'domname'     : ('<DomId>', 'Convert a domain id to domain name.'),
     2.5      'dump-core'   : ('[-L|--live] [-C|--crash] [-R|--reset] <Domain> [Filename]',
     2.6                       'Dump core for a specific domain.'),
     2.7 -    'info'        : ('[-c|--config]', 'Get information about Xen host.'),
     2.8 +    'info'        : ('[-c|--config] [-n|--numa]',
     2.9 +                     'Get information about Xen host.'),
    2.10      'log'         : ('', 'Print Xend log'),
    2.11      'rename'      : ('<Domain> <NewDomainName>', 'Rename a domain.'),
    2.12      'sched-sedf'  : ('<Domain> [options]', 'Get/set EDF parameters.'),
    2.13 @@ -326,6 +327,7 @@ SUBCOMMAND_OPTIONS = {
    2.14      ),
    2.15      'info': (
    2.16         ('-c', '--config', 'List Xend configuration parameters'),
    2.17 +       ('-n', '--numa', 'List host NUMA topology information'),
    2.18      ),
    2.19      'tmem-list': (
    2.20         ('-l', '--long', 'List tmem stats.'),
    2.21 @@ -1825,15 +1827,18 @@ def xm_info(args):
    2.22      arg_check(args, "info", 0, 1)
    2.23      
    2.24      try:
    2.25 -        (options, params) = getopt.gnu_getopt(args, 'c', ['config'])
    2.26 +        (options, params) = getopt.gnu_getopt(args, 'cn', ['config','numa'])
    2.27      except getopt.GetoptError, opterr:
    2.28          err(opterr)
    2.29          usage('info')
    2.30      
    2.31      show_xend_config = 0
    2.32 +    show_numa_topology = 0
    2.33      for (k, v) in options:
    2.34          if k in ['-c', '--config']:
    2.35              show_xend_config = 1
    2.36 +        if k in ['-n', '--numa']:
    2.37 +            show_numa_topology = 1
    2.38  
    2.39      if show_xend_config:
    2.40          for name, obj in inspect.getmembers(xoptions):
    2.41 @@ -1920,7 +1925,7 @@ def xm_info(args):
    2.42          for (k, v) in sorted:
    2.43             print "%-23s:" % k, v 
    2.44      else:
    2.45 -        info = server.xend.node.info()
    2.46 +        info = server.xend.node.info(show_numa_topology)
    2.47          for x in info[1:]:
    2.48              if len(x) < 2: 
    2.49                  print "%-23s: (none)" % x[0]