ia64/xen-unstable
changeset 1862:7dfcc8e95495
bitkeeper revision 1.1108.2.16 (40ffbcb9BiiQEdm3tM2wR3kHhi0avQ)
Changed location of sv - http share sits at /var/xen/sv
while python files have been move out of xend
Changed location of sv - http share sits at /var/xen/sv
while python files have been move out of xend
author | tw275@labyrinth.cl.cam.ac.uk |
---|---|
date | Thu Jul 22 13:10:17 2004 +0000 (2004-07-22) |
parents | 24ecbb3a55bb |
children | 9d7d92002457 |
files | .rootkeys tools/Makefile tools/python/setup.py tools/python/xen/sv/DomInfo.py tools/python/xen/sv/DomList.py tools/python/xen/sv/GenTabbed.py tools/python/xen/sv/HTMLBase.py tools/python/xen/sv/Main.py tools/python/xen/sv/NodeInfo.py tools/python/xen/sv/TabView.py tools/python/xen/sv/__init__.py tools/python/xen/sv/util.py tools/python/xen/xend/server/SrvServer.py tools/python/xen/xend/sv/DomInfo.py tools/python/xen/xend/sv/DomList.py tools/python/xen/xend/sv/GenTabbed.py tools/python/xen/xend/sv/HTMLBase.py tools/python/xen/xend/sv/Main.py tools/python/xen/xend/sv/Main.rpy tools/python/xen/xend/sv/NodeInfo.py tools/python/xen/xend/sv/TabView.py tools/python/xen/xend/sv/XendClientDeferred.py tools/python/xen/xend/sv/__init__.py tools/python/xen/xend/sv/images/internet copy.jpg tools/python/xen/xend/sv/images/internet.jpg tools/python/xen/xend/sv/images/internet.psd tools/python/xen/xend/sv/images/left-end-highlight.jpg tools/python/xen/xend/sv/images/left-end-no-highlight.jpg tools/python/xen/xend/sv/images/middle-highlight.jpg tools/python/xen/xend/sv/images/middle-no-highlight.jpg tools/python/xen/xend/sv/images/orb_01.jpg tools/python/xen/xend/sv/images/orb_02.jpg tools/python/xen/xend/sv/images/right-end-highlight.jpg tools/python/xen/xend/sv/images/right-end-no-highlight.jpg tools/python/xen/xend/sv/images/seperator-left-highlight.jpg tools/python/xen/xend/sv/images/seperator-right-highlight.jpg tools/python/xen/xend/sv/images/seperator.jpg tools/python/xen/xend/sv/images/xen.png tools/python/xen/xend/sv/inc/style.css tools/python/xen/xend/sv/util.py tools/sv/Main.rpy tools/sv/Makefile tools/sv/images/left-end-highlight.jpg tools/sv/images/left-end-no-highlight.jpg tools/sv/images/middle-highlight.jpg tools/sv/images/middle-no-highlight.jpg tools/sv/images/orb_01.jpg tools/sv/images/orb_02.jpg tools/sv/images/right-end-highlight.jpg tools/sv/images/right-end-no-highlight.jpg tools/sv/images/seperator-left-highlight.jpg tools/sv/images/seperator-right-highlight.jpg tools/sv/images/seperator.jpg tools/sv/images/xen.png tools/sv/inc/style.css |
line diff
1.1 --- a/.rootkeys Thu Jul 22 03:26:52 2004 +0000 1.2 +++ b/.rootkeys Thu Jul 22 13:10:17 2004 +0000 1.3 @@ -318,6 +318,15 @@ 3fbd0a42l40lM0IICw2jXbQBVZSdZg tools/pyt 1.4 40dc4076St6AmPTmQPrtQ6LGHPxGmw tools/python/xen/lowlevel/xu/__init__.py 1.5 40dc4076pVeE1kEEWzcUaNZin65kCA tools/python/xen/lowlevel/xu/domain_controller.h 1.6 40dc4076CwBYRTUQDdbdU1L6KcLgSw tools/python/xen/lowlevel/xu/xu.c 1.7 +40fcefb2qm13BbRZBydAatOavaS0fQ tools/python/xen/sv/DomInfo.py 1.8 +40fcefb2-RIU8GB67mJMRzybME9bxw tools/python/xen/sv/DomList.py 1.9 +40fcefb23FfQn-ZBCbcHqA0cPGqQxw tools/python/xen/sv/GenTabbed.py 1.10 +40fcefb2QZAn3u3sX-M7NXBjOv5HGg tools/python/xen/sv/HTMLBase.py 1.11 +40fcefb2vnfDbl4w_yCTedROPuqs0g tools/python/xen/sv/Main.py 1.12 +40fcefb24h-04WaHag-Tg4nxWPhTig tools/python/xen/sv/NodeInfo.py 1.13 +40fcefb2Sif__6AqrANeBQZZfvP-6w tools/python/xen/sv/TabView.py 1.14 +40fcefb2DqteqCCZYDCvvh4Q5jBd0w tools/python/xen/sv/__init__.py 1.15 +40fcefb4rnaZNjqsBu7A5V2rlLyqRw tools/python/xen/sv/util.py 1.16 40d8915cyoVA0hJxiBFNymL7YvDaRg tools/python/xen/util/Brctl.py 1.17 40dfd40aGqGkiopOOgJxSF4iCbHM0Q tools/python/xen/util/__init__.py 1.18 4055ee4dwy4l0MghZosxoiu6zmhc9Q tools/python/xen/util/console_client.py 1.19 @@ -365,33 +374,6 @@ 40d83983OXjt-y3HjSCcuoPp9rzvmw tools/pyt 1.20 40c9c469yrm31i60pGKslTi2Zgpotg tools/python/xen/xend/server/messages.py 1.21 40c9c46925x-Rjb0Cv2f1-l2jZrPYg tools/python/xen/xend/server/netif.py 1.22 40c9c469ZqILEQ8x6yWy0_51jopiCg tools/python/xen/xend/server/params.py 1.23 -40fcefb2qm13BbRZBydAatOavaS0fQ tools/python/xen/xend/sv/DomInfo.py 1.24 -40fcefb2-RIU8GB67mJMRzybME9bxw tools/python/xen/xend/sv/DomList.py 1.25 -40fcefb23FfQn-ZBCbcHqA0cPGqQxw tools/python/xen/xend/sv/GenTabbed.py 1.26 -40fcefb2QZAn3u3sX-M7NXBjOv5HGg tools/python/xen/xend/sv/HTMLBase.py 1.27 -40fcefb2vnfDbl4w_yCTedROPuqs0g tools/python/xen/xend/sv/Main.py 1.28 -40fcefb2K1xqVVT4D-p7nL2GzS4scg tools/python/xen/xend/sv/Main.rpy 1.29 -40fcefb24h-04WaHag-Tg4nxWPhTig tools/python/xen/xend/sv/NodeInfo.py 1.30 -40fcefb2Sif__6AqrANeBQZZfvP-6w tools/python/xen/xend/sv/TabView.py 1.31 -40fcefb23s0sQlDfl4sPP0Un8oZGhg tools/python/xen/xend/sv/XendClientDeferred.py 1.32 -40fcefb2DqteqCCZYDCvvh4Q5jBd0w tools/python/xen/xend/sv/__init__.py 1.33 -40fcefb2Nhe-sT74KBB_3mYQg9Dl4Q tools/python/xen/xend/sv/images/internet copy.jpg 1.34 -40fcefb2QmVa4xdjdnSTXEdF2fZCDA tools/python/xen/xend/sv/images/internet.jpg 1.35 -40fcefb2g8Ez5jJIPHGN_KX7GtxV4w tools/python/xen/xend/sv/images/internet.psd 1.36 -40fcefb3wXQMsl9WkgQAVtdrupm4sw tools/python/xen/xend/sv/images/left-end-highlight.jpg 1.37 -40fcefb3K6ESt5sQhD9aCQRscQIlXQ tools/python/xen/xend/sv/images/left-end-no-highlight.jpg 1.38 -40fcefb3BUT98zPzW8kAFKuxGdh4XA tools/python/xen/xend/sv/images/middle-highlight.jpg 1.39 -40fcefb38OTgsUKHBpwshLLIsiIaCA tools/python/xen/xend/sv/images/middle-no-highlight.jpg 1.40 -40fcefb32SPtrw36c4S6YGFlLvkKuw tools/python/xen/xend/sv/images/orb_01.jpg 1.41 -40fcefb3Ok5qkX3iM7ZEPVkRInrUpg tools/python/xen/xend/sv/images/orb_02.jpg 1.42 -40fcefb3JnT5XeKTuVF4yUMGOtuNZg tools/python/xen/xend/sv/images/right-end-highlight.jpg 1.43 -40fcefb3-DuYOS7noo2W7b_0p7TOUg tools/python/xen/xend/sv/images/right-end-no-highlight.jpg 1.44 -40fcefb3qNbAZR5FYGPAZ9sFPVMTDA tools/python/xen/xend/sv/images/seperator-left-highlight.jpg 1.45 -40fcefb3dgsa24WLk_BJeYQHrDLuOg tools/python/xen/xend/sv/images/seperator-right-highlight.jpg 1.46 -40fcefb3FtiX4Pd2kT8wDlp8u8xRhQ tools/python/xen/xend/sv/images/seperator.jpg 1.47 -40fcefb3yMSrZvApO9ToIi-iQwnchA tools/python/xen/xend/sv/images/xen.png 1.48 -40fcefb3zGC9XNBkSwTEobCoq8YClA tools/python/xen/xend/sv/inc/style.css 1.49 -40fcefb4rnaZNjqsBu7A5V2rlLyqRw tools/python/xen/xend/sv/util.py 1.50 40c9c469LNxLVizOUpOjEaTKKCm8Aw tools/python/xen/xend/sxp.py 1.51 40d05079aFRp6NQdo5wIh5Ly31c0cg tools/python/xen/xm/__init__.py 1.52 40cf2937gKQcATgXKGtNeWb1PDH5nA tools/python/xen/xm/create.py 1.53 @@ -400,6 +382,21 @@ 40e41cd2w0I4En6qrJn4em8HkK_oxQ tools/pyt 1.54 40cf2937isyS250zyd0Q2GuEDoNXfQ tools/python/xen/xm/main.py 1.55 40cf2937PSslwBliN1g7ofDy2H_RhA tools/python/xen/xm/opts.py 1.56 40cf2937Z8WCNOnO2FcWdubvEAF9QQ tools/python/xen/xm/shutdown.py 1.57 +40fcefb2K1xqVVT4D-p7nL2GzS4scg tools/sv/Main.rpy 1.58 +40ffbcb66Dj5F-1kCK9BcgSqCWkt1w tools/sv/Makefile 1.59 +40fcefb3wXQMsl9WkgQAVtdrupm4sw tools/sv/images/left-end-highlight.jpg 1.60 +40fcefb3K6ESt5sQhD9aCQRscQIlXQ tools/sv/images/left-end-no-highlight.jpg 1.61 +40fcefb3BUT98zPzW8kAFKuxGdh4XA tools/sv/images/middle-highlight.jpg 1.62 +40fcefb38OTgsUKHBpwshLLIsiIaCA tools/sv/images/middle-no-highlight.jpg 1.63 +40fcefb32SPtrw36c4S6YGFlLvkKuw tools/sv/images/orb_01.jpg 1.64 +40fcefb3Ok5qkX3iM7ZEPVkRInrUpg tools/sv/images/orb_02.jpg 1.65 +40fcefb3JnT5XeKTuVF4yUMGOtuNZg tools/sv/images/right-end-highlight.jpg 1.66 +40fcefb3-DuYOS7noo2W7b_0p7TOUg tools/sv/images/right-end-no-highlight.jpg 1.67 +40fcefb3qNbAZR5FYGPAZ9sFPVMTDA tools/sv/images/seperator-left-highlight.jpg 1.68 +40fcefb3dgsa24WLk_BJeYQHrDLuOg tools/sv/images/seperator-right-highlight.jpg 1.69 +40fcefb3FtiX4Pd2kT8wDlp8u8xRhQ tools/sv/images/seperator.jpg 1.70 +40fcefb3yMSrZvApO9ToIi-iQwnchA tools/sv/images/xen.png 1.71 +40fcefb3zGC9XNBkSwTEobCoq8YClA tools/sv/inc/style.css 1.72 403a3edbrr8RE34gkbR40zep98SXbg tools/xentrace/Makefile 1.73 40a107afN60pFdURgBv9KwEzgRl5mQ tools/xentrace/formats 1.74 4050c413PhhLNAYk3TEwP37i_iLw9Q tools/xentrace/xentrace.8
2.1 --- a/tools/Makefile Thu Jul 22 03:26:52 2004 +0000 2.2 +++ b/tools/Makefile Thu Jul 22 13:10:17 2004 +0000 2.3 @@ -16,6 +16,7 @@ install: all 2.4 $(MAKE) -C xentrace install 2.5 $(MAKE) -C python install 2.6 $(MAKE) -C xfrd install 2.7 + $(MAKE) -C sv install 2.8 2.9 dist: $(TARGET) 2.10 $(MAKE) prefix=`pwd`/../../install dist=yes install
3.1 --- a/tools/python/setup.py Thu Jul 22 03:26:52 2004 +0000 3.2 +++ b/tools/python/setup.py Thu Jul 22 13:10:17 2004 +0000 3.3 @@ -41,7 +41,7 @@ setup(name = 'xen', 3.4 'xen.util', 3.5 'xen.xend', 3.6 'xen.xend.server', 3.7 - 'xen.xend.sv', 3.8 + 'xen.sv', 3.9 'xen.xm', 3.10 ], 3.11 ext_package = "xen.lowlevel",
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/tools/python/xen/sv/DomInfo.py Thu Jul 22 13:10:17 2004 +0000 4.3 @@ -0,0 +1,99 @@ 4.4 +from HTMLBase import HTMLBase 4.5 +from XendClientDeferred import server 4.6 +from xen.xend import PrettyPrint 4.7 + 4.8 +from xen.sv.util import * 4.9 +from xen.sv.GenTabbed import * 4.10 + 4.11 +class DomInfo( GenTabbed ): 4.12 + 4.13 + def __init__( self, urlWriter, callback ): 4.14 + 4.15 + self.dom = 0; 4.16 + 4.17 + def tabUrlWriter( tab ): 4.18 + return urlWriter( "mod=info&dom=%s%s" % ( self.dom, tab ) ) 4.19 + 4.20 + GenTabbed.__init__( self, tabUrlWriter, [ 'General', 'SXP', 'Devices' ], [ DomGenTab, DomSXPTab, NullTab ], callback ) 4.21 + 4.22 + def write_BODY( self, request ): 4.23 + dom = request.args.get('dom') 4.24 + 4.25 + if dom is None or len(dom) != 1: 4.26 + request.write( "<p>Please Select a Domain</p>" ) 4.27 + return None 4.28 + else: 4.29 + self.dom = dom[0] 4.30 + 4.31 + GenTabbed.write_BODY( self, request ) 4.32 + 4.33 +class DomGenTab( GeneralTab ): 4.34 + 4.35 + def __init__( self ): 4.36 + 4.37 + titles = {} 4.38 + 4.39 + titles[ 'ID' ] = 'dom' 4.40 + titles[ 'Name' ] = 'name' 4.41 + titles[ 'CPU' ] = 'cpu' 4.42 + titles[ 'Memory' ] = ( 'mem', memoryFormatter ) 4.43 + titles[ 'State' ] = ( 'state', stateFormatter ) 4.44 + titles[ 'Total CPU' ] = ( 'cpu_time', smallTimeFormatter ) 4.45 + titles[ 'Up Time' ] = ( 'up_time', bigTimeFormatter ) 4.46 + 4.47 + GeneralTab.__init__( self, "General Domain Info", {}, titles ) 4.48 + 4.49 + def write_BODY( self, request, callback ): 4.50 + dom = request.args.get('dom') 4.51 + 4.52 + if dom is None or len(dom) != 1: 4.53 + request.write( "<p>Please Select a Domain</p>" ) 4.54 + return None 4.55 + else: 4.56 + self.dom = dom[0] 4.57 + 4.58 + deferred = getDomInfoHash( self.dom ) 4.59 + deferred.addCallback( self.continue_BODY, request, callback ) 4.60 + 4.61 + def continue_BODY( self, dict, request, callback ): 4.62 + 4.63 + self.dict = dict 4.64 + 4.65 + GeneralTab.write_BODY( self, request, callback ) 4.66 + 4.67 +class DomSXPTab( PreTab ): 4.68 + 4.69 + def __init__( self ): 4.70 + self.dom = 0 4.71 + PreTab.__init__( self, "" ) 4.72 + 4.73 + def fn( self, x, request ): 4.74 + class tmp: 4.75 + def __init__( self ): 4.76 + self.str = "" 4.77 + def write( self, str ): 4.78 + self.str = self.str + str 4.79 + temp = tmp() 4.80 + PrettyPrint.prettyprint( x, out=temp ) 4.81 + self.source = temp.str 4.82 + return request 4.83 + 4.84 + def fn2( self, request, callback ): 4.85 + PreTab.write_BODY( self, request, callback ) 4.86 + 4.87 + def write_BODY( self, request, callback ): 4.88 + dom = request.args.get('dom') 4.89 + 4.90 + if dom is None or len(dom) != 1: 4.91 + request.write( "<p>Please Select a Domain</p>" ) 4.92 + return None 4.93 + else: 4.94 + self.dom = dom[0] 4.95 + 4.96 + deferred = server.xend_domain( self.dom ) 4.97 + 4.98 + deferred.addCallback( self.fn, request ) 4.99 + deferred.addCallback( self.fn2, callback ) 4.100 + def errback( x ): 4.101 + print ">err ", x 4.102 + deferred.addErrback( errback )
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 5.2 +++ b/tools/python/xen/sv/DomList.py Thu Jul 22 13:10:17 2004 +0000 5.3 @@ -0,0 +1,101 @@ 5.4 +from twisted.web import resource 5.5 +from twisted.web.server import NOT_DONE_YET 5.6 + 5.7 +from xen.xend.XendClient import server as XendServer 5.8 +from xen.xend import sxp 5.9 + 5.10 +from xen.sv.HTMLBase import HTMLBase 5.11 +from xen.sv.util import * 5.12 + 5.13 +from twisted.internet import reactor 5.14 + 5.15 +class DomList( HTMLBase ): 5.16 + 5.17 + isLeaf = True 5.18 + 5.19 + def __init__( self, urlWriter, callback ): 5.20 + HTMLBase.__init__(self) 5.21 + self.urlWriter = urlWriter 5.22 + self.head = None 5.23 + self.long = None 5.24 + self.rendered_domains = {} 5.25 + self.domCount = 0 5.26 + self.callback = callback 5.27 + 5.28 + def write_BODY( self, request, head=True, long=True ): 5.29 + deferred = XendServer.xend_domains() 5.30 + deferred.addCallback( self.get_domain_info, request ) 5.31 + deferred.addErrback( self.errback ) 5.32 + 5.33 + self.head = head 5.34 + self.long = long 5.35 + 5.36 + def errback( self, err ): 5.37 + print 'errback>', err 5.38 + 5.39 + def get_domain_info( self, domains, request ): 5.40 + 5.41 + self.domCount = len( domains ) 5.42 + 5.43 + for domain in domains: 5.44 + deferred = getDomInfoHash( domain ) 5.45 + deferred.addCallback( self.render_domain, request ) 5.46 + deferred.addErrback( self.errback ) 5.47 + 5.48 + def render_domain( self, domInfoHash, request ): 5.49 + 5.50 + domStr = "<td class='domainInfo' align='center'>%(dom)-4d</td>\n" % domInfoHash 5.51 + 5.52 + url = self.urlWriter( "mod=info&dom=%(dom)-4d" % domInfoHash ) 5.53 + 5.54 + domStr += "<td class='domainInfo' align='center'><a href='%s'>%s</a></td>\n" % ( url, domInfoHash['name'] ) 5.55 + 5.56 + if self.long: 5.57 + domStr += "<td class='domainInfo' align='center'>%(mem)7d</td>\n" % domInfoHash 5.58 + domStr += "<td class='domainInfo' align='center'>%(cpu)3d</td>\n" % domInfoHash 5.59 + 5.60 + domStr += "<td class='domainInfo' align='center'>%(state)5s</td>\n" % domInfoHash 5.61 + 5.62 + if self.long: 5.63 + domStr += "<td class='domainInfo' align='center'>%(cpu_time)7.1f</td>\n" % domInfoHash 5.64 + 5.65 + self.rendered_domains[ domInfoHash[ 'dom' ] ] = domStr 5.66 + self.domCount -= 1 5.67 + 5.68 + if self.domCount == 0: 5.69 + self.finish_write_BODY( request ) 5.70 + 5.71 + def finish_write_BODY( self, request ): 5.72 + 5.73 + request.write( "\n<table style='border:0px solid white' cellspacing='0' cellpadding='0' border='0' width='100%'>\n" ) 5.74 + 5.75 + if self.head: 5.76 + request.write( "<tr class='domainInfoHead'>" ) 5.77 + self.write_DOMAIN_HEAD( request, self.long ) 5.78 + request.write( "</tr>" ) 5.79 + 5.80 + odd = True 5.81 + for domain in self.rendered_domains.values(): 5.82 + if odd: 5.83 + request.write( "<tr class='domainInfoOdd'>\n" ) 5.84 + odd = False 5.85 + else: 5.86 + request.write( "<tr class='domainInfoEven'>\n" ) 5.87 + odd = True 5.88 + request.write( domain ) 5.89 + request.write( "</tr>\n" ) 5.90 + 5.91 + request.write( "</table>\n" ) 5.92 + 5.93 + self.callback( request ) 5.94 + 5.95 + def write_DOMAIN_HEAD( self, request, long=True ): 5.96 + request.write( "<td class='domainInfoHead' align='center'>Domain</td>\n" ) 5.97 + request.write( "<td class='domainInfoHead' align='center'>Name</td>\n" ) 5.98 + if long: 5.99 + request.write( "<td class='domainInfoHead' align='center'>Memory / Mb</td>\n" ) 5.100 + request.write( "<td class='domainInfoHead' align='center'>CPU</td>\n" ) 5.101 + request.write( "<td class='domainInfoHead' align='center'>State</td>\n" ) 5.102 + if long: 5.103 + request.write( "<td class='domainInfoHead' align='center'>CPU time / s</td>\n" ) 5.104 +
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 6.2 +++ b/tools/python/xen/sv/GenTabbed.py Thu Jul 22 13:10:17 2004 +0000 6.3 @@ -0,0 +1,103 @@ 6.4 +import types 6.5 + 6.6 +from xen.sv.HTMLBase import HTMLBase 6.7 +from xen.sv.TabView import TabView 6.8 + 6.9 +class GenTabbed( HTMLBase ): 6.10 + 6.11 + def __init__( self, urlWriter, tabStrings, tabObjects, callback ): 6.12 + HTMLBase.__init__(self) 6.13 + self.tab = 0; 6.14 + self.tabStrings = tabStrings 6.15 + self.tabObjects = tabObjects 6.16 + self.urlWriter = urlWriter 6.17 + self.callback = callback 6.18 + 6.19 + def write_BODY( self, request, urlWriter = None ): 6.20 + tab = request.args.get('tab') 6.21 + 6.22 + if tab is None or len( tab) != 1: 6.23 + self.tab = 0 6.24 + else: 6.25 + self.tab = int( tab[0] ) 6.26 + 6.27 + request.write( "<table style='' width='100%' border='0' cellspacing='0' cellpadding='0'>" ) 6.28 + request.write( "<tr><td>" ) 6.29 + 6.30 + TabView( self.tab, self.tabStrings, self.urlWriter ).write_BODY( request ) 6.31 + 6.32 + request.write( "</td></tr><tr><td>" ) 6.33 + 6.34 + render_tab = self.tabObjects[ self.tab ]() 6.35 + 6.36 + if render_tab is None: 6.37 + request.write( "<p>Bad Tab</p>" ) 6.38 + self.finish_BODY( request ) 6.39 + else: 6.40 + render_tab.write_BODY( request, self.finish_BODY ) 6.41 + 6.42 + def finish_BODY( self, request ): 6.43 + 6.44 + request.write( "</td></tr></table>" ) 6.45 + 6.46 + self.callback( request ) 6.47 + 6.48 +class PreTab( HTMLBase ): 6.49 + 6.50 + def __init__( self, source ): 6.51 + HTMLBase.__init__( self ) 6.52 + self.source = source 6.53 + 6.54 + def write_BODY( self, request, callback ): 6.55 + 6.56 + request.write( "<div style='display: block; overflow: auto; border: 0px solid black; height: 400px; width: 540px; padding: 5px; z-index:0; align: center'><pre>" ) 6.57 + 6.58 + request.write( self.source ) 6.59 + 6.60 + request.write( "</pre></div>" ) 6.61 + 6.62 + callback( request ) 6.63 + 6.64 +class GeneralTab( HTMLBase ): 6.65 + 6.66 + def __init__( self, title, dict, titles ): 6.67 + HTMLBase.__init__( self ) 6.68 + self.title = title 6.69 + self.dict = dict 6.70 + self.titles = titles 6.71 + 6.72 + def write_BODY( self, request, callback ): 6.73 + 6.74 + request.write( "<p><u>%s</u></p>" % self.title ) 6.75 + 6.76 + request.write( "<table width='100%' cellspacing='0' cellpadding='0' border='0'>" ) 6.77 + 6.78 + def writeAttr( niceName, attr, formatter=None ): 6.79 + if type( attr ) is types.TupleType: 6.80 + ( attr, formatter ) = attr 6.81 + 6.82 + if attr in self.dict: 6.83 + if formatter: 6.84 + temp = formatter( self.dict[ attr ] ) 6.85 + else: 6.86 + temp = str( self.dict[ attr ] ) 6.87 + request.write( "<tr><td width='50%%'><p>%s:</p></td><td width='50%%'><p>%s</p></td></tr>" % ( niceName, temp ) ) 6.88 + 6.89 + for niceName, attr in self.titles.items(): 6.90 + writeAttr( niceName, attr ) 6.91 + 6.92 + request.write( "</table>" ) 6.93 + 6.94 + callback( request ) 6.95 + 6.96 +class NullTab( HTMLBase ): 6.97 + 6.98 + def __init__( self ): 6.99 + HTMLBase.__init__( self ) 6.100 + self.title = "Null Tab" 6.101 + 6.102 + def write_BODY( self, request, callback ): 6.103 + request.write( "<p>%s</p>" % self.title ) 6.104 + callback( request ) 6.105 + 6.106 +
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 7.2 +++ b/tools/python/xen/sv/HTMLBase.py Thu Jul 22 13:10:17 2004 +0000 7.3 @@ -0,0 +1,27 @@ 7.4 +from twisted.web import server, resource 7.5 +from twisted.internet import reactor 7.6 + 7.7 +class HTMLBase( resource.Resource ): 7.8 + 7.9 + isLeaf = True 7.10 + 7.11 + def __init__( self ): 7.12 + resource.Resource.__init__(self) 7.13 + 7.14 + def render_GET( self, request ): 7.15 + self.write_TOP( request ) 7.16 + return self.write_BODY( request, self.finish_render_GET ) 7.17 + 7.18 + def finish_render_GET( self, request ): 7.19 + self.write_BOTTOM( request ) 7.20 + request.finish() 7.21 + 7.22 + def write_BODY( self, request ): 7.23 + request.write( "BODY" ) 7.24 + 7.25 + def write_TOP( self, request ): 7.26 + request.write( '<html><head><title>Xen</title><link rel="stylesheet" type="text/css" href="inc/style.css" />' ) 7.27 + request.write( '</head><body>' ) 7.28 + 7.29 + def write_BOTTOM( self, request ): 7.30 + request.write( "</body></html>" ) 7.31 \ No newline at end of file
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 8.2 +++ b/tools/python/xen/sv/Main.py Thu Jul 22 13:10:17 2004 +0000 8.3 @@ -0,0 +1,81 @@ 8.4 +from twisted.web import resource 8.5 +from twisted.web.server import NOT_DONE_YET 8.6 + 8.7 +from xen.xend.XendClient import server as XendServer 8.8 +from xen.xend import sxp 8.9 + 8.10 +from HTMLBase import HTMLBase 8.11 + 8.12 +from xen.sv import DomList, NodeInfo, DomInfo 8.13 + 8.14 +class Main( HTMLBase ): 8.15 + 8.16 + isLeaf = True 8.17 + 8.18 + def __init__( self ): 8.19 + HTMLBase.__init__(self) 8.20 + 8.21 + def render_POST( self, request ): 8.22 + return self.render_GET( request ) 8.23 + 8.24 + def mainUrlWriter( self, s ): 8.25 + return "Main.rpy?%s" % s 8.26 + 8.27 + def write_BODY( self, request, callback ): 8.28 + 8.29 + self.callback = callback 8.30 + 8.31 + request.write( "\n<table style='border:0px solid black; background: url(images/orb_01.jpg) no-repeat' cellspacing='0' cellpadding='0' border='0' width='780px' height='536px'>\n" ) 8.32 + request.write( "<tr>\n" ) 8.33 + request.write( " <td width='15px'> </td>" ) 8.34 + request.write( " <td width='175px' align='center' valign'center'>" ) 8.35 + request.write( " <table cellspacing='0' cellpadding='0' border='0' width='100%' height='100%'>" ) 8.36 + request.write( " <tr><td height='200px' align='center' valign='center'><a href='http://www.cl.cam.ac.uk/Research/SRG/netos/xen/'>" ) 8.37 + request.write( " <img src='images/xen.png' width='150' height='75' border='0'/></a></td></tr>" ) 8.38 + request.write( " <tr><td align='center' valign='top'>" ) 8.39 + 8.40 + request.write( " <p class='small'><a href='Main.rpy?mod=node'>Node details</a></p>" ) 8.41 + request.write( " <p class='small'><a href='Main.rpy?mod=list'>Domains summary</a></p>" ) 8.42 + 8.43 + DomList.DomList( self.mainUrlWriter, self.continue_BODY ).write_BODY( request, True, False ) 8.44 + 8.45 + return NOT_DONE_YET 8.46 + 8.47 + def continue_BODY( self, request ): 8.48 + request.write( " </td></tr>" ) 8.49 + request.write( " </table>" ) 8.50 + request.write( " " ) 8.51 + request.write( " </td>\n" ) 8.52 + request.write( " <td width='15px'> </td>" ) 8.53 + request.write( " <td width='558px' align='left' valign='top'>" ) 8.54 + request.write( " <table cellspacing='0' cellpadding='0' border='0' width='100%' height='100%'>" ) 8.55 + request.write( " <tr><td height='20px'></td></tr>" ) 8.56 + request.write( " <tr><td align='center' valign='top'>" ) 8.57 + 8.58 + mod = request.args.get('mod') 8.59 + 8.60 + if mod is None or len(mod) != 1: 8.61 + request.write( '<p>Please select a module</p>' ) 8.62 + self.finish_BODY( request ) 8.63 + elif mod[0] == 'info': 8.64 + DomInfo.DomInfo( self.mainUrlWriter, self.finish_BODY ).write_BODY( request ) 8.65 + elif mod[0] == 'list': 8.66 + DomList.DomList( self.mainUrlWriter, self.finish_BODY ).write_BODY( request ) 8.67 + elif mod[0] == 'node': 8.68 + NodeInfo.NodeInfo( self.mainUrlWriter, self.finish_BODY ).write_BODY( request ) 8.69 + else: 8.70 + request.write( '<p>Invalid module. Please select another</p>' ) 8.71 + self.finish_BODY( request ) 8.72 + 8.73 + def finish_BODY( self, request ): 8.74 + 8.75 + request.write( " </td></tr>" ) 8.76 + request.write( " </table>" ) 8.77 + request.write( " </td>\n" ) 8.78 + request.write( " <td width='17px'> </td>" ) 8.79 + request.write( "</tr>\n" ) 8.80 + 8.81 + request.write( "</table>\n" ) 8.82 + 8.83 + self.callback( request ) 8.84 +
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 9.2 +++ b/tools/python/xen/sv/NodeInfo.py Thu Jul 22 13:10:17 2004 +0000 9.3 @@ -0,0 +1,47 @@ 9.4 +from xen.xend import XendDmesg 9.5 +from xen.xend import XendNode 9.6 + 9.7 +from xen.sv.util import * 9.8 +from xen.sv.GenTabbed import * 9.9 +from xen.sv.HTMLBase import HTMLBase 9.10 + 9.11 +class NodeInfo( GenTabbed ): 9.12 + 9.13 + def __init__( self, urlWriter, callback ): 9.14 + 9.15 + def newUrlWriter( url ): 9.16 + return urlWriter( "mod=node%s" % url ) 9.17 + 9.18 + GenTabbed.__init__( self, newUrlWriter, [ 'General', 'Dmesg' ], [ NodeGeneralTab, NodeDmesgTab ], callback ) 9.19 + 9.20 +class NodeGeneralTab( GeneralTab ): 9.21 + 9.22 + def __init__( self ): 9.23 + 9.24 + nodeInfo = XendNode.instance().info() 9.25 + 9.26 + dictNodeInfo = {} 9.27 + 9.28 + for l in nodeInfo: 9.29 + dictNodeInfo[ l[0] ] = l[1] 9.30 + 9.31 + dictTitles = {} 9.32 + dictTitles[ 'System' ] = 'system' 9.33 + dictTitles[ 'Hostname' ] = 'host' 9.34 + dictTitles[ 'Release' ] = 'release' 9.35 + dictTitles[ 'Version' ] ='version' 9.36 + dictTitles[ 'Machine' ] = 'machine' 9.37 + dictTitles[ 'Cores' ] = 'cores' 9.38 + dictTitles[ 'Hyperthreading' ] = ( 'hyperthreads_per_core', hyperthreadFormatter ) 9.39 + dictTitles[ 'CPU Speed' ] = ( 'cpu_mhz', cpuFormatter ) 9.40 + dictTitles[ 'Memory' ] = ( 'memory', memoryFormatter ) 9.41 + dictTitles[ 'Free Memory' ] = ( 'free_memory', memoryFormatter ) 9.42 + 9.43 + GeneralTab.__init__( self, title="General Node Info", dict=dictNodeInfo, titles=dictTitles ) 9.44 + 9.45 +class NodeDmesgTab( PreTab ): 9.46 + 9.47 + def __init__( self ): 9.48 + self.xd = XendDmesg.instance() 9.49 + PreTab.__init__( self, self.xd.info()[0] ) 9.50 +
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 10.2 +++ b/tools/python/xen/sv/TabView.py Thu Jul 22 13:10:17 2004 +0000 10.3 @@ -0,0 +1,49 @@ 10.4 +from xen.sv.HTMLBase import HTMLBase 10.5 + 10.6 +class TabView( HTMLBase ): 10.7 + 10.8 + def __init__( self, tab, tabs, urlWriter ): 10.9 + HTMLBase.__init__(self) 10.10 + self.tab = tab # interger - tab id 10.11 + self.tabs = tabs 10.12 + self.urlWriter = urlWriter 10.13 + 10.14 + def write_BODY( self, request ): 10.15 + request.write( "<table style='' border='0' cellspacing='0' cellpadding='0' align='center'>" ) 10.16 + request.write( "<tr height='22'>" ) 10.17 + 10.18 + if self.tab == 0: 10.19 + image = "left-end-highlight.jpg" 10.20 + else: 10.21 + image = "left-end-no-highlight.jpg" 10.22 + 10.23 + request.write( "<td height='22' width='14'><image src='images/%s' width='14' height='22'></td>" % image ) 10.24 + 10.25 + count = len( self.tabs ) 10.26 + 10.27 + for i in range( count ): 10.28 + 10.29 + if i == self.tab: 10.30 + image = "middle-highlight.jpg" 10.31 + else: 10.32 + image = "middle-no-highlight.jpg" 10.33 + 10.34 + request.write( "<td style='background: url(images/%s)'><p align='center'><a href='%s'>%s</a></p></td>" % ( image, self.urlWriter( "&tab=%s" % i ), self.tabs[ i ] ) ) 10.35 + 10.36 + if i < count-1: 10.37 + if i == self.tab: 10.38 + image = "seperator-left-highlight.jpg" 10.39 + elif self.tab == i+1: 10.40 + image = "seperator-right-highlight.jpg" 10.41 + else: 10.42 + image = "seperator.jpg" 10.43 + 10.44 + request.write( "<td height='22' width='23'><image src='images/%s' width='23' height='22'></td>" % image ) 10.45 + 10.46 + if self.tab == count - 1: 10.47 + image = "right-end-highlight.jpg" 10.48 + else: 10.49 + image = "right-end-no-highlight.jpg" 10.50 + 10.51 + request.write( "<td height='22' width='14'><image src='images/%s' width='14' height='22'></td>" % image ) 10.52 + request.write( "</tr></table>" )
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 11.2 +++ b/tools/python/xen/sv/__init__.py Thu Jul 22 13:10:17 2004 +0000 11.3 @@ -0,0 +1,1 @@ 11.4 +
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 12.2 +++ b/tools/python/xen/sv/util.py Thu Jul 22 13:10:17 2004 +0000 12.3 @@ -0,0 +1,64 @@ 12.4 +from xen.xend.XendClient import server 12.5 +from xen.xend import sxp 12.6 + 12.7 +def getDomInfoHash( domain ): 12.8 + deferred = server.xend_domain( int( domain ) ) 12.9 + deferred.addCallback( procDomInfo, domain ) 12.10 + return deferred 12.11 + 12.12 +def procDomInfo( domInfo, domain ): 12.13 + d = {} 12.14 + d['dom'] = int( domain ) 12.15 + d['name'] = sxp.child_value( domInfo, 'name' ) 12.16 + d['mem'] = int( sxp.child_value( domInfo, 'memory' ) ) 12.17 + d['cpu'] = int( sxp.child_value( domInfo, 'cpu' ) ) 12.18 + d['state'] = sxp.child_value( domInfo, 'state' ) 12.19 + d['cpu_time'] = float( sxp.child_value( domInfo, 'cpu_time' ) ) 12.20 + if( sxp.child_value( domInfo, 'up_time' ) ): 12.21 + d['up_time'] = float( sxp.child_value( domInfo, 'up_time' ) ) 12.22 + if( sxp.child_value( domInfo, 'start_time' ) ): 12.23 + d['start_time'] = float( sxp.child_value( domInfo, 'start_time' ) ) 12.24 + return d 12.25 + 12.26 +def bigTimeFormatter( time ): 12.27 + weeks = time // 604800 12.28 + remainder = time % 604800 12.29 + days = remainder // 86400 12.30 + 12.31 + remainder = remainder % 86400 12.32 + 12.33 + hms = smallTimeFormatter( remainder ) 12.34 + 12.35 + return "%d weeks, %d days, %s" % ( weeks, days, hms ) 12.36 + 12.37 +def smallTimeFormatter( time ): 12.38 + hours = time // 3600 12.39 + remainder = time % 3600 12.40 + mins = remainder // 60 12.41 + secs = time % 60 12.42 + return "%02d:%02d:%04.1f (hh:mm:ss.s)" % ( hours, mins, secs ) 12.43 + 12.44 +def stateFormatter( state ): 12.45 + states = [ 'Running', 'Blocked', 'Paused', 'Shutdown', 'Crashed' ] 12.46 + 12.47 + for i in range( len( state ) ): 12.48 + if state[i] != "-": 12.49 + return states[ i ] + " (%s)" % state 12.50 + 12.51 + return state 12.52 + 12.53 +def memoryFormatter( mem ): 12.54 + return "%7dMb" % mem 12.55 + 12.56 +def cpuFormatter( mhz ): 12.57 + if mhz > 1000: 12.58 + ghz = float( mhz ) / 1000.0 12.59 + return "%4.2fGHz" % ghz 12.60 + else: 12.61 + return "%4dMHz" % mhz 12.62 + 12.63 +def hyperthreadFormatter( threads ): 12.64 + if int( threads ) > 1: 12.65 + return "Yes (%d)" % threads 12.66 + else: 12.67 + return "No"
13.1 --- a/tools/python/xen/xend/server/SrvServer.py Thu Jul 22 03:26:52 2004 +0000 13.2 +++ b/tools/python/xen/xend/server/SrvServer.py Thu Jul 22 13:10:17 2004 +0000 13.3 @@ -44,12 +44,8 @@ def create(port=None, interface=None, br 13.4 if bridge or xroot.rebooted: 13.5 Vifctl.network('start') 13.6 root = resource.Resource() 13.7 - sv = static.File( "/usr/lib/python2.2/site-packages/xen/xend/sv/" ) 13.8 - sv.indexNames=['Main.rpy'] 13.9 - sv.processors={'.rpy':script.ResourceScript} 13.10 xend = SrvRoot() 13.11 root.putChild('xend', xend) 13.12 - root.putChild('sv', sv) 13.13 site = server.Site(root) 13.14 reactor.listenTCP(port, site, interface=interface) 13.15
14.1 --- a/tools/python/xen/xend/sv/DomInfo.py Thu Jul 22 03:26:52 2004 +0000 14.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 14.3 @@ -1,99 +0,0 @@ 14.4 -from HTMLBase import HTMLBase 14.5 -from XendClientDeferred import server 14.6 -from xen.xend import PrettyPrint 14.7 - 14.8 -from xen.xend.sv.util import * 14.9 -from xen.xend.sv.GenTabbed import * 14.10 - 14.11 -class DomInfo( GenTabbed ): 14.12 - 14.13 - def __init__( self, urlWriter, callback ): 14.14 - 14.15 - self.dom = 0; 14.16 - 14.17 - def tabUrlWriter( tab ): 14.18 - return urlWriter( "mod=info&dom=%s%s" % ( self.dom, tab ) ) 14.19 - 14.20 - GenTabbed.__init__( self, tabUrlWriter, [ 'General', 'SXP', 'Devices' ], [ DomGenTab, DomSXPTab, NullTab ], callback ) 14.21 - 14.22 - def write_BODY( self, request ): 14.23 - dom = request.args.get('dom') 14.24 - 14.25 - if dom is None or len(dom) != 1: 14.26 - request.write( "<p>Please Select a Domain</p>" ) 14.27 - return None 14.28 - else: 14.29 - self.dom = dom[0] 14.30 - 14.31 - GenTabbed.write_BODY( self, request ) 14.32 - 14.33 -class DomGenTab( GeneralTab ): 14.34 - 14.35 - def __init__( self ): 14.36 - 14.37 - titles = {} 14.38 - 14.39 - titles[ 'ID' ] = 'dom' 14.40 - titles[ 'Name' ] = 'name' 14.41 - titles[ 'CPU' ] = 'cpu' 14.42 - titles[ 'Memory' ] = ( 'mem', memoryFormatter ) 14.43 - titles[ 'State' ] = ( 'state', stateFormatter ) 14.44 - titles[ 'Total CPU' ] = ( 'cpu_time', smallTimeFormatter ) 14.45 - titles[ 'Up Time' ] = ( 'up_time', bigTimeFormatter ) 14.46 - 14.47 - GeneralTab.__init__( self, "General Domain Info", {}, titles ) 14.48 - 14.49 - def write_BODY( self, request, callback ): 14.50 - dom = request.args.get('dom') 14.51 - 14.52 - if dom is None or len(dom) != 1: 14.53 - request.write( "<p>Please Select a Domain</p>" ) 14.54 - return None 14.55 - else: 14.56 - self.dom = dom[0] 14.57 - 14.58 - deferred = getDomInfoHash( self.dom ) 14.59 - deferred.addCallback( self.continue_BODY, request, callback ) 14.60 - 14.61 - def continue_BODY( self, dict, request, callback ): 14.62 - 14.63 - self.dict = dict 14.64 - 14.65 - GeneralTab.write_BODY( self, request, callback ) 14.66 - 14.67 -class DomSXPTab( PreTab ): 14.68 - 14.69 - def __init__( self ): 14.70 - self.dom = 0 14.71 - PreTab.__init__( self, "" ) 14.72 - 14.73 - def fn( self, x, request ): 14.74 - class tmp: 14.75 - def __init__( self ): 14.76 - self.str = "" 14.77 - def write( self, str ): 14.78 - self.str = self.str + str 14.79 - temp = tmp() 14.80 - PrettyPrint.prettyprint( x, out=temp ) 14.81 - self.source = temp.str 14.82 - return request 14.83 - 14.84 - def fn2( self, request, callback ): 14.85 - PreTab.write_BODY( self, request, callback ) 14.86 - 14.87 - def write_BODY( self, request, callback ): 14.88 - dom = request.args.get('dom') 14.89 - 14.90 - if dom is None or len(dom) != 1: 14.91 - request.write( "<p>Please Select a Domain</p>" ) 14.92 - return None 14.93 - else: 14.94 - self.dom = dom[0] 14.95 - 14.96 - deferred = server.xend_domain( self.dom ) 14.97 - 14.98 - deferred.addCallback( self.fn, request ) 14.99 - deferred.addCallback( self.fn2, callback ) 14.100 - def errback( x ): 14.101 - print ">err ", x 14.102 - deferred.addErrback( errback ) 14.103 \ No newline at end of file
15.1 --- a/tools/python/xen/xend/sv/DomList.py Thu Jul 22 03:26:52 2004 +0000 15.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 15.3 @@ -1,101 +0,0 @@ 15.4 -from twisted.web import resource 15.5 -from twisted.web.server import NOT_DONE_YET 15.6 - 15.7 -from XendClientDeferred import server as XendServer 15.8 -from xen.xend import sxp 15.9 - 15.10 -from xen.xend.sv.HTMLBase import HTMLBase 15.11 -from xen.xend.sv.util import * 15.12 - 15.13 -from twisted.internet import reactor 15.14 - 15.15 -class DomList( HTMLBase ): 15.16 - 15.17 - isLeaf = True 15.18 - 15.19 - def __init__( self, urlWriter, callback ): 15.20 - HTMLBase.__init__(self) 15.21 - self.urlWriter = urlWriter 15.22 - self.head = None 15.23 - self.long = None 15.24 - self.rendered_domains = {} 15.25 - self.domCount = 0 15.26 - self.callback = callback 15.27 - 15.28 - def write_BODY( self, request, head=True, long=True ): 15.29 - deferred = XendServer.xend_domains() 15.30 - deferred.addCallback( self.get_domain_info, request ) 15.31 - deferred.addErrback( self.errback ) 15.32 - 15.33 - self.head = head 15.34 - self.long = long 15.35 - 15.36 - def errback( self, err ): 15.37 - print 'errback>', err 15.38 - 15.39 - def get_domain_info( self, domains, request ): 15.40 - 15.41 - self.domCount = len( domains ) 15.42 - 15.43 - for domain in domains: 15.44 - deferred = getDomInfoHash( domain ) 15.45 - deferred.addCallback( self.render_domain, request ) 15.46 - deferred.addErrback( self.errback ) 15.47 - 15.48 - def render_domain( self, domInfoHash, request ): 15.49 - 15.50 - domStr = "<td class='domainInfo' align='center'>%(dom)-4d</td>\n" % domInfoHash 15.51 - 15.52 - url = self.urlWriter( "mod=info&dom=%(dom)-4d" % domInfoHash ) 15.53 - 15.54 - domStr += "<td class='domainInfo' align='center'><a href='%s'>%s</a></td>\n" % ( url, domInfoHash['name'] ) 15.55 - 15.56 - if self.long: 15.57 - domStr += "<td class='domainInfo' align='center'>%(mem)7d</td>\n" % domInfoHash 15.58 - domStr += "<td class='domainInfo' align='center'>%(cpu)3d</td>\n" % domInfoHash 15.59 - 15.60 - domStr += "<td class='domainInfo' align='center'>%(state)5s</td>\n" % domInfoHash 15.61 - 15.62 - if self.long: 15.63 - domStr += "<td class='domainInfo' align='center'>%(cpu_time)7.1f</td>\n" % domInfoHash 15.64 - 15.65 - self.rendered_domains[ domInfoHash[ 'dom' ] ] = domStr 15.66 - self.domCount -= 1 15.67 - 15.68 - if self.domCount == 0: 15.69 - self.finish_write_BODY( request ) 15.70 - 15.71 - def finish_write_BODY( self, request ): 15.72 - 15.73 - request.write( "\n<table style='border:0px solid white' cellspacing='0' cellpadding='0' border='0' width='100%'>\n" ) 15.74 - 15.75 - if self.head: 15.76 - request.write( "<tr class='domainInfoHead'>" ) 15.77 - self.write_DOMAIN_HEAD( request, self.long ) 15.78 - request.write( "</tr>" ) 15.79 - 15.80 - odd = True 15.81 - for domain in self.rendered_domains.values(): 15.82 - if odd: 15.83 - request.write( "<tr class='domainInfoOdd'>\n" ) 15.84 - odd = False 15.85 - else: 15.86 - request.write( "<tr class='domainInfoEven'>\n" ) 15.87 - odd = True 15.88 - request.write( domain ) 15.89 - request.write( "</tr>\n" ) 15.90 - 15.91 - request.write( "</table>\n" ) 15.92 - 15.93 - self.callback( request ) 15.94 - 15.95 - def write_DOMAIN_HEAD( self, request, long=True ): 15.96 - request.write( "<td class='domainInfoHead' align='center'>Domain</td>\n" ) 15.97 - request.write( "<td class='domainInfoHead' align='center'>Name</td>\n" ) 15.98 - if long: 15.99 - request.write( "<td class='domainInfoHead' align='center'>Memory / Mb</td>\n" ) 15.100 - request.write( "<td class='domainInfoHead' align='center'>CPU</td>\n" ) 15.101 - request.write( "<td class='domainInfoHead' align='center'>State</td>\n" ) 15.102 - if long: 15.103 - request.write( "<td class='domainInfoHead' align='center'>CPU time / s</td>\n" ) 15.104 -
16.1 --- a/tools/python/xen/xend/sv/GenTabbed.py Thu Jul 22 03:26:52 2004 +0000 16.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 16.3 @@ -1,103 +0,0 @@ 16.4 -import types 16.5 - 16.6 -from HTMLBase import HTMLBase 16.7 -from TabView import TabView 16.8 - 16.9 -class GenTabbed( HTMLBase ): 16.10 - 16.11 - def __init__( self, urlWriter, tabStrings, tabObjects, callback ): 16.12 - HTMLBase.__init__(self) 16.13 - self.tab = 0; 16.14 - self.tabStrings = tabStrings 16.15 - self.tabObjects = tabObjects 16.16 - self.urlWriter = urlWriter 16.17 - self.callback = callback 16.18 - 16.19 - def write_BODY( self, request, urlWriter = None ): 16.20 - tab = request.args.get('tab') 16.21 - 16.22 - if tab is None or len( tab) != 1: 16.23 - self.tab = 0 16.24 - else: 16.25 - self.tab = int( tab[0] ) 16.26 - 16.27 - request.write( "<table style='' width='100%' border='0' cellspacing='0' cellpadding='0'>" ) 16.28 - request.write( "<tr><td>" ) 16.29 - 16.30 - TabView( self.tab, self.tabStrings, self.urlWriter ).write_BODY( request ) 16.31 - 16.32 - request.write( "</td></tr><tr><td>" ) 16.33 - 16.34 - render_tab = self.tabObjects[ self.tab ]() 16.35 - 16.36 - if render_tab is None: 16.37 - request.write( "<p>Bad Tab</p>" ) 16.38 - self.finish_BODY( request ) 16.39 - else: 16.40 - render_tab.write_BODY( request, self.finish_BODY ) 16.41 - 16.42 - def finish_BODY( self, request ): 16.43 - 16.44 - request.write( "</td></tr></table>" ) 16.45 - 16.46 - self.callback( request ) 16.47 - 16.48 -class PreTab( HTMLBase ): 16.49 - 16.50 - def __init__( self, source ): 16.51 - HTMLBase.__init__( self ) 16.52 - self.source = source 16.53 - 16.54 - def write_BODY( self, request, callback ): 16.55 - 16.56 - request.write( "<div style='display: block; overflow: auto; border: 0px solid black; height: 400px; width: 540px; padding: 5px; z-index:0; align: center'><pre>" ) 16.57 - 16.58 - request.write( self.source ) 16.59 - 16.60 - request.write( "</pre></div>" ) 16.61 - 16.62 - callback( request ) 16.63 - 16.64 -class GeneralTab( HTMLBase ): 16.65 - 16.66 - def __init__( self, title, dict, titles ): 16.67 - HTMLBase.__init__( self ) 16.68 - self.title = title 16.69 - self.dict = dict 16.70 - self.titles = titles 16.71 - 16.72 - def write_BODY( self, request, callback ): 16.73 - 16.74 - request.write( "<p><u>%s</u></p>" % self.title ) 16.75 - 16.76 - request.write( "<table width='100%' cellspacing='0' cellpadding='0' border='0'>" ) 16.77 - 16.78 - def writeAttr( niceName, attr, formatter=None ): 16.79 - if type( attr ) is types.TupleType: 16.80 - ( attr, formatter ) = attr 16.81 - 16.82 - if attr in self.dict: 16.83 - if formatter: 16.84 - temp = formatter( self.dict[ attr ] ) 16.85 - else: 16.86 - temp = str( self.dict[ attr ] ) 16.87 - request.write( "<tr><td width='50%%'><p>%s:</p></td><td width='50%%'><p>%s</p></td></tr>" % ( niceName, temp ) ) 16.88 - 16.89 - for niceName, attr in self.titles.items(): 16.90 - writeAttr( niceName, attr ) 16.91 - 16.92 - request.write( "</table>" ) 16.93 - 16.94 - callback( request ) 16.95 - 16.96 -class NullTab( HTMLBase ): 16.97 - 16.98 - def __init__( self ): 16.99 - HTMLBase.__init__( self ) 16.100 - self.title = "Null Tab" 16.101 - 16.102 - def write_BODY( self, request, callback ): 16.103 - request.write( "<p>%s</p>" % self.title ) 16.104 - callback( request ) 16.105 - 16.106 - 16.107 \ No newline at end of file
17.1 --- a/tools/python/xen/xend/sv/HTMLBase.py Thu Jul 22 03:26:52 2004 +0000 17.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 17.3 @@ -1,27 +0,0 @@ 17.4 -from twisted.web import server, resource 17.5 -from twisted.internet import reactor 17.6 - 17.7 -class HTMLBase( resource.Resource ): 17.8 - 17.9 - isLeaf = True 17.10 - 17.11 - def __init__( self ): 17.12 - resource.Resource.__init__(self) 17.13 - 17.14 - def render_GET( self, request ): 17.15 - self.write_TOP( request ) 17.16 - return self.write_BODY( request, self.finish_render_GET ) 17.17 - 17.18 - def finish_render_GET( self, request ): 17.19 - self.write_BOTTOM( request ) 17.20 - request.finish() 17.21 - 17.22 - def write_BODY( self, request ): 17.23 - request.write( "BODY" ) 17.24 - 17.25 - def write_TOP( self, request ): 17.26 - request.write( '<html><head><title>Xen</title><link rel="stylesheet" type="text/css" href="inc/style.css" />' ) 17.27 - request.write( '</head><body>' ) 17.28 - 17.29 - def write_BOTTOM( self, request ): 17.30 - request.write( "</body></html>" ) 17.31 \ No newline at end of file
18.1 --- a/tools/python/xen/xend/sv/Main.py Thu Jul 22 03:26:52 2004 +0000 18.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 18.3 @@ -1,81 +0,0 @@ 18.4 -from twisted.web import resource 18.5 -from twisted.web.server import NOT_DONE_YET 18.6 - 18.7 -from xen.xend.XendClient import server as XendServer 18.8 -from xen.xend import sxp 18.9 - 18.10 -from HTMLBase import HTMLBase 18.11 - 18.12 -from xen.xend.sv import DomList, NodeInfo, DomInfo 18.13 - 18.14 -class Main( HTMLBase ): 18.15 - 18.16 - isLeaf = True 18.17 - 18.18 - def __init__( self ): 18.19 - HTMLBase.__init__(self) 18.20 - 18.21 - def render_POST( self, request ): 18.22 - return self.render_GET( request ) 18.23 - 18.24 - def mainUrlWriter( self, s ): 18.25 - return "Main.rpy?%s" % s 18.26 - 18.27 - def write_BODY( self, request, callback ): 18.28 - 18.29 - self.callback = callback 18.30 - 18.31 - request.write( "\n<table style='border:0px solid black; background: url(images/orb_01.jpg) no-repeat' cellspacing='0' cellpadding='0' border='0' width='780px' height='536px'>\n" ) 18.32 - request.write( "<tr>\n" ) 18.33 - request.write( " <td width='15px'> </td>" ) 18.34 - request.write( " <td width='175px' align='center' valign'center'>" ) 18.35 - request.write( " <table cellspacing='0' cellpadding='0' border='0' width='100%' height='100%'>" ) 18.36 - request.write( " <tr><td height='200px' align='center' valign='center'><a href='http://www.cl.cam.ac.uk/Research/SRG/netos/xen/'>" ) 18.37 - request.write( " <img src='images/xen.png' width='150' height='75' border='0'/></a></td></tr>" ) 18.38 - request.write( " <tr><td align='center' valign='top'>" ) 18.39 - 18.40 - request.write( " <p class='small'><a href='Main.rpy?mod=node'>Node details</a></p>" ) 18.41 - request.write( " <p class='small'><a href='Main.rpy?mod=list'>Domains summary</a></p>" ) 18.42 - 18.43 - DomList.DomList( self.mainUrlWriter, self.continue_BODY ).write_BODY( request, True, False ) 18.44 - 18.45 - return NOT_DONE_YET 18.46 - 18.47 - def continue_BODY( self, request ): 18.48 - request.write( " </td></tr>" ) 18.49 - request.write( " </table>" ) 18.50 - request.write( " " ) 18.51 - request.write( " </td>\n" ) 18.52 - request.write( " <td width='15px'> </td>" ) 18.53 - request.write( " <td width='558px' align='left' valign='top'>" ) 18.54 - request.write( " <table cellspacing='0' cellpadding='0' border='0' width='100%' height='100%'>" ) 18.55 - request.write( " <tr><td height='20px'></td></tr>" ) 18.56 - request.write( " <tr><td align='center' valign='top'>" ) 18.57 - 18.58 - mod = request.args.get('mod') 18.59 - 18.60 - if mod is None or len(mod) != 1: 18.61 - request.write( '<p>Please select a module</p>' ) 18.62 - self.finish_BODY( request ) 18.63 - elif mod[0] == 'info': 18.64 - DomInfo.DomInfo( self.mainUrlWriter, self.finish_BODY ).write_BODY( request ) 18.65 - elif mod[0] == 'list': 18.66 - DomList.DomList( self.mainUrlWriter, self.finish_BODY ).write_BODY( request ) 18.67 - elif mod[0] == 'node': 18.68 - NodeInfo.NodeInfo( self.mainUrlWriter, self.finish_BODY ).write_BODY( request ) 18.69 - else: 18.70 - request.write( '<p>Invalid module. Please select another</p>' ) 18.71 - self.finish_BODY( request ) 18.72 - 18.73 - def finish_BODY( self, request ): 18.74 - 18.75 - request.write( " </td></tr>" ) 18.76 - request.write( " </table>" ) 18.77 - request.write( " </td>\n" ) 18.78 - request.write( " <td width='17px'> </td>" ) 18.79 - request.write( "</tr>\n" ) 18.80 - 18.81 - request.write( "</table>\n" ) 18.82 - 18.83 - self.callback( request ) 18.84 - 18.85 \ No newline at end of file
19.1 --- a/tools/python/xen/xend/sv/Main.rpy Thu Jul 22 03:26:52 2004 +0000 19.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 19.3 @@ -1,3 +0,0 @@ 19.4 -from xen.xend.sv.Main import * 19.5 - 19.6 -resource = Main() 19.7 \ No newline at end of file
20.1 --- a/tools/python/xen/xend/sv/NodeInfo.py Thu Jul 22 03:26:52 2004 +0000 20.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 20.3 @@ -1,47 +0,0 @@ 20.4 -from xen.xend import XendDmesg 20.5 -from xen.xend import XendNode 20.6 - 20.7 -from xen.xend.sv.util import * 20.8 -from xen.xend.sv.GenTabbed import * 20.9 -from xen.xend.sv.HTMLBase import HTMLBase 20.10 - 20.11 -class NodeInfo( GenTabbed ): 20.12 - 20.13 - def __init__( self, urlWriter, callback ): 20.14 - 20.15 - def newUrlWriter( url ): 20.16 - return urlWriter( "mod=node%s" % url ) 20.17 - 20.18 - GenTabbed.__init__( self, newUrlWriter, [ 'General', 'Dmesg' ], [ NodeGeneralTab, NodeDmesgTab ], callback ) 20.19 - 20.20 -class NodeGeneralTab( GeneralTab ): 20.21 - 20.22 - def __init__( self ): 20.23 - 20.24 - nodeInfo = XendNode.instance().info() 20.25 - 20.26 - dictNodeInfo = {} 20.27 - 20.28 - for l in nodeInfo: 20.29 - dictNodeInfo[ l[0] ] = l[1] 20.30 - 20.31 - dictTitles = {} 20.32 - dictTitles[ 'System' ] = 'system' 20.33 - dictTitles[ 'Hostname' ] = 'host' 20.34 - dictTitles[ 'Release' ] = 'release' 20.35 - dictTitles[ 'Version' ] ='version' 20.36 - dictTitles[ 'Machine' ] = 'machine' 20.37 - dictTitles[ 'Cores' ] = 'cores' 20.38 - dictTitles[ 'Hyperthreading' ] = ( 'hyperthreads_per_core', hyperthreadFormatter ) 20.39 - dictTitles[ 'CPU Speed' ] = ( 'cpu_mhz', cpuFormatter ) 20.40 - dictTitles[ 'Memory' ] = ( 'memory', memoryFormatter ) 20.41 - dictTitles[ 'Free Memory' ] = ( 'free_memory', memoryFormatter ) 20.42 - 20.43 - GeneralTab.__init__( self, title="General Node Info", dict=dictNodeInfo, titles=dictTitles ) 20.44 - 20.45 -class NodeDmesgTab( PreTab ): 20.46 - 20.47 - def __init__( self ): 20.48 - self.xd = XendDmesg.instance() 20.49 - PreTab.__init__( self, self.xd.info()[0] ) 20.50 - 20.51 \ No newline at end of file
21.1 --- a/tools/python/xen/xend/sv/TabView.py Thu Jul 22 03:26:52 2004 +0000 21.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 21.3 @@ -1,49 +0,0 @@ 21.4 -from xen.xend.sv.HTMLBase import HTMLBase 21.5 - 21.6 -class TabView( HTMLBase ): 21.7 - 21.8 - def __init__( self, tab, tabs, urlWriter ): 21.9 - HTMLBase.__init__(self) 21.10 - self.tab = tab # interger - tab id 21.11 - self.tabs = tabs 21.12 - self.urlWriter = urlWriter 21.13 - 21.14 - def write_BODY( self, request ): 21.15 - request.write( "<table style='' border='0' cellspacing='0' cellpadding='0' align='center'>" ) 21.16 - request.write( "<tr height='22'>" ) 21.17 - 21.18 - if self.tab == 0: 21.19 - image = "left-end-highlight.jpg" 21.20 - else: 21.21 - image = "left-end-no-highlight.jpg" 21.22 - 21.23 - request.write( "<td height='22' width='14'><image src='images/%s' width='14' height='22'></td>" % image ) 21.24 - 21.25 - count = len( self.tabs ) 21.26 - 21.27 - for i in range( count ): 21.28 - 21.29 - if i == self.tab: 21.30 - image = "middle-highlight.jpg" 21.31 - else: 21.32 - image = "middle-no-highlight.jpg" 21.33 - 21.34 - request.write( "<td style='background: url(images/%s)'><p align='center'><a href='%s'>%s</a></p></td>" % ( image, self.urlWriter( "&tab=%s" % i ), self.tabs[ i ] ) ) 21.35 - 21.36 - if i < count-1: 21.37 - if i == self.tab: 21.38 - image = "seperator-left-highlight.jpg" 21.39 - elif self.tab == i+1: 21.40 - image = "seperator-right-highlight.jpg" 21.41 - else: 21.42 - image = "seperator.jpg" 21.43 - 21.44 - request.write( "<td height='22' width='23'><image src='images/%s' width='23' height='22'></td>" % image ) 21.45 - 21.46 - if self.tab == count - 1: 21.47 - image = "right-end-highlight.jpg" 21.48 - else: 21.49 - image = "right-end-no-highlight.jpg" 21.50 - 21.51 - request.write( "<td height='22' width='14'><image src='images/%s' width='14' height='22'></td>" % image ) 21.52 - request.write( "</tr></table>" )
22.1 --- a/tools/python/xen/xend/sv/XendClientDeferred.py Thu Jul 22 03:26:52 2004 +0000 22.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 22.3 @@ -1,363 +0,0 @@ 22.4 -# Copyright (C) 2004 Tom Wilkie <tw275@cam.ac.uk> 22.5 -# Copyright (C) 2004 Mike Wray 22.6 -"""Client API for the HTTP interface on xend. 22.7 -Callable as a script - see main(). 22.8 - 22.9 -This API is the 'control-plane' for xend. 22.10 -The 'data-plane' is done separately. For example, consoles 22.11 -are accessed via sockets on xend, but the list of consoles 22.12 -is accessible via this API. 22.13 - 22.14 -This one is similar to mikes, but works in an async fashion 22.15 -""" 22.16 -import sys 22.17 -import httplib 22.18 -import types 22.19 -from StringIO import StringIO 22.20 -import urlparse 22.21 - 22.22 -from xen.xend.encode import * 22.23 -from xen.xend.sxp import * 22.24 -from xen.xend.PrettyPrint import prettyprint 22.25 - 22.26 -from twisted.protocols.http import HTTPClient 22.27 -from twisted.internet.protocol import ClientCreator 22.28 -from twisted.internet.defer import Deferred 22.29 -from twisted.internet import reactor 22.30 - 22.31 -DEBUG = 0 22.32 - 22.33 -class XendRequest( HTTPClient ): 22.34 - def __init__(self, deferred, urls): 22.35 - self.urls = urls 22.36 - self.deferred = deferred 22.37 - 22.38 - def connectionMade(self): 22.39 - self.sendCommand('GET', self.urls[2]) 22.40 - self.sendHeader('Host', '%s:%d' % (self.urls[0], self.urls[1]) ) 22.41 - self.endHeaders() 22.42 - 22.43 - def handleResponse(self, data): 22.44 - self.deferred.callback( data ) 22.45 - 22.46 -def process_SXP( sexp ): 22.47 - pin = Parser() 22.48 - pin.input(sexp) 22.49 - pin.input_eof() 22.50 - return pin.get_val() 22.51 - 22.52 -def xend_request(url, method, data=None): 22.53 - """Make a request to xend. 22.54 - 22.55 - url xend request url 22.56 - method http method: POST or GET 22.57 - data request argument data (dict) 22.58 - """ 22.59 - urlinfo = urlparse.urlparse(url) 22.60 - (uproto, ulocation, upath, uparam, uquery, ufrag) = urlinfo 22.61 - (hdr, args) = encode_data(data) 22.62 - if data and method == 'GET': 22.63 - upath += '?' + args 22.64 - args = None 22.65 - if method == "POST" and upath.endswith('/'): 22.66 - upath = upath[:-1] 22.67 - 22.68 - deferred = Deferred() 22.69 - 22.70 - clientCreator = ClientCreator( reactor, XendRequest, deferred, (ulocation, 8000, upath) ) 22.71 - clientCreator.connectTCP( ulocation, 8000 ) 22.72 - 22.73 - deferred.addCallback( process_SXP ) 22.74 - 22.75 - return deferred 22.76 - 22.77 -class XendError(RuntimeError): 22.78 - pass 22.79 - 22.80 -class Foo(httplib.HTTPResponse): 22.81 - 22.82 - def begin(self): 22.83 - fin = self.fp 22.84 - while(1): 22.85 - buf = fin.readline() 22.86 - print "***", buf 22.87 - if buf == '': 22.88 - print 22.89 - sys.exit() 22.90 - 22.91 - 22.92 -def sxprio(sxpr): 22.93 - """Convert an sxpr to a string. 22.94 - """ 22.95 - io = StringIO() 22.96 - sxp.show(sxpr, out=io) 22.97 - print >> io 22.98 - io.seek(0) 22.99 - return io 22.100 - 22.101 -def fileof(val): 22.102 - """Converter for passing configs. 22.103 - Handles lists, files directly. 22.104 - Assumes a string is a file name and passes its contents. 22.105 - """ 22.106 - if isinstance(val, types.ListType): 22.107 - return sxprio(val) 22.108 - if isinstance(val, types.StringType): 22.109 - return file(val) 22.110 - if hasattr(val, 'readlines'): 22.111 - return val 22.112 - 22.113 -# todo: need to sort of what urls/paths are using for objects. 22.114 -# e.g. for domains at the moment return '0'. 22.115 -# should probably return abs path w.r.t. server, e.g. /xend/domain/0. 22.116 -# As an arg, assume abs path is obj uri, otherwise just id. 22.117 - 22.118 -# Function to convert to full url: Xend.uri(path), e.g. 22.119 -# maps /xend/domain/0 to http://wray-m-3.hpl.hp.com:8000/xend/domain/0 22.120 -# And should accept urls for ids? 22.121 - 22.122 -def urljoin(location, root, prefix='', rest=''): 22.123 - prefix = str(prefix) 22.124 - rest = str(rest) 22.125 - base = 'http://' + location + root + prefix 22.126 - url = urlparse.urljoin(base, rest) 22.127 - return url 22.128 - 22.129 -def nodeurl(location, root, id=''): 22.130 - return urljoin(location, root, 'node/', id) 22.131 - 22.132 -def domainurl(location, root, id=''): 22.133 - return urljoin(location, root, 'domain/', id) 22.134 - 22.135 -def consoleurl(location, root, id=''): 22.136 - return urljoin(location, root, 'console/', id) 22.137 - 22.138 -def deviceurl(location, root, id=''): 22.139 - return urljoin(location, root, 'device/', id) 22.140 - 22.141 -def vneturl(location, root, id=''): 22.142 - return urljoin(location, root, 'vnet/', id) 22.143 - 22.144 -def eventurl(location, root, id=''): 22.145 - return urljoin(location, root, 'event/', id) 22.146 - 22.147 -def xend_get(url, args=None): 22.148 - """Make a xend request using GET. 22.149 - Requests using GET are 'safe' and may be repeated without 22.150 - nasty side-effects. 22.151 - """ 22.152 - return xend_request(url, "GET", args) 22.153 - 22.154 -def xend_call(url, data): 22.155 - """Make xend request using POST. 22.156 - Requests using POST potentially cause side-effects and should 22.157 - not be repeated unless it really is wanted to do the side 22.158 - effect again. 22.159 - """ 22.160 - return xend_request(url, "POST", data) 22.161 - 22.162 -class Xend: 22.163 - 22.164 - """Default location of the xend server.""" 22.165 - SRV_DEFAULT = "localhost" 22.166 - 22.167 - """Default path to the xend root on the server.""" 22.168 - ROOT_DEFAULT = "/xend/" 22.169 - 22.170 - def __init__(self, srv=None, root=None): 22.171 - self.bind(srv, root) 22.172 - 22.173 - def bind(self, srv=None, root=None): 22.174 - """Bind to a given server. 22.175 - 22.176 - srv server location (host:port) 22.177 - root server xend root path 22.178 - """ 22.179 - if srv is None: srv = self.SRV_DEFAULT 22.180 - if root is None: root = self.ROOT_DEFAULT 22.181 - if not root.endswith('/'): root += '/' 22.182 - self.location = srv 22.183 - self.root = root 22.184 - 22.185 - def nodeurl(self, id=''): 22.186 - return nodeurl(self.location, self.root, id) 22.187 - 22.188 - def domainurl(self, id=''): 22.189 - return domainurl(self.location, self.root, id) 22.190 - 22.191 - def consoleurl(self, id=''): 22.192 - return consoleurl(self.location, self.root, id) 22.193 - 22.194 - def deviceurl(self, id=''): 22.195 - return deviceurl(self.location, self.root, id) 22.196 - 22.197 - def vneturl(self, id=''): 22.198 - return vneturl(self.location, self.root, id) 22.199 - 22.200 - def eventurl(self, id=''): 22.201 - return eventurl(self.location, self.root, id) 22.202 - 22.203 - def xend(self): 22.204 - return xend_get(urljoin(self.location, self.root)) 22.205 - 22.206 - def xend_node(self): 22.207 - return xend_get(self.nodeurl()) 22.208 - 22.209 - def xend_node_cpu_rrobin_slice_set(self, slice): 22.210 - return xend_call(self.nodeurl(), 22.211 - {'op' : 'cpu_rrobin_slice_set', 22.212 - 'slice' : slice }) 22.213 - 22.214 - def xend_node_cpu_bvt_slice_set(self, ctx_allow): 22.215 - return xend_call(self.nodeurl(), 22.216 - {'op' : 'cpu_bvt_slice_set', 22.217 - 'ctx_allow' : ctx_allow }) 22.218 - 22.219 - def xend_node_cpu_fbvt_slice_set(self, ctx_allow): 22.220 - return xend_call(self.nodeurl(), 22.221 - {'op' : 'cpu_fbvt_slice_set', 22.222 - 'ctx_allow' : ctx_allow }) 22.223 - 22.224 - def xend_domains(self): 22.225 - return xend_get(self.domainurl()) 22.226 - 22.227 - def xend_domain_create(self, conf): 22.228 - return xend_call(self.domainurl(), 22.229 - {'op' : 'create', 22.230 - 'config' : fileof(conf) }) 22.231 - 22.232 - def xend_domain(self, id): 22.233 - return xend_get(self.domainurl(id)) 22.234 - 22.235 - def xend_domain_unpause(self, id): 22.236 - return xend_call(self.domainurl(id), 22.237 - {'op' : 'unpause'}) 22.238 - 22.239 - def xend_domain_pause(self, id): 22.240 - return xend_call(self.domainurl(id), 22.241 - {'op' : 'pause'}) 22.242 - 22.243 - def xend_domain_shutdown(self, id, reason): 22.244 - return xend_call(self.domainurl(id), 22.245 - {'op' : 'shutdown', 22.246 - 'reason' : reason }) 22.247 - 22.248 - def xend_domain_destroy(self, id): 22.249 - return xend_call(self.domainurl(id), 22.250 - {'op' : 'destroy'}) 22.251 - 22.252 - def xend_domain_save(self, id, filename): 22.253 - return xend_call(self.domainurl(id), 22.254 - {'op' : 'save', 22.255 - 'file' : filename}) 22.256 - 22.257 - def xend_domain_restore(self, id, filename): 22.258 - return xend_call(self.domainurl(id), 22.259 - {'op' : 'restore', 22.260 - 'file' : filename }) 22.261 - 22.262 - def xend_domain_migrate(self, id, dst): 22.263 - return xend_call(self.domainurl(id), 22.264 - {'op' : 'migrate', 22.265 - 'destination': dst}) 22.266 - 22.267 - def xend_domain_pincpu(self, id, cpu): 22.268 - return xend_call(self.domainurl(id), 22.269 - {'op' : 'pincpu', 22.270 - 'cpu' : cpu}) 22.271 - 22.272 - def xend_domain_cpu_bvt_set(self, id, mcuadv, warp, warpl, warpu): 22.273 - return xend_call(self.domainurl(id), 22.274 - {'op' : 'cpu_bvt_set', 22.275 - 'mcuadv' : mcuadv, 22.276 - 'warp' : warp, 22.277 - 'warpl' : warpl, 22.278 - 'warpu' : warpu }) 22.279 - 22.280 - def xend_domain_cpu_fbvt_set(self, id, mcuadv, warp, warpl, warpu): 22.281 - return xend_call(self.domainurl(id), 22.282 - {'op' : 'cpu_fbvt_set', 22.283 - 'mcuadv' : mcuadv, 22.284 - 'warp' : warp, 22.285 - 'warpl' : warpl, 22.286 - 'warpu' : warpu }) 22.287 - 22.288 - 22.289 - def xend_domain_cpu_atropos_set(self, id, period, slice, latency, xtratime): 22.290 - return xend_call(self.domainurl(id), 22.291 - {'op' : 'cpu_atropos_set', 22.292 - 'period' : period, 22.293 - 'slice' : slice, 22.294 - 'latency' : latency, 22.295 - 'xtratime': xtratime }) 22.296 - 22.297 - def xend_domain_vifs(self, id): 22.298 - return xend_get(self.domainurl(id), 22.299 - { 'op' : 'vifs' }) 22.300 - 22.301 - def xend_domain_vif_ip_add(self, id, vif, ipaddr): 22.302 - return xend_call(self.domainurl(id), 22.303 - {'op' : 'vif_ip_add', 22.304 - 'vif' : vif, 22.305 - 'ip' : ipaddr }) 22.306 - 22.307 - def xend_domain_vbds(self, id): 22.308 - return xend_get(self.domainurl(id), 22.309 - {'op' : 'vbds'}) 22.310 - 22.311 - def xend_domain_vbd(self, id, vbd): 22.312 - return xend_get(self.domainurl(id), 22.313 - {'op' : 'vbd', 22.314 - 'vbd' : vbd}) 22.315 - 22.316 - def xend_consoles(self): 22.317 - return xend_get(self.consoleurl()) 22.318 - 22.319 - def xend_console(self, id): 22.320 - return xend_get(self.consoleurl(id)) 22.321 - 22.322 - def xend_vnets(self): 22.323 - return xend_get(self.vneturl()) 22.324 - 22.325 - def xend_vnet_create(self, conf): 22.326 - return xend_call(self.vneturl(), 22.327 - {'op': 'create', 'config': fileof(conf) }) 22.328 - 22.329 - def xend_vnet(self, id): 22.330 - return xend_get(self.vneturl(id)) 22.331 - 22.332 - def xend_vnet_delete(self, id): 22.333 - return xend_call(self.vneturl(id), 22.334 - {'op': 'delete'}) 22.335 - 22.336 - def xend_event_inject(self, sxpr): 22.337 - val = xend_call(self.eventurl(), 22.338 - {'op': 'inject', 'event': fileof(sxpr) }) 22.339 - 22.340 -def main(argv): 22.341 - """Call an API function: 22.342 - 22.343 - python XendClient.py fn args... 22.344 - 22.345 - The leading 'xend_' on the function can be omitted. 22.346 - Example: 22.347 - 22.348 - > python XendClient.py domains 22.349 - (domain 0 8) 22.350 - > python XendClient.py domain 0 22.351 - (domain (id 0) (name Domain-0) (memory 128)) 22.352 - """ 22.353 - server = Xend() 22.354 - fn = argv[1] 22.355 - if not fn.startswith('xend'): 22.356 - fn = 'xend_' + fn 22.357 - args = argv[2:] 22.358 - deferred = getattr(server, fn)(*args) 22.359 - deferred.addCallback( prettyprint ) 22.360 - reactor.run() 22.361 - print 22.362 - 22.363 -if __name__ == "__main__": 22.364 - main(sys.argv) 22.365 -else: 22.366 - server = Xend()
23.1 --- a/tools/python/xen/xend/sv/__init__.py Thu Jul 22 03:26:52 2004 +0000 23.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 23.3 @@ -1,1 +0,0 @@ 23.4 -
24.1 Binary file tools/python/xen/xend/sv/images/internet copy.jpg has changed
25.1 Binary file tools/python/xen/xend/sv/images/internet.jpg has changed
26.1 Binary file tools/python/xen/xend/sv/images/internet.psd has changed
27.1 Binary file tools/python/xen/xend/sv/images/left-end-highlight.jpg has changed
28.1 Binary file tools/python/xen/xend/sv/images/left-end-no-highlight.jpg has changed
29.1 Binary file tools/python/xen/xend/sv/images/middle-highlight.jpg has changed
30.1 Binary file tools/python/xen/xend/sv/images/middle-no-highlight.jpg has changed
31.1 Binary file tools/python/xen/xend/sv/images/orb_01.jpg has changed
32.1 Binary file tools/python/xen/xend/sv/images/orb_02.jpg has changed
33.1 Binary file tools/python/xen/xend/sv/images/right-end-highlight.jpg has changed
34.1 Binary file tools/python/xen/xend/sv/images/right-end-no-highlight.jpg has changed
35.1 Binary file tools/python/xen/xend/sv/images/seperator-left-highlight.jpg has changed
36.1 Binary file tools/python/xen/xend/sv/images/seperator-right-highlight.jpg has changed
37.1 Binary file tools/python/xen/xend/sv/images/seperator.jpg has changed
38.1 Binary file tools/python/xen/xend/sv/images/xen.png has changed
39.1 --- a/tools/python/xen/xend/sv/inc/style.css Thu Jul 22 03:26:52 2004 +0000 39.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 39.3 @@ -1,30 +0,0 @@ 39.4 - 39.5 -P {font-family: verdana, arial; font-size: 12px; color: black} 39.6 -.small {font-size: 10px} 39.7 - 39.8 -TD.domainInfo {font-family: verdana, arial; font-size: 10px; color: black} 39.9 -TD.domainInfoHead {font-family: verdana, arial; font-size: 10px; color: white; font-face: bold} 39.10 - 39.11 -TD.domainInfoHead {background-color: black} 39.12 -TR.domainInfoOdd {background-color: white} 39.13 -TR.domainInfoEven {background-color: lightgrey} 39.14 - 39.15 -body { 39.16 - width: 670px; 39.17 - margin: 0px; 39.18 - padding: 0px; 39.19 - background-color: #fff; 39.20 - background-image: url(../images/orb_02.jpg); 39.21 - background-repeat: repeat-y; 39.22 - background-position: left top; 39.23 - font-family: Arial, Helvetica, sans-serif; 39.24 - font-weight: bold; 39.25 - color: #333333; 39.26 - letter-spacing: 0px; 39.27 - scrollbar-base-color: #333333; 39.28 - scrollbar-track-color: #666666; 39.29 - scrollbar-face-color: #fff; 39.30 - 39.31 - 39.32 - } 39.33 - 39.34 \ No newline at end of file
40.1 --- a/tools/python/xen/xend/sv/util.py Thu Jul 22 03:26:52 2004 +0000 40.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 40.3 @@ -1,64 +0,0 @@ 40.4 -from xen.xend.sv.XendClientDeferred import server 40.5 -from xen.xend import sxp 40.6 - 40.7 -def getDomInfoHash( domain ): 40.8 - deferred = server.xend_domain( int( domain ) ) 40.9 - deferred.addCallback( procDomInfo, domain ) 40.10 - return deferred 40.11 - 40.12 -def procDomInfo( domInfo, domain ): 40.13 - d = {} 40.14 - d['dom'] = int( domain ) 40.15 - d['name'] = sxp.child_value( domInfo, 'name' ) 40.16 - d['mem'] = int( sxp.child_value( domInfo, 'memory' ) ) 40.17 - d['cpu'] = int( sxp.child_value( domInfo, 'cpu' ) ) 40.18 - d['state'] = sxp.child_value( domInfo, 'state' ) 40.19 - d['cpu_time'] = float( sxp.child_value( domInfo, 'cpu_time' ) ) 40.20 - if( sxp.child_value( domInfo, 'up_time' ) ): 40.21 - d['up_time'] = float( sxp.child_value( domInfo, 'up_time' ) ) 40.22 - if( sxp.child_value( domInfo, 'start_time' ) ): 40.23 - d['start_time'] = float( sxp.child_value( domInfo, 'start_time' ) ) 40.24 - return d 40.25 - 40.26 -def bigTimeFormatter( time ): 40.27 - weeks = time // 604800 40.28 - remainder = time % 604800 40.29 - days = remainder // 86400 40.30 - 40.31 - remainder = remainder % 86400 40.32 - 40.33 - hms = smallTimeFormatter( remainder ) 40.34 - 40.35 - return "%d weeks, %d days, %s" % ( weeks, days, hms ) 40.36 - 40.37 -def smallTimeFormatter( time ): 40.38 - hours = time // 3600 40.39 - remainder = time % 3600 40.40 - mins = remainder // 60 40.41 - secs = time % 60 40.42 - return "%02d:%02d:%04.1f (hh:mm:ss.s)" % ( hours, mins, secs ) 40.43 - 40.44 -def stateFormatter( state ): 40.45 - states = [ 'Running', 'Blocked', 'Paused', 'Shutdown', 'Crashed' ] 40.46 - 40.47 - for i in range( len( state ) ): 40.48 - if state[i] != "-": 40.49 - return states[ i ] + " (%s)" % state 40.50 - 40.51 - return state 40.52 - 40.53 -def memoryFormatter( mem ): 40.54 - return "%7dMb" % mem 40.55 - 40.56 -def cpuFormatter( mhz ): 40.57 - if mhz > 1000: 40.58 - ghz = float( mhz ) / 1000.0 40.59 - return "%4.2fGHz" % ghz 40.60 - else: 40.61 - return "%4dMHz" % mhz 40.62 - 40.63 -def hyperthreadFormatter( threads ): 40.64 - if int( threads ) > 1: 40.65 - return "Yes (%d)" % threads 40.66 - else: 40.67 - return "No" 40.68 \ No newline at end of file
41.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 41.2 +++ b/tools/sv/Main.rpy Thu Jul 22 13:10:17 2004 +0000 41.3 @@ -0,0 +1,3 @@ 41.4 +from xen.sv.Main import Main 41.5 + 41.6 +resource = Main()
42.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 42.2 +++ b/tools/sv/Makefile Thu Jul 22 13:10:17 2004 +0000 42.3 @@ -0,0 +1,40 @@ 42.4 +sv_insdir := $(prefix)/var/xen/sv 42.5 + 42.6 +all: 42.7 + 42.8 +install: 42.9 + 42.10 + 42.11 + # make parent directory 42.12 + mkdir -p $(sv_insdir) 42.13 + 42.14 + # copy Main.rpy file - references xen.sv.Main class 42.15 + cp Main.rpy $(sv_insdir)/ 42.16 + 42.17 + # make images folder 42.18 + mkdir -p $(sv_insdir)/images 42.19 + 42.20 + # copy images 42.21 + cp images/xen.png $(sv_insdir)/images/ 42.22 + cp images/orb_01.jpg $(sv_insdir)/images/ 42.23 + cp images/orb_02.jpg $(sv_insdir)/images/ 42.24 + 42.25 + cp images/left-end-highlight.jpg $(sv_insdir)/images/ 42.26 + cp images/left-end-no-highlight.jpg $(sv_insdir)/images/ 42.27 + cp images/right-end-highlight.jpg $(sv_insdir)/images/ 42.28 + cp images/right-end-no-highlight.jpg $(sv_insdir)/images/ 42.29 + 42.30 + cp images/middle-highlight.jpg $(sv_insdir)/images/ 42.31 + cp images/middle-no-highlight.jpg $(sv_insdir)/images/ 42.32 + 42.33 + cp images/seperator.jpg $(sv_insdir)/images/ 42.34 + cp images/seperator-left-highlight.jpg $(sv_insdir)/images/ 42.35 + cp images/seperator-right-highlight.jpg $(sv_insdir)/images/ 42.36 + 42.37 + # make include folder 42.38 + mkdir -p $(sv_insdir)/inc 42.39 + 42.40 + #copy stylesheet 42.41 + cp inc/style.css $(sv_insdir)/inc/ 42.42 + 42.43 +clean:
43.1 Binary file tools/sv/images/left-end-highlight.jpg has changed
44.1 Binary file tools/sv/images/left-end-no-highlight.jpg has changed
45.1 Binary file tools/sv/images/middle-highlight.jpg has changed
46.1 Binary file tools/sv/images/middle-no-highlight.jpg has changed
47.1 Binary file tools/sv/images/orb_01.jpg has changed
48.1 Binary file tools/sv/images/orb_02.jpg has changed
49.1 Binary file tools/sv/images/right-end-highlight.jpg has changed
50.1 Binary file tools/sv/images/right-end-no-highlight.jpg has changed
51.1 Binary file tools/sv/images/seperator-left-highlight.jpg has changed
52.1 Binary file tools/sv/images/seperator-right-highlight.jpg has changed
53.1 Binary file tools/sv/images/seperator.jpg has changed
54.1 Binary file tools/sv/images/xen.png has changed
55.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 55.2 +++ b/tools/sv/inc/style.css Thu Jul 22 13:10:17 2004 +0000 55.3 @@ -0,0 +1,30 @@ 55.4 + 55.5 +P {font-family: verdana, arial; font-size: 12px; color: black} 55.6 +.small {font-size: 10px} 55.7 + 55.8 +TD.domainInfo {font-family: verdana, arial; font-size: 10px; color: black} 55.9 +TD.domainInfoHead {font-family: verdana, arial; font-size: 10px; color: white; font-face: bold} 55.10 + 55.11 +TD.domainInfoHead {background-color: black} 55.12 +TR.domainInfoOdd {background-color: white} 55.13 +TR.domainInfoEven {background-color: lightgrey} 55.14 + 55.15 +body { 55.16 + width: 670px; 55.17 + margin: 0px; 55.18 + padding: 0px; 55.19 + background-color: #fff; 55.20 + background-image: url(../images/orb_02.jpg); 55.21 + background-repeat: repeat-y; 55.22 + background-position: left top; 55.23 + font-family: Arial, Helvetica, sans-serif; 55.24 + font-weight: bold; 55.25 + color: #333333; 55.26 + letter-spacing: 0px; 55.27 + scrollbar-base-color: #333333; 55.28 + scrollbar-track-color: #666666; 55.29 + scrollbar-face-color: #fff; 55.30 + 55.31 + 55.32 + } 55.33 + 55.34 \ No newline at end of file