ia64/xen-unstable

changeset 1898:fbcefe1a0285

bitkeeper revision 1.1108.1.19 (410147dbq0BGlUNlKhUZaPOQEqSBAg)

Merge scramble.cl.cam.ac.uk:/auto/groups/xeno/BK/xeno.bk
into scramble.cl.cam.ac.uk:/local/scratch/kaf24/hp.bk
author kaf24@scramble.cl.cam.ac.uk
date Fri Jul 23 17:16:11 2004 +0000 (2004-07-23)
parents a66ccef56a68 90591e5e7c45
children 9fd9d87a5a61 3548afc2425d
files .rootkeys linux-2.4.26-xen-sparse/include/asm-xen/pci.h tools/python/xen/sv/DomInfo.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/util.py tools/python/xen/xend/XendClient.py tools/sv/Makefile tools/sv/images/reboot.png tools/sv/images/shutdown.png tools/sv/inc/script.js tools/sv/inc/style.css
line diff
     1.1 --- a/.rootkeys	Fri Jul 23 15:46:31 2004 +0000
     1.2 +++ b/.rootkeys	Fri Jul 23 17:16:11 2004 +0000
     1.3 @@ -442,12 +442,15 @@ 40fcefb3BUT98zPzW8kAFKuxGdh4XA tools/sv/
     1.4  40fcefb38OTgsUKHBpwshLLIsiIaCA tools/sv/images/middle-no-highlight.jpg
     1.5  40fcefb32SPtrw36c4S6YGFlLvkKuw tools/sv/images/orb_01.jpg
     1.6  40fcefb3Ok5qkX3iM7ZEPVkRInrUpg tools/sv/images/orb_02.jpg
     1.7 +41013a82ILk71xLqWFH5ZO5VmOIvBw tools/sv/images/reboot.png
     1.8  40fcefb3JnT5XeKTuVF4yUMGOtuNZg tools/sv/images/right-end-highlight.jpg
     1.9  40fcefb3-DuYOS7noo2W7b_0p7TOUg tools/sv/images/right-end-no-highlight.jpg
    1.10  40fcefb3qNbAZR5FYGPAZ9sFPVMTDA tools/sv/images/seperator-left-highlight.jpg
    1.11  40fcefb3dgsa24WLk_BJeYQHrDLuOg tools/sv/images/seperator-right-highlight.jpg
    1.12  40fcefb3FtiX4Pd2kT8wDlp8u8xRhQ tools/sv/images/seperator.jpg
    1.13 +41013a82sUdUqBv8EoAUJii3gsZ-4g tools/sv/images/shutdown.png
    1.14  40fcefb3yMSrZvApO9ToIi-iQwnchA tools/sv/images/xen.png
    1.15 +41013a83z27rKvWIxAfUBMVZ1eDCDg tools/sv/inc/script.js
    1.16  40fcefb3zGC9XNBkSwTEobCoq8YClA tools/sv/inc/style.css
    1.17  403a3edbrr8RE34gkbR40zep98SXbg tools/xentrace/Makefile
    1.18  40a107afN60pFdURgBv9KwEzgRl5mQ tools/xentrace/formats
     2.1 --- a/linux-2.4.26-xen-sparse/include/asm-xen/pci.h	Fri Jul 23 15:46:31 2004 +0000
     2.2 +++ b/linux-2.4.26-xen-sparse/include/asm-xen/pci.h	Fri Jul 23 17:16:11 2004 +0000
     2.3 @@ -145,7 +145,8 @@ static inline void pci_unmap_page(struct
     2.4  static inline int pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg,
     2.5  			     int nents, int direction)
     2.6  {
     2.7 -	int i;
     2.8 +	int i, j, nr_pfns;
     2.9 +	unsigned long first_pfn;
    2.10  
    2.11  	if (direction == PCI_DMA_NONE)
    2.12  		out_of_line_bug();
    2.13 @@ -159,10 +160,28 @@ static inline int pci_map_sg(struct pci_
    2.14   		else if (!sg[i].address && !sg[i].page)
    2.15   			out_of_line_bug();
    2.16   
    2.17 - 		if (sg[i].address)
    2.18 + 		if (sg[i].address) {
    2.19   			sg[i].dma_address = virt_to_bus(sg[i].address);
    2.20 - 		else
    2.21 + 			first_pfn = virt_to_phys(sg[i].address) >> PAGE_SHIFT;
    2.22 + 			nr_pfns = (((unsigned long)sg[i].address & 
    2.23 + 			    (PAGE_SIZE-1)) + sg[i].length + PAGE_SIZE - 1) >>
    2.24 + 			    PAGE_SHIFT;
    2.25 + 		} else {
    2.26   			sg[i].dma_address = page_to_bus(sg[i].page) + sg[i].offset;
    2.27 + 			first_pfn = page_to_phys(sg[i].page) >> PAGE_SHIFT;
    2.28 + 			nr_pfns = (sg[i].offset + sg[i].length + PAGE_SIZE - 
    2.29 + 			    1) >> PAGE_SHIFT;
    2.30 + 		}
    2.31 +
    2.32 +                /*
    2.33 +                 * Check that we merged physical buffers are also contiguous
    2.34 +                 * in machine-address space. We try to fail by returning 0.
    2.35 +                 */
    2.36 +                for (j = 1; j < nr_pfns; j++) {
    2.37 +                    if ( unlikely(pfn_to_mfn(first_pfn+j) != 
    2.38 +                                  (pfn_to_mfn(first_pfn)+j)) )
    2.39 +                        return 0;
    2.40 +                }
    2.41   	}
    2.42   
    2.43  	flush_write_buffers();
     3.1 --- a/tools/python/xen/sv/DomInfo.py	Fri Jul 23 15:46:31 2004 +0000
     3.2 +++ b/tools/python/xen/sv/DomInfo.py	Fri Jul 23 17:16:11 2004 +0000
     3.3 @@ -14,7 +14,7 @@ class DomInfo( GenTabbed ):
     3.4          def tabUrlWriter( tab ):
     3.5              return urlWriter( "mod=info&dom=%s%s" % ( self.dom, tab ) )
     3.6          
     3.7 -        GenTabbed.__init__( self, tabUrlWriter, [ 'General', 'SXP', 'Devices' ], [ DomGenTab, DomSXPTab, NullTab ]  )
     3.8 +        GenTabbed.__init__( self, "Domain Info", tabUrlWriter, [ 'General', 'SXP', 'Devices' ], [ DomGeneralTab, DomSXPTab, NullTab ]  )
     3.9  
    3.10      def write_BODY( self, request ):
    3.11          dom = request.args.get('dom')
    3.12 @@ -27,6 +27,10 @@ class DomInfo( GenTabbed ):
    3.13          
    3.14          GenTabbed.write_BODY( self, request )
    3.15  
    3.16 +class DomGeneralTab( CompositeTab ):
    3.17 +    def __init__( self ):
    3.18 +       CompositeTab.__init__( self, [ DomGenTab, DomActionTab ] )        
    3.19 +        
    3.20  class DomGenTab( GeneralTab ):
    3.21  
    3.22      def __init__( self ):
    3.23 @@ -41,7 +45,7 @@ class DomGenTab( GeneralTab ):
    3.24          titles[ 'Total CPU' ] = ( 'cpu_time', smallTimeFormatter )
    3.25          titles[ 'Up Time' ] = ( 'up_time', bigTimeFormatter )
    3.26      
    3.27 -        GeneralTab.__init__( self, "General Domain Info", {}, titles )
    3.28 +        GeneralTab.__init__( self, {}, titles )
    3.29          
    3.30      def write_BODY( self, request ):
    3.31      
    3.32 @@ -79,4 +83,18 @@ class DomSXPTab( PreTab ):
    3.33          
    3.34          PreTab.write_BODY( self, request )
    3.35          
    3.36 +class DomActionTab( ActionTab ):
    3.37  
    3.38 +    def __init__( self ):
    3.39 +        ActionTab.__init__( self, { "shutdown" : ( "Shutdown the Domain", "shutdown.png" ),
    3.40 +        	"reboot" : ( "Reboot the Domain", "reboot.png" ) } )    
    3.41 +        
    3.42 +    def op_shutdown( self, request ):
    3.43 +    	print ">DomShutDown"
    3.44 +    	#server.xend_node_shutdown()
    3.45 +    
    3.46 +    def op_reboot( self, request ):
    3.47 +    	print ">DomReboot"
    3.48 +        #server.xend_node_reboot()
    3.49 +        
    3.50 +
     4.1 --- a/tools/python/xen/sv/GenTabbed.py	Fri Jul 23 15:46:31 2004 +0000
     4.2 +++ b/tools/python/xen/sv/GenTabbed.py	Fri Jul 23 17:16:11 2004 +0000
     4.3 @@ -5,12 +5,13 @@ from xen.sv.TabView import TabView
     4.4  
     4.5  class GenTabbed( HTMLBase ):
     4.6  
     4.7 -    def __init__( self, urlWriter, tabStrings, tabObjects ):
     4.8 +    def __init__( self, title, urlWriter, tabStrings, tabObjects ):
     4.9          HTMLBase.__init__(self)
    4.10          self.tab = 0;
    4.11          self.tabStrings = tabStrings
    4.12          self.tabObjects = tabObjects
    4.13          self.urlWriter = urlWriter
    4.14 +        self.title = title
    4.15  
    4.16      def write_BODY( self, request, urlWriter = None ):
    4.17          tab = request.args.get('tab')
    4.18 @@ -23,19 +24,34 @@ class GenTabbed( HTMLBase ):
    4.19          request.write( "<table style='' width='100%' border='0' cellspacing='0' cellpadding='0'>" )
    4.20          request.write( "<tr><td>" )
    4.21          
    4.22 +        request.write( "<p align='center'><u>%s</u></p>" % self.title )
    4.23 +        
    4.24          TabView( self.tab, self.tabStrings, self.urlWriter ).write_BODY( request )
    4.25          
    4.26          request.write( "</td></tr><tr><td>" )
    4.27          
    4.28 -        render_tab = self.tabObjects[ self.tab ]()
    4.29 +        render_tab = self.tabObjects[ self.tab ]
    4.30                  
    4.31          if render_tab is None:
    4.32              request.write( "<p>Bad Tab</p>" )
    4.33              self.finish_BODY( request )
    4.34          else:
    4.35 -            render_tab.write_BODY( request )
    4.36 +            render_tab().write_BODY( request )
    4.37  
    4.38          request.write( "</td></tr></table>" )
    4.39 +       
    4.40 +    def perform( self, request ):
    4.41 +        tab = request.args.get('tab')
    4.42 +        
    4.43 +        if tab is None or len( tab) != 1:
    4.44 +            self.tab = 0
    4.45 +        else:
    4.46 +            self.tab = int( tab[0] )
    4.47 +            
    4.48 +        op_tab = self.tabObjects[ self.tab ]
    4.49 +        
    4.50 +        if op_tab:
    4.51 +            op_tab().perform( request )
    4.52          
    4.53  class PreTab( HTMLBase ):
    4.54  
    4.55 @@ -45,7 +61,7 @@ class PreTab( HTMLBase ):
    4.56      
    4.57      def write_BODY( self, request ):
    4.58          
    4.59 -        request.write( "<div style='display: block; overflow: auto; border: 0px solid black; height: 400px; width: 540px; padding: 5px; z-index:0; align: center'><pre>" )
    4.60 +        request.write( "<div style='display: block; overflow: auto; border: 0px solid black; width: 540px; padding: 5px; z-index:0; align: center'><pre>" )
    4.61          
    4.62          request.write( self.source )
    4.63          
    4.64 @@ -53,16 +69,13 @@ class PreTab( HTMLBase ):
    4.65  
    4.66  class GeneralTab( HTMLBase ):
    4.67                          
    4.68 -    def __init__( self, title, dict, titles ):
    4.69 +    def __init__( self, dict, titles ):
    4.70          HTMLBase.__init__( self )
    4.71 -        self.title = title
    4.72          self.dict = dict
    4.73          self.titles = titles
    4.74                          
    4.75      def write_BODY( self, request ): 
    4.76          
    4.77 -        request.write( "<p><u>%s</u></p>" % self.title )
    4.78 -        
    4.79          request.write( "<table width='100%' cellspacing='0' cellpadding='0' border='0'>" )
    4.80          
    4.81          def writeAttr( niceName, attr, formatter=None ):
    4.82 @@ -90,4 +103,38 @@ class NullTab( HTMLBase ):
    4.83      def write_BODY( self, request ):
    4.84          request.write( "<p>%s</p>" % self.title )
    4.85  
    4.86 +class ActionTab( HTMLBase ):
    4.87 +
    4.88 +    def __init__( self, actions ):
    4.89 +        self.actions = actions
    4.90 +        HTMLBase.__init__( self )
    4.91          
    4.92 +    def write_BODY( self, request ):
    4.93 +        request.write("<p align='center'>")
    4.94 +         
    4.95 +        for ( command, ( text, image ) ) in self.actions.items():
    4.96 +            request.write("<img src='images/%s' width='54' height='54' onclick='doOp( \"%s\" )' onmouseover='update( \"button_desc\", \"%s\" )' " % ( image, command, text ) )
    4.97 +            request.write("onmouseout='update( \"button_desc\", \"&nbsp;\" )' style='button'>")
    4.98 +            request.write("&nbsp;&nbsp;")
    4.99 +    
   4.100 +        request.write("<p align='center'><span id='button_desc'>&nbsp;</span></p>")   
   4.101 +        request.write("</p>")        
   4.102 +        
   4.103 +class CompositeTab( HTMLBase ):
   4.104 +
   4.105 +    def __init__( self, tabs ):
   4.106 +    	HTMLBase.__init__( self )
   4.107 +        self.tabs = tabs
   4.108 +        
   4.109 +    def write_BODY( self, request ):
   4.110 +    	for tab in self.tabs:
   4.111 +            request.write( "<br/>" )
   4.112 +            tab().write_BODY( request )
   4.113 +            
   4.114 +    def perform( self, request ):
   4.115 +    	for tab in self.tabs:
   4.116 +            tab().perform( request )
   4.117 +    
   4.118 +    
   4.119 +       
   4.120 +        
     5.1 --- a/tools/python/xen/sv/HTMLBase.py	Fri Jul 23 15:46:31 2004 +0000
     5.2 +++ b/tools/python/xen/sv/HTMLBase.py	Fri Jul 23 17:16:11 2004 +0000
     5.3 @@ -7,6 +7,10 @@ class HTMLBase( Resource ):
     5.4      def __init__( self ):
     5.5          Resource.__init__(self)
     5.6  
     5.7 +    def render_POST( self, request ):
     5.8 +        self.perform( request )
     5.9 +        self.render_GET( request ) 
    5.10 +        
    5.11      def render_GET( self, request ):
    5.12          self.write_TOP( request )
    5.13          self.write_BODY( request )
    5.14 @@ -19,7 +23,40 @@ class HTMLBase( Resource ):
    5.15          
    5.16      def write_TOP( self, request ):
    5.17          request.write( '<html><head><title>Xen</title><link rel="stylesheet" type="text/css" href="inc/style.css" />' )
    5.18 +        request.write( '<script src="inc/script.js"></script>' )
    5.19          request.write( '</head><body>' )
    5.20  
    5.21      def write_BOTTOM( self, request ):
    5.22 +        request.write('<form method="post" action="%s">' % request.uri)
    5.23 +        request.write('<input type="hidden" name="op" value="">')
    5.24 +        request.write('</form>')
    5.25          request.write( "</body></html>" )
    5.26 +
    5.27 +    def get_op_method(self, op):
    5.28 +        """Get the method for an operation.
    5.29 +        For operation 'foo' looks for 'op_foo'.
    5.30 +
    5.31 +        op	operation name
    5.32 +        returns method or None
    5.33 +        """
    5.34 +        op_method_name = 'op_' + op
    5.35 +        return getattr(self, op_method_name, None)
    5.36 +        
    5.37 +    def perform(self, req):
    5.38 +        """General operation handler for posted operations.
    5.39 +        For operation 'foo' looks for a method op_foo and calls
    5.40 +        it with op_foo(req). Replies with code 500 if op_foo
    5.41 +        is not found.
    5.42 +
    5.43 +        The method must return a list when req.use_sxp is true
    5.44 +        and an HTML string otherwise (or list).
    5.45 +        Methods may also return a Deferred (for incomplete processing).
    5.46 +
    5.47 +        req	request
    5.48 +        """
    5.49 +        op = req.args.get('op')
    5.50 +        if not op is None and len(op) == 1:
    5.51 +            op = op[0]
    5.52 +            op_method = self.get_op_method(op)
    5.53 +            if op_method:
    5.54 +                op_method( req )   
     6.1 --- a/tools/python/xen/sv/Main.py	Fri Jul 23 15:46:31 2004 +0000
     6.2 +++ b/tools/python/xen/sv/Main.py	Fri Jul 23 17:16:11 2004 +0000
     6.3 @@ -1,14 +1,31 @@
     6.4  from xen.sv.HTMLBase import HTMLBase
     6.5 -from xen.sv import DomList, NodeInfo, DomInfo
     6.6 +from xen.sv.DomList  import DomList
     6.7 +from xen.sv.NodeInfo import NodeInfo
     6.8 +from xen.sv.DomInfo  import DomInfo
     6.9  
    6.10  class Main( HTMLBase ):
    6.11      
    6.12      isLeaf = True
    6.13  
    6.14 -    def __init__( self ):
    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          HTMLBase.__init__(self)
    6.20          
    6.21      def render_POST( self, request ):
    6.22 +    
    6.23 +    	#decide what module post'd the action
    6.24 +
    6.25 +        mod = request.args.get('mod')
    6.26 +                
    6.27 +        if not mod is None and len(mod) == 1:
    6.28 +            modTup = self.modules[ mod[0] ]
    6.29 +            #check module exists
    6.30 +            if modTup:
    6.31 +               (modName, module) = modTup
    6.32 +               module( self.mainUrlWriter ).perform( request )     
    6.33 +    
    6.34          return self.render_GET( request )
    6.35  
    6.36      def mainUrlWriter( self, s ):
    6.37 @@ -25,10 +42,10 @@ class Main( HTMLBase ):
    6.38          request.write( "   <img src='images/xen.png' width='150' height='75' border='0'/></a></td></tr>" )
    6.39          request.write( "   <tr><td align='center' valign='top'>" )
    6.40          
    6.41 -        request.write( "    <p class='small'><a href='Main.rpy?mod=node'>Node details</a></p>" )
    6.42 -        request.write( "    <p class='small'><a href='Main.rpy?mod=list'>Domains summary</a></p>" )
    6.43 +        for (modName, (modTitle, module)) in self.modules.items():
    6.44 +            request.write( "    <p class='small'><a href='Main.rpy?mod=%s'>%s</a></p>" % (modName, modTitle))
    6.45      
    6.46 -        DomList.DomList( self.mainUrlWriter ).write_BODY( request, True, False )
    6.47 +        DomList( self.mainUrlWriter ).write_BODY( request, True, False )
    6.48  
    6.49          request.write( "   </td></tr>" )
    6.50          request.write( "  </table>" )
    6.51 @@ -44,14 +61,13 @@ class Main( HTMLBase ):
    6.52          
    6.53          if mod is None or len(mod) != 1:
    6.54              request.write( '<p>Please select a module</p>' )
    6.55 -        elif mod[0] == 'info':
    6.56 -            DomInfo.DomInfo( self.mainUrlWriter ).write_BODY( request )
    6.57 -        elif mod[0] == 'list':
    6.58 -            DomList.DomList( self.mainUrlWriter ).write_BODY( request )
    6.59 -        elif mod[0] == 'node':
    6.60 -            NodeInfo.NodeInfo( self.mainUrlWriter ).write_BODY( request )
    6.61          else:
    6.62 -            request.write( '<p>Invalid module. Please select another</p>' )
    6.63 +            modTup = self.modules[ mod[0] ]
    6.64 +            if modTup:
    6.65 +               (modName, module) = modTup
    6.66 +               module( self.mainUrlWriter ).write_BODY( request )  
    6.67 +            else:
    6.68 +               request.write( '<p>Invalid module. Please select another</p>' )
    6.69      
    6.70          request.write( "   </td></tr>" )
    6.71          request.write( "  </table>" )
     7.1 --- a/tools/python/xen/sv/NodeInfo.py	Fri Jul 23 15:46:31 2004 +0000
     7.2 +++ b/tools/python/xen/sv/NodeInfo.py	Fri Jul 23 17:16:11 2004 +0000
     7.3 @@ -10,24 +10,18 @@ class NodeInfo( GenTabbed ):
     7.4          def newUrlWriter( url ):
     7.5              return urlWriter( "mod=node%s" % url )
     7.6      
     7.7 -        GenTabbed.__init__( self, newUrlWriter, [ 'General', 'Dmesg' ], [ NodeGenTab, NodeDmesgTab ] )
     7.8 +        GenTabbed.__init__( self, "Node Details", newUrlWriter, [ 'General', 'Dmesg', ], [ NodeGeneralTab, NodeDmesgTab ] )
     7.9  
    7.10 -class NodeGenTab( PreTab ):
    7.11 +class NodeGeneralTab( CompositeTab ):
    7.12      def __init__( self ):
    7.13 -       text = sxp2string( server.xend_node() )
    7.14 -       PreTab.__init__( self, text )            
    7.15 -    
    7.16 -class NodeGeneralTab( GeneralTab ):
    7.17 +    	CompositeTab.__init__( self, [ NodeInfoTab, NodeActionTab ] )        
    7.18 +        
    7.19 +class NodeInfoTab( GeneralTab ):
    7.20                          
    7.21      def __init__( self ):
    7.22           
    7.23 -        nodeInfo = server.xend_node()
    7.24 -        
    7.25 -        dictNodeInfo = {}
    7.26 -        
    7.27 -        for l in nodeInfo:
    7.28 -            dictNodeInfo[ l[0] ] = l[1]
    7.29 -            
    7.30 +        nodeInfo = sxp2hash( server.xend_node() )
    7.31 +    
    7.32          dictTitles = {}
    7.33          dictTitles[ 'System' ] = 'system'
    7.34          dictTitles[ 'Hostname' ] = 'host' 
    7.35 @@ -40,11 +34,24 @@ class NodeGeneralTab( GeneralTab ):
    7.36          dictTitles[ 'Memory' ] = ( 'memory', memoryFormatter )
    7.37          dictTitles[ 'Free Memory' ] = ( 'free_memory', memoryFormatter )
    7.38          
    7.39 -        GeneralTab.__init__( self, title="General Node Info", dict=dictNodeInfo, titles=dictTitles )
    7.40 +        GeneralTab.__init__( self, dict=nodeInfo, titles=dictTitles )
    7.41  
    7.42  class NodeDmesgTab( PreTab ):
    7.43  
    7.44      def __init__( self ):
    7.45          dmesg = server.xend_node_dmesg()
    7.46          PreTab.__init__( self, dmesg[ 1 ] )
    7.47 +  
    7.48 +class NodeActionTab( ActionTab ):
    7.49 +
    7.50 +    def __init__( self ):
    7.51 +        ActionTab.__init__( self, { "shutdown" : ( "Shutdown the Node", "shutdown.png" ),
    7.52 +        	"reboot" : ( "Reboot the Node", "reboot.png" ) } )    
    7.53 +        
    7.54 +    def op_shutdown( self, request ):
    7.55 +    	print ">NodeShutDown"
    7.56 +    	#server.xend_node_shutdown()
    7.57      
    7.58 +    def op_reboot( self, request ):
    7.59 +    	print ">NodeReboot"
    7.60 +        #server.xend_node_reboot()
     8.1 --- a/tools/python/xen/sv/util.py	Fri Jul 23 15:46:31 2004 +0000
     8.2 +++ b/tools/python/xen/sv/util.py	Fri Jul 23 17:16:11 2004 +0000
     8.3 @@ -17,8 +17,13 @@ def getDomInfoHash( domain ):
     8.4          d['start_time'] = float( sxp.child_value( domInfo, 'start_time' ) )
     8.5      return d
     8.6  
     8.7 -def sxp2hash( sxp ):
     8.8 -    pass
     8.9 +def sxp2hash( s ):
    8.10 +    sxphash = {}
    8.11 +        
    8.12 +    for child in sxp.children( s ):
    8.13 +        sxphash[ child[0] ] = child[1]
    8.14 +        
    8.15 +    return sxphash
    8.16      
    8.17  def sxp2string( sxp ):
    8.18      class tmp:
    8.19 @@ -58,7 +63,12 @@ def stateFormatter( state ):
    8.20      return state
    8.21      
    8.22  def memoryFormatter( mem ):
    8.23 -    return "%7dMb" % mem
    8.24 +    mem = int( mem )
    8.25 +    if mem >= 1024:
    8.26 +        mem = float( mem ) / 1024
    8.27 +        return "%3.2fGb" % mem
    8.28 +    else:    
    8.29 +        return "%7dMb" % mem
    8.30  
    8.31  def cpuFormatter( mhz ):
    8.32      if mhz > 1000:
     9.1 --- a/tools/python/xen/xend/XendClient.py	Fri Jul 23 15:46:31 2004 +0000
     9.2 +++ b/tools/python/xen/xend/XendClient.py	Fri Jul 23 17:16:11 2004 +0000
     9.3 @@ -406,6 +406,14 @@ class Xend:
     9.4      def xend_node(self):
     9.5          return self.xendGet(self.nodeurl())
     9.6          
     9.7 +    def xend_node_shutdown(self):
     9.8 +        return self.xendPost(self.nodeurl(),
     9.9 +                {'op'      : 'shutdown'})
    9.10 +                
    9.11 +    def xend_node_restart(self):
    9.12 +        return self.xendPost(self.nodeurl(),
    9.13 +                {'op'      : 'reboot'})
    9.14 +
    9.15      def xend_node_dmesg(self):
    9.16          return self.xendGet(self.dmesgurl())
    9.17  
    10.1 --- a/tools/sv/Makefile	Fri Jul 23 15:46:31 2004 +0000
    10.2 +++ b/tools/sv/Makefile	Fri Jul 23 17:16:11 2004 +0000
    10.3 @@ -28,12 +28,16 @@ install:
    10.4  	install -m0644 images/seperator.jpg $(sv_insdir)/images
    10.5  	install -m0644 images/seperator-left-highlight.jpg $(sv_insdir)/images
    10.6  	install -m0644 images/seperator-right-highlight.jpg $(sv_insdir)/images
    10.7 +	
    10.8 +	install -m0644 images/shutdown.png $(sv_insdir)/images
    10.9 +	install -m0644 images/reboot.png $(sv_insdir)/images
   10.10  
   10.11  	# make include folder
   10.12  	mkdir -p $(sv_insdir)/inc
   10.13  	
   10.14  	# copy stylesheet
   10.15  	install -m0644 inc/style.css $(sv_insdir)/inc
   10.16 +	install -m0644 inc/script.js $(sv_insdir)/inc
   10.17  
   10.18  clean:
   10.19  
    11.1 Binary file tools/sv/images/reboot.png has changed
    12.1 Binary file tools/sv/images/shutdown.png has changed
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/tools/sv/inc/script.js	Fri Jul 23 17:16:11 2004 +0000
    13.3 @@ -0,0 +1,15 @@
    13.4 +function update( objRef, text )
    13.5 +{
    13.6 +    if ( document.all || document.getElementById )
    13.7 +    {
    13.8 +        obj = ( document.getElementById )? document.getElementById( objRef ) : document.all( objRef );
    13.9 +
   13.10 +        obj.innerHTML= text
   13.11 +    }
   13.12 +}
   13.13 +
   13.14 +function doOp( op )
   13.15 +{
   13.16 +    document.forms[0].op.value = op
   13.17 +    document.forms[0].submit()
   13.18 +}
    14.1 --- a/tools/sv/inc/style.css	Fri Jul 23 15:46:31 2004 +0000
    14.2 +++ b/tools/sv/inc/style.css	Fri Jul 23 17:16:11 2004 +0000
    14.3 @@ -27,4 +27,6 @@ body {
    14.4  	
    14.5  	
    14.6  	}
    14.7 -	
    14.8 \ No newline at end of file
    14.9 +        
   14.10 +.button (cursor:hand)
   14.11 +