ia64/xen-unstable

view tools/python/xen/sv/NodeInfo.py @ 2811:e8b8a82f02dc

bitkeeper revision 1.1159.1.323 (41865bea-zvfI1kDKtGOrETptgs3JQ)

Merge ssh://srg//auto/groups/xeno/BK/xeno.bk
into equilibrium.research:/home/irchomes/mwilli2/xeno-docs.bk
author mwilli2@equilibrium.research
date Mon Nov 01 15:53:14 2004 +0000 (2004-11-01)
parents 0cc2746cbe19 667064cbe09d
children 0a4b76b6b5a0
line source
1 from xen.xend.XendClient import server
3 from xen.sv.util import *
4 from xen.sv.GenTabbed import *
6 class NodeInfo( GenTabbed ):
8 def __init__( self, urlWriter ):
10 GenTabbed.__init__( self, "Node Details", urlWriter, [ 'General', 'Dmesg', ], [ NodeGeneralTab, NodeDmesgTab ] )
12 def write_MENU( self, request ):
13 request.write( "<p class='small'><a href='%s'>Node details</a></p>" % self.urlWriter( '' ) )
15 class NodeGeneralTab( CompositeTab ):
16 def __init__( self ):
17 CompositeTab.__init__( self, [ NodeInfoTab, NodeActionTab ] )
19 class NodeInfoTab( GeneralTab ):
21 def __init__( self ):
23 nodeInfo = {}
24 try:
25 nodeInfo = sxp2hash( server.xend_node() )
26 except:
27 nodeInfo[ 'system' ] = 'Error getting node info'
29 dictTitles = {}
30 dictTitles[ 'System' ] = 'system'
31 dictTitles[ 'Hostname' ] = 'host'
32 dictTitles[ 'Release' ] = 'release'
33 dictTitles[ 'Version' ] ='version'
34 dictTitles[ 'Machine' ] = 'machine'
35 dictTitles[ 'Cores' ] = 'cores'
36 dictTitles[ 'Hyperthreading' ] = ( 'hyperthreads_per_core', hyperthreadFormatter )
37 dictTitles[ 'CPU Speed' ] = ( 'cpu_mhz', cpuFormatter )
38 dictTitles[ 'Memory' ] = ( 'memory', memoryFormatter )
39 dictTitles[ 'Free Memory' ] = ( 'free_memory', memoryFormatter )
41 GeneralTab.__init__( self, dict=nodeInfo, titles=dictTitles )
43 class NodeDmesgTab( PreTab ):
45 def __init__( self ):
46 try:
47 dmesg = server.xend_node_get_dmesg()
48 except:
49 dmesg = "Error getting node information: XenD not running?"
50 PreTab.__init__( self, dmesg )
52 class NodeActionTab( ActionTab ):
54 def __init__( self ):
55 ActionTab.__init__( self, { "shutdown" : ( "Shutdown the Node", "shutdown.png" ),
56 "reboot" : ( "Reboot the Node", "reboot.png" ) } )
58 def op_shutdown( self, request ):
59 print ">NodeShutDown"
60 server.xend_node_shutdown()
62 def op_reboot( self, request ):
63 print ">NodeReboot"
64 server.xend_node_reboot()