ia64/xen-unstable

changeset 1482:74aec78554a4

bitkeeper revision 1.959.1.4 (40d04a87acOb29u-5Y5OxMhHvP2x9g)

Add node physical info.
author mjw@wray-m-3.hpl.hp.com
date Wed Jun 16 13:26:31 2004 +0000 (2004-06-16)
parents 5566ee00e69b
children 2183b086ef7d
files tools/xenmgr/lib/XendNode.py tools/xenmgr/lib/server/SrvNode.py
line diff
     1.1 --- a/tools/xenmgr/lib/XendNode.py	Tue Jun 15 16:52:08 2004 +0000
     1.2 +++ b/tools/xenmgr/lib/XendNode.py	Wed Jun 16 13:26:31 2004 +0000
     1.3 @@ -7,15 +7,9 @@
     1.4  
     1.5  """
     1.6  
     1.7 +import os
     1.8  import Xc
     1.9  
    1.10 -class XendNodeInfo:
    1.11 -    """Node information record.
    1.12 -    """
    1.13 -
    1.14 -    def __init__(self):
    1.15 -        pass
    1.16 -
    1.17  class XendNode:
    1.18  
    1.19      def __init__(self):
    1.20 @@ -45,6 +39,28 @@ class XendNode:
    1.21          #ret = self.xc.rrobin_global_set(slice)
    1.22          return ret
    1.23  
    1.24 +    def info(self):
    1.25 +        return self.nodeinfo() + self.physinfo()
    1.26 +
    1.27 +    def nodeinfo(self):
    1.28 +        (sys, host, rel, ver, mch) = os.uname()
    1.29 +        return [['system',  sys],
    1.30 +                ['host',    host],
    1.31 +                ['release', rel],
    1.32 +                ['version', ver],
    1.33 +                ['machine', mch]]
    1.34 +
    1.35 +    def physinfo(self):
    1.36 +        pinfo = self.xc.physinfo()
    1.37 +        info = [['cores', pinfo['cores']],
    1.38 +                ['hyperthreads_per_core', pinfo['ht_per_core']],
    1.39 +                ['cpu_mhz', pinfo['cpu_khz']/1000],
    1.40 +                ['memory', pinfo['total_pages']/256],
    1.41 +                ['free_memory', pinfo['free_pages']/256]]
    1.42 +        return info
    1.43 +        
    1.44 +        
    1.45 +
    1.46  def instance():
    1.47      global inst
    1.48      try:
     2.1 --- a/tools/xenmgr/lib/server/SrvNode.py	Tue Jun 15 16:52:08 2004 +0000
     2.2 +++ b/tools/xenmgr/lib/server/SrvNode.py	Wed Jun 16 13:26:31 2004 +0000
     2.3 @@ -45,15 +45,10 @@ class SrvNode(SrvDir):
     2.4              self.print_path(req)
     2.5              req.write('<ul>')
     2.6              for d in self.info():
     2.7 -                req.write('<li> %10s: %s' % (d[0], d[1]))
     2.8 +                req.write('<li> %10s: %s' % (d[0], str(d[1])))
     2.9              req.write('</ul>')
    2.10              req.write('</body></html>')
    2.11          return ''
    2.12              
    2.13      def info(self):
    2.14 -        (sys, host, rel, ver, mch) = os.uname()
    2.15 -        return [['system',  sys],
    2.16 -                ['host',    host],
    2.17 -                ['release', rel],
    2.18 -                ['version', ver],
    2.19 -                ['machine', mch]]
    2.20 +        return self.xn.info()