ia64/xen-unstable

changeset 1917:9ae151a45505

bitkeeper revision 1.1108.20.1 (41052ec5K2iTlC9jFZbnC6x-10TOpQ)

Merge labyrinth.cl.cam.ac.uk:/auto/groups/xeno/BK/xeno.bk
into labyrinth.cl.cam.ac.uk:/local/scratch/tw275/xeno.bk
author tw275@labyrinth.cl.cam.ac.uk
date Mon Jul 26 16:18:13 2004 +0000 (2004-07-26)
parents e59c333c2ba0 f4ad7cdea334
children 0b5c6184451f
files .rootkeys tools/python/xen/sv/CreateDomain.py tools/python/xen/sv/DomInfo.py tools/python/xen/sv/DomList.py tools/python/xen/sv/GenTabbed.py tools/python/xen/sv/Main.py tools/python/xen/sv/NodeInfo.py tools/python/xen/sv/Wizzard.py tools/python/xen/sv/util.py tools/sv/Makefile tools/sv/images/next.png tools/sv/images/previous.png
line diff
     1.1 --- a/.rootkeys	Mon Jul 26 15:43:27 2004 +0000
     1.2 +++ b/.rootkeys	Mon Jul 26 16:18:13 2004 +0000
     1.3 @@ -371,6 +371,7 @@ 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 +41052eb84_irpx0E9N_kqBp9eoin5g tools/python/xen/sv/CreateDomain.py
     1.8  40fcefb2qm13BbRZBydAatOavaS0fQ tools/python/xen/sv/DomInfo.py
     1.9  40fcefb2-RIU8GB67mJMRzybME9bxw tools/python/xen/sv/DomList.py
    1.10  40fcefb23FfQn-ZBCbcHqA0cPGqQxw tools/python/xen/sv/GenTabbed.py
    1.11 @@ -378,6 +379,7 @@ 40fcefb2QZAn3u3sX-M7NXBjOv5HGg tools/pyt
    1.12  40fcefb2vnfDbl4w_yCTedROPuqs0g tools/python/xen/sv/Main.py
    1.13  40fcefb24h-04WaHag-Tg4nxWPhTig tools/python/xen/sv/NodeInfo.py
    1.14  40fcefb2Sif__6AqrANeBQZZfvP-6w tools/python/xen/sv/TabView.py
    1.15 +41052eb8UrgtUkuJPg7oY1tutVQHsg tools/python/xen/sv/Wizzard.py
    1.16  40fcefb2DqteqCCZYDCvvh4Q5jBd0w tools/python/xen/sv/__init__.py
    1.17  40fcefb4rnaZNjqsBu7A5V2rlLyqRw tools/python/xen/sv/util.py
    1.18  40d8915cyoVA0hJxiBFNymL7YvDaRg tools/python/xen/util/Brctl.py
    1.19 @@ -442,9 +444,11 @@ 40fcefb3wXQMsl9WkgQAVtdrupm4sw tools/sv/
    1.20  40fcefb3K6ESt5sQhD9aCQRscQIlXQ tools/sv/images/left-end-no-highlight.jpg
    1.21  40fcefb3BUT98zPzW8kAFKuxGdh4XA tools/sv/images/middle-highlight.jpg
    1.22  40fcefb38OTgsUKHBpwshLLIsiIaCA tools/sv/images/middle-no-highlight.jpg
    1.23 +41052eb9SDUqSLGtG6rxk6Ep5fOhFA tools/sv/images/next.png
    1.24  40fcefb32SPtrw36c4S6YGFlLvkKuw tools/sv/images/orb_01.jpg
    1.25  40fcefb3Ok5qkX3iM7ZEPVkRInrUpg tools/sv/images/orb_02.jpg
    1.26  4104ffca9_GhWOxRE-83uZIad2Z1gg tools/sv/images/pause.png
    1.27 +41052eb9NQqHe_f9-ev1CaA3y5YYZg tools/sv/images/previous.png
    1.28  41013a82ILk71xLqWFH5ZO5VmOIvBw tools/sv/images/reboot.png
    1.29  40fcefb3JnT5XeKTuVF4yUMGOtuNZg tools/sv/images/right-end-highlight.jpg
    1.30  40fcefb3-DuYOS7noo2W7b_0p7TOUg tools/sv/images/right-end-no-highlight.jpg
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/tools/python/xen/sv/CreateDomain.py	Mon Jul 26 16:18:13 2004 +0000
     2.3 @@ -0,0 +1,43 @@
     2.4 +from xen.sv.Wizzard import Wizzard, Sheet
     2.5 +
     2.6 +class CreateDomain( Wizzard ):
     2.7 +    def __init__( self, urlWriter ):
     2.8 +    	
     2.9 +    	sheets = { 0: CreatePage0,
    2.10 +          	   1: CreatePage1,
    2.11 +          	   2: CreatePage2,
    2.12 +                   3: CreatePage3 }
    2.13 +    
    2.14 +    	Wizzard.__init__( self, urlWriter, "Create Domain Wizzard", sheets )
    2.15 +       
    2.16 +class CreatePage0( Sheet ):
    2.17 +
    2.18 +    def __init__( self, urlWriter ):
    2.19 +    
    2.20 +    	feilds = [( 'name', 'Name')]
    2.21 +    
    2.22 +        Sheet.__init__( self, urlWriter, feilds, "Create New Domain - 1" )
    2.23 +                
    2.24 +class CreatePage1( Sheet ):
    2.25 +
    2.26 +    def __init__( self, urlWriter ):
    2.27 +    
    2.28 +    	feilds = [( 'name', 'Name')]
    2.29 +        
    2.30 +        Sheet.__init__( self, urlWriter, feilds, "Create New Domain - 2" )
    2.31 +        
    2.32 +class CreatePage2( Sheet ):
    2.33 +
    2.34 +    def __init__( self, urlWriter ):
    2.35 +    
    2.36 +    	feilds = [( 'name', 'Name')]    
    2.37 +   
    2.38 +        Sheet.__init__( self, urlWriter, feilds, "Create New Domain - 3" )
    2.39 +                
    2.40 +class CreatePage3( Sheet ):
    2.41 +
    2.42 +    def __init__( self, urlWriter ):
    2.43 +    
    2.44 +    	feilds = [( 'name', 'Name')]
    2.45 +        
    2.46 +        Sheet.__init__( self, urlWriter, feilds, "Create New Domain - 4" )       
    2.47 \ No newline at end of file
     3.1 --- a/tools/python/xen/sv/DomInfo.py	Mon Jul 26 15:43:27 2004 +0000
     3.2 +++ b/tools/python/xen/sv/DomInfo.py	Mon Jul 26 16:18:13 2004 +0000
     3.3 @@ -12,7 +12,7 @@ class DomInfo( GenTabbed ):
     3.4          self.dom = 0;
     3.5      
     3.6          def tabUrlWriter( tab ):
     3.7 -            return urlWriter( "mod=info&dom=%s%s" % ( self.dom, tab ) )
     3.8 +            return urlWriter( "&dom=%s%s" % ( self.dom, tab ) )
     3.9          
    3.10          GenTabbed.__init__( self, "Domain Info", tabUrlWriter, [ 'General', 'SXP', 'Devices' ], [ DomGeneralTab, DomSXPTab, NullTab ]  )
    3.11  
    3.12 @@ -52,13 +52,11 @@ class DomGenTab( GeneralTab ):
    3.13          
    3.14      def write_BODY( self, request ):
    3.15      
    3.16 -        dom = request.args.get('dom')
    3.17 +        self.dom = getVar('dom', request)
    3.18          
    3.19 -        if dom is None or len(dom) != 1:
    3.20 +        if self.dom is None:
    3.21              request.write( "<p>Please Select a Domain</p>" )
    3.22              return None
    3.23 -        else:
    3.24 -            self.dom = dom[0]
    3.25              
    3.26          self.dict = getDomInfoHash( self.dom )
    3.27          
    3.28 @@ -72,17 +70,15 @@ class DomSXPTab( PreTab ):
    3.29  
    3.30  
    3.31      def write_BODY( self, request ):
    3.32 -        dom = request.args.get('dom')
    3.33 +        self.dom = getVar('dom', request)
    3.34          
    3.35 -        if dom is None or len(dom) != 1:
    3.36 +        if self.dom is None:
    3.37              request.write( "<p>Please Select a Domain</p>" )
    3.38              return None
    3.39 -        else:
    3.40 -            self.dom = dom[0]
    3.41 -            
    3.42 +
    3.43          domInfo = server.xend_domain( self.dom )
    3.44          
    3.45 -        self.source = sxp2string( domInfo )
    3.46 +        self.source = sxp2prettystring( domInfo )
    3.47          
    3.48          PreTab.write_BODY( self, request )
    3.49          
     4.1 --- a/tools/python/xen/sv/DomList.py	Mon Jul 26 15:43:27 2004 +0000
     4.2 +++ b/tools/python/xen/sv/DomList.py	Mon Jul 26 16:18:13 2004 +0000
     4.3 @@ -43,7 +43,7 @@ class DomList( HTMLBase ):
     4.4      def write_DOMAIN( self, request, domInfoHash, long=True ):   
     4.5          request.write( "<td class='domainInfo' align='center'>%(dom)-4d</td>\n" % domInfoHash )
     4.6  
     4.7 -        url = self.urlWriter( "mod=info&dom=%(dom)-4d" % domInfoHash )
     4.8 +        url = self.urlWriter( "&mod=info&dom=%(dom)-4d" % domInfoHash )
     4.9  
    4.10          request.write( "<td class='domainInfo' align='center'><a href='%s'>%s</a></td>\n" % ( url, domInfoHash['name'] ) )
    4.11          if long: 
     5.1 --- a/tools/python/xen/sv/GenTabbed.py	Mon Jul 26 15:43:27 2004 +0000
     5.2 +++ b/tools/python/xen/sv/GenTabbed.py	Mon Jul 26 16:18:13 2004 +0000
     5.3 @@ -2,35 +2,31 @@ import types
     5.4  
     5.5  from xen.sv.HTMLBase import HTMLBase
     5.6  from xen.sv.TabView import TabView
     5.7 +from xen.sv.util import getVar
     5.8  
     5.9  class GenTabbed( HTMLBase ):
    5.10  
    5.11      def __init__( self, title, urlWriter, tabStrings, tabObjects ):
    5.12          HTMLBase.__init__(self)
    5.13 -        self.tab = 0;
    5.14          self.tabStrings = tabStrings
    5.15          self.tabObjects = tabObjects
    5.16          self.urlWriter = urlWriter
    5.17          self.title = title
    5.18  
    5.19      def write_BODY( self, request, urlWriter = None ):
    5.20 -        tab = request.args.get('tab')
    5.21 -        
    5.22 -        if tab is None or len( tab) != 1:
    5.23 -            self.tab = 0
    5.24 -        else:
    5.25 -            self.tab = int( tab[0] )
    5.26 +    
    5.27 +        tab = int( getVar( 'tab', request, 0 ) )
    5.28              
    5.29          request.write( "<table style='' width='100%' border='0' cellspacing='0' cellpadding='0'>" )
    5.30          request.write( "<tr><td>" )
    5.31          
    5.32          request.write( "<p align='center'><u>%s</u></p>" % self.title )
    5.33          
    5.34 -        TabView( self.tab, self.tabStrings, self.urlWriter ).write_BODY( request )
    5.35 +        TabView( tab, self.tabStrings, self.urlWriter ).write_BODY( request )
    5.36          
    5.37          request.write( "</td></tr><tr><td>" )
    5.38          
    5.39 -        render_tab = self.tabObjects[ self.tab ]
    5.40 +        render_tab = self.tabObjects[ tab ]
    5.41                  
    5.42          if render_tab is None:
    5.43              request.write( "<p>Bad Tab</p>" )
    5.44 @@ -41,14 +37,9 @@ class GenTabbed( HTMLBase ):
    5.45          request.write( "</td></tr></table>" )
    5.46         
    5.47      def perform( self, request ):
    5.48 -        tab = request.args.get('tab')
    5.49 -        
    5.50 -        if tab is None or len( tab) != 1:
    5.51 -            self.tab = 0
    5.52 -        else:
    5.53 -            self.tab = int( tab[0] )
    5.54 +        tab = int( getVar( 'tab', request, 0 ) )
    5.55              
    5.56 -        op_tab = self.tabObjects[ self.tab ]
    5.57 +        op_tab = self.tabObjects[ tab ]
    5.58          
    5.59          if op_tab:
    5.60              op_tab().perform( request )
     6.1 --- a/tools/python/xen/sv/Main.py	Mon Jul 26 15:43:27 2004 +0000
     6.2 +++ b/tools/python/xen/sv/Main.py	Mon Jul 26 16:18:13 2004 +0000
     6.3 @@ -2,35 +2,40 @@ from xen.sv.HTMLBase import HTMLBase
     6.4  from xen.sv.DomList  import DomList
     6.5  from xen.sv.NodeInfo import NodeInfo
     6.6  from xen.sv.DomInfo  import DomInfo
     6.7 +from xen.sv.CreateDomain import CreateDomain
     6.8 +
     6.9 +from xen.sv.util import getVar
    6.10  
    6.11  class Main( HTMLBase ):
    6.12      
    6.13      isLeaf = True
    6.14  
    6.15      def __init__( self, urlWriter = None ):
    6.16 -        self.modules = { "node": ( "Node details", NodeInfo ), 
    6.17 -                         "list": ( "Domain summary", DomList ), 
    6.18 -                         "info": ( "Domain info", DomInfo ) }
    6.19 +        self.modules = { "node": NodeInfo, 
    6.20 +                         "list": DomList, 
    6.21 +                         "info": DomInfo,
    6.22 +                         "create": CreateDomain }
    6.23          HTMLBase.__init__(self)
    6.24          
    6.25      def render_POST( self, request ):
    6.26      
    6.27      	#decide what module post'd the action
    6.28  
    6.29 -        mod = request.args.get('mod')
    6.30 +        mod = getVar( 'mod', request )
    6.31                  
    6.32 -        if not mod is None and len(mod) == 1:
    6.33 -            modTup = self.modules[ mod[0] ]
    6.34 +        if not mod is None:
    6.35 +            module = self.modules[ mod ]
    6.36              #check module exists
    6.37 -            if modTup:
    6.38 -               (modName, module) = modTup
    6.39 +            if module:
    6.40                 module( self.mainUrlWriter ).perform( request )     
    6.41      
    6.42          return self.render_GET( request )
    6.43  
    6.44 -    def mainUrlWriter( self, s ):
    6.45 -        return "Main.rpy?%s" % s
    6.46 -
    6.47 +    def mainUrlWriter( self, module ):
    6.48 +    	def fun( f ):
    6.49 +            return "Main.rpy?mod=%s%s" % ( module, f )
    6.50 +        return fun    
    6.51 +        
    6.52      def write_BODY( self, request ):
    6.53      
    6.54          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" )
    6.55 @@ -43,8 +48,8 @@ class Main( HTMLBase ):
    6.56          request.write( "   <tr><td height='60px' align='center'><p class='small'>SV Web Interface<br/>(C) <a href='mailto:tw275@cam.ac.uk'>Tom Wilkie</a> 2004</p></td></tr>")
    6.57          request.write( "   <tr><td align='center' valign='top'>" )
    6.58          
    6.59 -        for (modName, (modTitle, module)) in self.modules.items():
    6.60 -            module( self.mainUrlWriter ).write_MENU( request )
    6.61 +        for (modName, module) in self.modules.items():
    6.62 +            module( self.mainUrlWriter( modName ) ).write_MENU( request )
    6.63  
    6.64          request.write( "   </td></tr>" )
    6.65          request.write( "  </table>" )
    6.66 @@ -56,15 +61,14 @@ class Main( HTMLBase ):
    6.67          request.write( "   <tr><td height='20px'></td></tr>" )
    6.68          request.write( "   <tr><td align='center' valign='top'>" )
    6.69          
    6.70 -        mod = request.args.get('mod')
    6.71 +        modName = getVar('mod', request)
    6.72          
    6.73 -        if mod is None or len(mod) != 1:
    6.74 +        if modName is None:
    6.75              request.write( '<p>Please select a module</p>' )
    6.76          else:
    6.77 -            modTup = self.modules[ mod[0] ]
    6.78 -            if modTup:
    6.79 -               (modName, module) = modTup
    6.80 -               module( self.mainUrlWriter ).write_BODY( request )  
    6.81 +            module = self.modules[ modName ]
    6.82 +            if module:
    6.83 +               module( self.mainUrlWriter( modName ) ).write_BODY( request )  
    6.84              else:
    6.85                 request.write( '<p>Invalid module. Please select another</p>' )
    6.86      
     7.1 --- a/tools/python/xen/sv/NodeInfo.py	Mon Jul 26 15:43:27 2004 +0000
     7.2 +++ b/tools/python/xen/sv/NodeInfo.py	Mon Jul 26 16:18:13 2004 +0000
     7.3 @@ -7,10 +7,7 @@ class NodeInfo( GenTabbed ):
     7.4  
     7.5      def __init__( self, urlWriter ):
     7.6      
     7.7 -        def newUrlWriter( url ):
     7.8 -            return urlWriter( "mod=node%s" % url )
     7.9 -    
    7.10 -        GenTabbed.__init__( self, "Node Details", newUrlWriter, [ 'General', 'Dmesg', ], [ NodeGeneralTab, NodeDmesgTab ] )
    7.11 +        GenTabbed.__init__( self, "Node Details", urlWriter, [ 'General', 'Dmesg', ], [ NodeGeneralTab, NodeDmesgTab ] )
    7.12      
    7.13      def write_MENU( self, request ):
    7.14          request.write( "<p class='small'><a href='%s'>Node details</a></p>" % self.urlWriter( '' ) )
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/tools/python/xen/sv/Wizzard.py	Mon Jul 26 16:18:13 2004 +0000
     8.3 @@ -0,0 +1,66 @@
     8.4 +from xen.sv.util import *
     8.5 +from xen.sv.HTMLBase import HTMLBase
     8.6 +from xen.xend import sxp
     8.7 +
     8.8 +class Wizzard( HTMLBase ):
     8.9 +
    8.10 +    def __init__( self, urlWriter, title, sheets ):
    8.11 +        HTMLBase.__init__( self )
    8.12 +        self.title = title
    8.13 +        self.sheets = sheets
    8.14 +        self.currSheet = 0
    8.15 +        self.urlWriter = urlWriter
    8.16 +        
    8.17 +    def write_MENU( self, request ):
    8.18 +    	request.write( "<p class='small'><a href='%s'>%s</a></p>" % (self.urlWriter( '' ), self.title) ) 
    8.19 +    
    8.20 +    def write_BODY( self, request ):
    8.21 +        
    8.22 +   	request.write( "<table width='100%' border='0' cellspacing='0' cellpadding='0'><tr><td>" )
    8.23 +        request.write( "<p align='center'><u>%s</u></p></td></tr><tr><td>" % self.title )
    8.24 +        
    8.25 +        currSheet = getVar( 'sheet', request )
    8.26 +    
    8.27 +        if not currSheet is None:
    8.28 +        
    8.29 +            self.currSheet = int( currSheet )
    8.30 +            
    8.31 +        self.sheets[ self.currSheet ]( self.urlWriter ).write_BODY( request )
    8.32 +        
    8.33 +        request.write( "</td></tr><tr><td><table width='100%' border='0' cellspacing='0' cellpadding='0'><tr>" )
    8.34 +        request.write( "<td width='80%'></td><td width='20%' align='center'>" )
    8.35 +        request.write( "<p align='center'><img src='images/previous.png' onclick='doOp( \"prev\" )' onmouseover='update( \"wizText\", \"Previous\" )' onmouseout='update( \"wizText\", \"&nbsp;\" )'>&nbsp;" )
    8.36 +        request.write( "<img src='images/next.png' onclick='doOp( \"next\" )' onmouseover='update( \"wizText\", \"Next\" )' onmouseout='update( \"wizText\", \"&nbsp;\" )'></p>" )
    8.37 +        request.write( "<p align='center'><span id='wizText'></span></p></td></tr></table>" )
    8.38 +        request.write( "</td></tr></table>" )
    8.39 +        
    8.40 +class Sheet( HTMLBase ):
    8.41 +
    8.42 +    def __init__( self, urlWriter, feilds, title ):
    8.43 +        HTMLBase.__init__( self )
    8.44 +        self.urlWriter = urlWriter
    8.45 +        self.feilds = feilds
    8.46 +        self.title = title
    8.47 +        
    8.48 +    def parseForm( self, request ):
    8.49 +    	return sxp.toString( request.args )
    8.50 +        
    8.51 +    def write_BODY( self, request ):
    8.52 +   	request.write( "<p>%s</p>" % self.title )
    8.53 +    
    8.54 +    	previous_values = request.args
    8.55 +        
    8.56 +    	for (feild, name) in self.feilds:
    8.57 +            value = sxp.child_value( previous_values, feild )
    8.58 +            if value is None:
    8.59 +            	value = ''
    8.60 +            request.write( "<p>%s<input type='text' name='%s' value='%s'></p>" % (name, feild, value) )
    8.61 +            
    8.62 +    def op_next( self, request ):
    8.63 +    	pass
    8.64 +        
    8.65 +    def op_prev( self, request ):
    8.66 +    	pass        
    8.67 +            
    8.68 +    
    8.69 +      
     9.1 --- a/tools/python/xen/sv/util.py	Mon Jul 26 15:43:27 2004 +0000
     9.2 +++ b/tools/python/xen/sv/util.py	Mon Jul 26 16:18:13 2004 +0000
     9.3 @@ -18,9 +18,9 @@ def sxp2hash( s ):
     9.4          else:
     9.5              sxphash[ child[0] ] = child[1]
     9.6          
     9.7 -    return sxphash
     9.8 +    return sxphash   
     9.9      
    9.10 -def sxp2string( sxp ):
    9.11 +def sxp2prettystring( sxp ):
    9.12      class tmp:
    9.13          def __init__( self ):
    9.14                  self.str = ""
    9.15 @@ -30,14 +30,14 @@ def sxp2string( sxp ):
    9.16      PrettyPrint.prettyprint( sxp, out=temp )
    9.17      return temp.str
    9.18  
    9.19 -def getVar( var, request ):
    9.20 +def getVar( var, request, default=None ):
    9.21     
    9.22      arg = request.args.get( var )
    9.23  
    9.24 -    if arg is None or len(arg) != 1:
    9.25 -        return None
    9.26 +    if arg is None:
    9.27 +        return default
    9.28      else:
    9.29 -        return arg[0]
    9.30 +        return arg[ len( arg )-1 ]
    9.31  
    9.32  def bigTimeFormatter( time ):
    9.33      time = float( time )
    10.1 --- a/tools/sv/Makefile	Mon Jul 26 15:43:27 2004 +0000
    10.2 +++ b/tools/sv/Makefile	Mon Jul 26 16:18:13 2004 +0000
    10.3 @@ -33,6 +33,9 @@ install:
    10.4  	install -m0644 images/reboot.png $(sv_insdir)/images
    10.5  	install -m0644 images/pause.png $(sv_insdir)/images
    10.6  	install -m0644 images/unpause.png $(sv_insdir)/images
    10.7 +        
    10.8 +	install -m0644 images/next.png $(sv_insdir)/images
    10.9 +	install -m0644 images/previous.png $(sv_insdir)/images        
   10.10  
   10.11  	# make include folder
   10.12  	mkdir -p $(sv_insdir)/inc
    11.1 Binary file tools/sv/images/next.png has changed
    12.1 Binary file tools/sv/images/previous.png has changed