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

[Xen-changelog] [xen-unstable] xend: make NUMA in xm info optional (dependent on new -n switch)



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1271333777 -3600
# Node ID 2c2591185f8c352682d808c82ad2d8c4d1530103
# Parent  fddff17c7c741d85a9a07c1cc3aa2e5921551175
xend: make NUMA in xm info optional (dependent on new -n switch)

Signed-off-by: Andre Przywara <andre.przywara@xxxxxxx>
---
 tools/python/xen/xend/XendNode.py |   25 +++++++++++++------------
 tools/python/xen/xm/main.py       |   11 ++++++++---
 2 files changed, 21 insertions(+), 15 deletions(-)

diff -r fddff17c7c74 -r 2c2591185f8c tools/python/xen/xend/XendNode.py
--- a/tools/python/xen/xend/XendNode.py Thu Apr 15 13:06:48 2010 +0100
+++ b/tools/python/xen/xend/XendNode.py Thu Apr 15 13:16:17 2010 +0100
@@ -835,8 +835,8 @@ class XendNode:
     # Getting host information.
     #
 
-    def info(self):
-        return (self.nodeinfo() + self.physinfo() + self.xeninfo() +
+    def info(self, show_numa = 1):
+        return (self.nodeinfo() + self.physinfo(show_numa) + self.xeninfo() +
                 self.xendinfo())
 
     def nodeinfo(self):
@@ -915,7 +915,7 @@ class XendNode:
             str='none\n'
         return str[:-1];
 
-    def physinfo(self):
+    def physinfo(self, show_numa):
         info = self.xc.physinfo()
         tinfo = self.xc.topologyinfo()
         ninfo = self.xc.numainfo()
@@ -925,12 +925,6 @@ class XendNode:
         # physinfo is in KiB, need it in MiB
         info['total_memory'] = info['total_memory'] / 1024
         info['free_memory']  = info['free_memory'] / 1024
-
-        info['cpu_topology']  = \
-             self.format_cpu_to_core_socket_node(tinfo)
-
-        info['numa_info']  = \
-             self.format_numa_info(ninfo)
 
         ITEM_ORDER = ['nr_cpus',
                       'nr_nodes',
@@ -941,9 +935,16 @@ class XendNode:
                       'virt_caps',
                       'total_memory',
                       'free_memory',
-                      'cpu_topology',
-                      'numa_info',
                       ]
+
+        if show_numa != 0:
+            info['cpu_topology']  = \
+                 self.format_cpu_to_core_socket_node(tinfo)
+
+            info['numa_info']  = \
+                 self.format_numa_info(ninfo)
+
+            ITEM_ORDER += [ 'cpu_topology', 'numa_info' ]
 
         return [[k, info[k]] for k in ITEM_ORDER]
 
@@ -1056,7 +1057,7 @@ class XendNode:
     def xeninfo_dict(self):
         return dict(self.xeninfo())
     def physinfo_dict(self):
-        return dict(self.physinfo())
+        return dict(self.physinfo(1))
     def info_dict(self):
         return dict(self.info())
 
diff -r fddff17c7c74 -r 2c2591185f8c tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py       Thu Apr 15 13:06:48 2010 +0100
+++ b/tools/python/xen/xm/main.py       Thu Apr 15 13:16:17 2010 +0100
@@ -145,7 +145,8 @@ SUBCOMMAND_HELP = {
     'domname'     : ('<DomId>', 'Convert a domain id to domain name.'),
     'dump-core'   : ('[-L|--live] [-C|--crash] [-R|--reset] <Domain> 
[Filename]',
                      'Dump core for a specific domain.'),
-    'info'        : ('[-c|--config]', 'Get information about Xen host.'),
+    'info'        : ('[-c|--config] [-n|--numa]',
+                     'Get information about Xen host.'),
     'log'         : ('', 'Print Xend log'),
     'rename'      : ('<Domain> <NewDomainName>', 'Rename a domain.'),
     'sched-sedf'  : ('<Domain> [options]', 'Get/set EDF parameters.'),
@@ -326,6 +327,7 @@ SUBCOMMAND_OPTIONS = {
     ),
     'info': (
        ('-c', '--config', 'List Xend configuration parameters'),
+       ('-n', '--numa', 'List host NUMA topology information'),
     ),
     'tmem-list': (
        ('-l', '--long', 'List tmem stats.'),
@@ -1825,15 +1827,18 @@ def xm_info(args):
     arg_check(args, "info", 0, 1)
     
     try:
-        (options, params) = getopt.gnu_getopt(args, 'c', ['config'])
+        (options, params) = getopt.gnu_getopt(args, 'cn', ['config','numa'])
     except getopt.GetoptError, opterr:
         err(opterr)
         usage('info')
     
     show_xend_config = 0
+    show_numa_topology = 0
     for (k, v) in options:
         if k in ['-c', '--config']:
             show_xend_config = 1
+        if k in ['-n', '--numa']:
+            show_numa_topology = 1
 
     if show_xend_config:
         for name, obj in inspect.getmembers(xoptions):
@@ -1920,7 +1925,7 @@ def xm_info(args):
         for (k, v) in sorted:
            print "%-23s:" % k, v 
     else:
-        info = server.xend.node.info()
+        info = server.xend.node.info(show_numa_topology)
         for x in info[1:]:
             if len(x) < 2: 
                 print "%-23s: (none)" % x[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®.