ia64/xen-unstable

changeset 2818:fe33dd531fd0

bitkeeper revision 1.1159.1.329 (4186e250v4q4bACc3tLT1SAh95SQxw)

A coven of new wizards for Xensv (please test). Some of this might
need refactoring but it should make the web interface more useful.

also: misc version updates, some extra docs stuff.
author mwilli2@equilibrium.research
date Tue Nov 02 01:26:40 2004 +0000 (2004-11-02)
parents d60426da6f4c
children 5f6940f63507
files .rootkeys docs/src/user.tex tools/examples/xmexample1 tools/examples/xmexample2 tools/python/xen/sv/CreateDomain.py tools/python/xen/sv/Main.py tools/python/xen/sv/MigrateDomain.py tools/python/xen/sv/RestoreDomain.py tools/python/xen/sv/SaveDomain.py
line diff
     1.1 --- a/.rootkeys	Mon Nov 01 19:34:24 2004 +0000
     1.2 +++ b/.rootkeys	Tue Nov 02 01:26:40 2004 +0000
     1.3 @@ -423,7 +423,10 @@ 40fcefb2-RIU8GB67mJMRzybME9bxw tools/pyt
     1.4  40fcefb23FfQn-ZBCbcHqA0cPGqQxw tools/python/xen/sv/GenTabbed.py
     1.5  40fcefb2QZAn3u3sX-M7NXBjOv5HGg tools/python/xen/sv/HTMLBase.py
     1.6  40fcefb2vnfDbl4w_yCTedROPuqs0g tools/python/xen/sv/Main.py
     1.7 +4186e24fZMp7_bX4f50MvUscdrST9Q tools/python/xen/sv/MigrateDomain.py
     1.8  40fcefb24h-04WaHag-Tg4nxWPhTig tools/python/xen/sv/NodeInfo.py
     1.9 +4186e24fb4YtJw155tNtSXXN6nEWqA tools/python/xen/sv/RestoreDomain.py
    1.10 +4186e24fVXt0lfeQSAy1eiFKnPCHTg tools/python/xen/sv/SaveDomain.py
    1.11  40fcefb2Sif__6AqrANeBQZZfvP-6w tools/python/xen/sv/TabView.py
    1.12  41052eb8UrgtUkuJPg7oY1tutVQHsg tools/python/xen/sv/Wizard.py
    1.13  40fcefb2DqteqCCZYDCvvh4Q5jBd0w tools/python/xen/sv/__init__.py
     2.1 --- a/docs/src/user.tex	Mon Nov 01 19:34:24 2004 +0000
     2.2 +++ b/docs/src/user.tex	Tue Nov 02 01:26:40 2004 +0000
     2.3 @@ -314,7 +314,7 @@ complicated.  The makefile needs a `pris
     2.4  it will then add the Xen architecture files.  You can tell the
     2.5  makefile the location of the appropriate Linux compressed tar file by
     2.6  setting the LINUX\_SRC environment variable, e.g. \\
     2.7 -\verb!# LINUX_SRC=/tmp/linux-2.6.8.1.tar.bz2 make world! \\ or by
     2.8 +\verb!# LINUX_SRC=/tmp/linux-2.6.9.tar.bz2 make world! \\ or by
     2.9  placing the tar file somewhere in the search path of {\tt
    2.10  LINUX\_SRC\_PATH} which defaults to `{\tt .:..}'.  If the makefile
    2.11  can't find a suitable kernel tar file it attempts to download it from
    2.12 @@ -342,7 +342,7 @@ argument to make to get a parallel build
    2.13  
    2.14  If you have an existing Linux kernel configuration that you would like
    2.15  to use for domain 0, you should copy it to
    2.16 -install/boot/config-2.6.8.1-xen0.  During the first build, you may be
    2.17 +install/boot/config-2.6.9-xen0.  During the first build, you may be
    2.18  asked about some Xen-specific options.  We advise accepting the
    2.19  defaults for these options.
    2.20  
    2.21 @@ -364,8 +364,8 @@ destinations.
    2.22  Files in \path{install/boot/} include:
    2.23  \begin{itemize}
    2.24  \item \path{install/boot/xen.gz} The Xen 'kernel'
    2.25 -\item \path{install/boot/vmlinuz-2.6.8.1-xen0}  Domain 0 XenLinux kernel
    2.26 -\item \path{install/boot/vmlinuz-2.6.8.1-xenU}  Unprivileged XenLinux kernel
    2.27 +\item \path{install/boot/vmlinuz-2.6.9-xen0}  Domain 0 XenLinux kernel
    2.28 +\item \path{install/boot/vmlinuz-2.6.9-xenU}  Unprivileged XenLinux kernel
    2.29  \end{itemize}
    2.30  
    2.31  The difference between the two Linux kernels that are built is due to
    2.32 @@ -379,7 +379,7 @@ domains.
    2.33  The \path{install/boot} directory will also contain the config files
    2.34  used for building the XenLinux kernels, and also versions of Xen and
    2.35  XenLinux kernels that contain debug symbols (\path{xen-syms} and
    2.36 -\path{vmlinux-syms-2.6.8.1-xen0}) which are essential for interpreting crash
    2.37 +\path{vmlinux-syms-2.6.9-xen0}) which are essential for interpreting crash
    2.38  dumps.  Retain these files as the developers may wish to see them if
    2.39  you post on the mailing list.
    2.40  
    2.41 @@ -393,9 +393,9 @@ This file is sometimes called \path{menu
    2.42  distribution.  The entry should look something like the following:
    2.43  
    2.44  \begin{verbatim}
    2.45 -title Xen 2.0 / XenLinux 2.6.8.1
    2.46 +title Xen 2.0 / XenLinux 2.6.9
    2.47    kernel /boot/xen.gz dom0_mem=131072 com1=115200,8n1
    2.48 -  module /boot/vmlinuz-2.6.8.1-xen0 root=/dev/sda4 ro console=tty0 console=ttyS0
    2.49 +  module /boot/vmlinuz-2.6.9-xen0 root=/dev/sda4 ro console=tty0 console=ttyS0
    2.50  \end{verbatim}
    2.51  
    2.52  The first line of the configuration (kernel...) tells GRUB where to
    2.53 @@ -575,7 +575,7 @@ basics.
    2.54  \item Download the ttylinux disk image from XXX where from?
    2.55  \item Create a configuration file like the following:
    2.56  \begin{verbatim}
    2.57 -kernel = "/boot/vmlinuz-2.6.8.1-xenU" # or a 2.4 kernel or a xen0 kernel
    2.58 +kernel = "/boot/vmlinuz-2.6.9-xenU" # or a 2.4 kernel or a xen0 kernel
    2.59  memory = 64
    2.60  name = "ttylinux"
    2.61  cpu = -1 # leave to Xen to pick
    2.62 @@ -905,9 +905,11 @@ docs to do advanced stuff.
    2.63  \chapter{Domain Configuration Files}
    2.64  \label{cha:config}
    2.65  
    2.66 -XXX Could use a little explanation about possible values
    2.67 +XX Could use a little explanation about possible values
    2.68  
    2.69 -Xen configuration files contain the following standard variables:
    2.70 +Xen configuration files contain the following standard variables.
    2.71 +Unless otherwise stated, configuration items should be enclosed in
    2.72 +quotes (i.e. {\tt '...'} or {\tt ``....''})):
    2.73  
    2.74  \begin{description}
    2.75  \item[kernel] Path to the kernel image (on the server).
    2.76 @@ -916,8 +918,20 @@ Xen configuration files contain the foll
    2.77  \item[memory] Memory size in megabytes.
    2.78  \item[cpu] CPU to assign this domain to.
    2.79  \item[nics] Number of virtual network interfaces.
    2.80 -\item[vif] List of MAC addresses (random addresses are assigned if not given).
    2.81 -\item[disk] Regions of disk to export to the domain.
    2.82 +\item[vif] List of MAC addresses (random addresses are assigned if not given) and /
    2.83 +  or bridges to use for the domains network interfaces. e.g. \\
    2.84 +  \verb_vif = [ 'mac=aa:00:00:00:00:11, bridge=xen-br0', 'bridge=xen-br1' ]_
    2.85 +  to assign a MAC address and bridge to the first interface and assign a
    2.86 +  different bridge to the second interface, leaving Xend to choose the MAC
    2.87 +  address.
    2.88 +\item[disk] List of block devices to export to the domain.  e.g. \\
    2.89 +  \verb_disk = [ 'phy:hda1,sda1,r' ]_ \\
    2.90 +  exports device \path{/dev/hda1} to the domain, as \path{/dev/sda1} with
    2.91 +  readonly access being allowed. \\
    2.92 +  \verb_disk = [ 'phy:hda7,sda2,w', 'phy:hdb2,sda,w!' ]_ \\
    2.93 +  exports device \path{/dev/hda7} to the domain as \path{/dev/sda2} with
    2.94 +  write access enabled and \path{/dev/hdb2} as \path{/dev/sda} with write access
    2.95 +  force enabled (bypassing safety checks).
    2.96  \item[dhcp] Set to {\tt 'dhcp'} if you want to DHCP allocate the IP address.
    2.97  \item[netmask] IP netmask.
    2.98  \item[gateway] IP address for the gateway (if any).
     3.1 --- a/tools/examples/xmexample1	Mon Nov 01 19:34:24 2004 +0000
     3.2 +++ b/tools/examples/xmexample1	Tue Nov 02 01:26:40 2004 +0000
     3.3 @@ -8,7 +8,7 @@
     3.4  
     3.5  #----------------------------------------------------------------------------
     3.6  # Kernel image file.
     3.7 -kernel = "/boot/vmlinuz-2.6.8.1-xenU"
     3.8 +kernel = "/boot/vmlinuz-2.6.9-xenU"
     3.9  
    3.10  # Optional ramdisk.
    3.11  #ramdisk = "/boot/initrd.gz"
     4.1 --- a/tools/examples/xmexample2	Mon Nov 01 19:34:24 2004 +0000
     4.2 +++ b/tools/examples/xmexample2	Tue Nov 02 01:26:40 2004 +0000
     4.3 @@ -36,7 +36,7 @@ xm_vars.check()
     4.4  
     4.5  #----------------------------------------------------------------------------
     4.6  # Kernel image file.
     4.7 -kernel = "/boot/vmlinuz-2.6.8.1-xenU"
     4.8 +kernel = "/boot/vmlinuz-2.6.9-xenU"
     4.9  
    4.10  # Optional ramdisk.
    4.11  #ramdisk = "/boot/initrd.gz"
     5.1 --- a/tools/python/xen/sv/CreateDomain.py	Mon Nov 01 19:34:24 2004 +0000
     5.2 +++ b/tools/python/xen/sv/CreateDomain.py	Tue Nov 02 01:26:40 2004 +0000
     5.3 @@ -16,7 +16,7 @@ class CreateDomain( Wizard ):
     5.4                     CreatePage4,
     5.5                     CreateFinish ]
     5.6      
     5.7 -    	Wizard.__init__( self, urlWriter, "Create Domain Wizard", sheets )
     5.8 +    	Wizard.__init__( self, urlWriter, "Create Domain", sheets )
     5.9         
    5.10  class CreatePage0( Sheet ):
    5.11  
    5.12 @@ -31,7 +31,8 @@ class CreatePage1( Sheet ):
    5.13  
    5.14      def __init__( self, urlWriter ):
    5.15          Sheet.__init__( self, urlWriter, "Setup Kernel Image", 1 )
    5.16 -        self.addControl( ListControl( 'builder', [('linux', 'Linux'), ('netbsd', 'NetBSD')], 'Kernel Type:' ) )
    5.17 +# For now we don't need to select a builder...
    5.18 +#        self.addControl( ListControl( 'builder', [('linux', 'Linux'), ('netbsd', 'NetBSD')], 'Kernel Type:' ) )
    5.19          self.addControl( FileControl( 'kernel', '/boot/vmlinuz-2.6.9-xenU', 'Kernel Image:' ) )
    5.20          self.addControl( InputControl( 'extra', '', 'Kernel Command Line Parameters:' ) )
    5.21  
     6.1 --- a/tools/python/xen/sv/Main.py	Mon Nov 01 19:34:24 2004 +0000
     6.2 +++ b/tools/python/xen/sv/Main.py	Tue Nov 02 01:26:40 2004 +0000
     6.3 @@ -3,6 +3,9 @@ from xen.sv.DomList  import DomList
     6.4  from xen.sv.NodeInfo import NodeInfo
     6.5  from xen.sv.DomInfo  import DomInfo
     6.6  from xen.sv.CreateDomain import CreateDomain
     6.7 +from xen.sv.MigrateDomain import MigrateDomain
     6.8 +from xen.sv.SaveDomain import SaveDomain
     6.9 +from xen.sv.RestoreDomain import RestoreDomain
    6.10  
    6.11  from xen.xend.XendClient import server
    6.12  
    6.13 @@ -16,7 +19,14 @@ class Main( HTMLBase ):
    6.14          self.modules = { "node": NodeInfo, 
    6.15                           "list": DomList, 
    6.16                           "info": DomInfo,
    6.17 -                         "create": CreateDomain }
    6.18 +                         "create": CreateDomain,
    6.19 +                         "migrate" : MigrateDomain,
    6.20 +                         "save" : SaveDomain,
    6.21 +                         "restore" : RestoreDomain }
    6.22 +
    6.23 +        # ordered list of module menus to display
    6.24 +        self.module_menus = [ "node", "create", "migrate", "save",
    6.25 +                              "restore", "list" ]
    6.26          HTMLBase.__init__(self)
    6.27          
    6.28      def render_POST( self, request ):
    6.29 @@ -53,10 +63,10 @@ class Main( HTMLBase ):
    6.30          request.write( "   <img src='images/xen.png' width='150' height='75' border='0'/></a><br/></td></tr>" )
    6.31          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.32          request.write( "   <tr><td align='center' valign='top'>" )
    6.33 +
    6.34 +        for modName in self.module_menus:
    6.35 +            self.modules[modName]( self.mainUrlWriter( modName ) ).write_MENU( request )
    6.36          
    6.37 -        for (modName, module) in self.modules.items():
    6.38 -            module( self.mainUrlWriter( modName ) ).write_MENU( request )
    6.39 -
    6.40          request.write( "   </td></tr>" )
    6.41          request.write( "  </table>" )
    6.42          request.write( " &nbsp;" )
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/tools/python/xen/sv/MigrateDomain.py	Tue Nov 02 01:26:40 2004 +0000
     7.3 @@ -0,0 +1,72 @@
     7.4 +from xen.sv.Wizard import *
     7.5 +from xen.sv.util import *
     7.6 +from xen.sv.GenTabbed import PreTab
     7.7 +
     7.8 +from xen.xm.create import make_config, OptVals
     7.9 +
    7.10 +from xen.xend.XendClient import server
    7.11 +
    7.12 +class MigrateDomain( Wizard ):
    7.13 +    def __init__( self, urlWriter ):
    7.14 +
    7.15 +        sheets = [ ChooseMigrateDomain,
    7.16 +                   DoMigrate ]
    7.17 +
    7.18 +        Wizard.__init__( self, urlWriter, "Migrate Domain", sheets )
    7.19 +
    7.20 +
    7.21 +class ChooseMigrateDomain( Sheet ):
    7.22 +    def __init__( self, urlWriter ):
    7.23 +        Sheet.__init__( self, urlWriter, "Configure Migration", 0)
    7.24 +        try:
    7.25 +            domains = server.xend_domains()
    7.26 +            domains.sort()
    7.27 +        except:
    7.28 +            pass
    7.29 +
    7.30 +        domnames = []
    7.31 +        for i in domains:
    7.32 +            if i != 'Domain-0': domnames.append((i,i))
    7.33 +        
    7.34 +        self.addControl( ListControl('domid',
    7.35 +                                     domnames,
    7.36 +                                     'Domain ID:') )
    7.37 +        self.addControl( TickControl('live',
    7.38 +                                     'True',
    7.39 +                                     'Live migrate:') )
    7.40 +        self.addControl( InputControl('rate',
    7.41 +                                      '0',
    7.42 +                                      'Rate limit:') )
    7.43 +        self.addControl( InputControl( 'dest', 'myhost.mydomain',
    7.44 +                                       'Name or IP address:',
    7.45 +                                       ".*") )
    7.46 +
    7.47 +class DoMigrate( Sheet ):
    7.48 +    def __init__(self, urlWriter ):
    7.49 +        Sheet.__init__(self, urlWriter, "Migration Done", 1)
    7.50 +
    7.51 +    def write_BODY( self, request, err ):
    7.52 +
    7.53 +        if not self.passback: self.parseForm( request )
    7.54 +
    7.55 +#        print string2sxp(self.passback)
    7.56 +        
    7.57 +        config = ssxp2hash ( string2sxp( self.passback ) )
    7.58 +      
    7.59 +        try:
    7.60 +            print config
    7.61 +            print config['domid'], config['dest']
    7.62 +            dom_sxp = server.xend_domain_migrate( config['domid'],
    7.63 +                                                  config['dest'],
    7.64 +                                                  config.get('live') == 'True',
    7.65 +                                                  config['rate'] )
    7.66 +            success = "Your domain was successfully Migrated.\n"
    7.67 +        except Exception, e:
    7.68 +            success = "There was an error migrating your domain\n"
    7.69 +            dom_sxp = str(e)
    7.70 +        
    7.71 +        pt = PreTab( success + dom_sxp ) # sxp2prettystring( dom_sxp ) )
    7.72 +        pt.write_BODY( request )
    7.73 +
    7.74 +        request.write( "<input type='hidden' name='passback' value=\"%s\"></p>" % self.passback )
    7.75 +        request.write( "<input type='hidden' name='sheet' value='%s'></p>" % self.location )
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/tools/python/xen/sv/RestoreDomain.py	Tue Nov 02 01:26:40 2004 +0000
     8.3 @@ -0,0 +1,46 @@
     8.4 +from xen.sv.Wizard import *
     8.5 +from xen.sv.util import *
     8.6 +from xen.sv.GenTabbed import PreTab
     8.7 +
     8.8 +from xen.xm.create import make_config, OptVals
     8.9 +
    8.10 +from xen.xend.XendClient import server
    8.11 +
    8.12 +class RestoreDomain( Wizard ):
    8.13 +    def __init__( self, urlWriter ):
    8.14 +
    8.15 +        sheets = [ ChooseRestoreDomain,
    8.16 +                   DoRestore ]
    8.17 +
    8.18 +        Wizard.__init__( self, urlWriter, "Restore Domain", sheets )
    8.19 +
    8.20 +
    8.21 +class ChooseRestoreDomain( Sheet ):
    8.22 +    def __init__( self, urlWriter ):
    8.23 +        Sheet.__init__( self, urlWriter, "Configure Restore", 0)
    8.24 +        
    8.25 +        self.addControl( InputControl( 'file', '',
    8.26 +                                       'Suspend file name:',
    8.27 +                                       ".*") )
    8.28 +
    8.29 +class DoRestore( Sheet ):
    8.30 +    def __init__(self, urlWriter ):
    8.31 +        Sheet.__init__(self, urlWriter, "Restore Done", 1)
    8.32 +
    8.33 +    def write_BODY( self, request, err ):
    8.34 +
    8.35 +        if not self.passback: self.parseForm( request )
    8.36 +        config = ssxp2hash ( string2sxp( self.passback ) )
    8.37 +      
    8.38 +        try:
    8.39 +            dom_sxp = server.xend_domain_restore( config['file'] )
    8.40 +            success = "Your domain was successfully restored.\n"
    8.41 +        except Exception, e:
    8.42 +            success = "There was an error restoring your domain\n"
    8.43 +            dom_sxp = str(e)
    8.44 +        
    8.45 +        pt = PreTab( success + sxp2prettystring( dom_sxp ) )
    8.46 +        pt.write_BODY( request )
    8.47 +
    8.48 +        request.write( "<input type='hidden' name='passback' value=\"%s\"></p>" % self.passback )
    8.49 +        request.write( "<input type='hidden' name='sheet' value='%s'></p>" % self.location )
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/tools/python/xen/sv/SaveDomain.py	Tue Nov 02 01:26:40 2004 +0000
     9.3 @@ -0,0 +1,59 @@
     9.4 +from xen.sv.Wizard import *
     9.5 +from xen.sv.util import *
     9.6 +from xen.sv.GenTabbed import PreTab
     9.7 +
     9.8 +from xen.xm.create import make_config, OptVals
     9.9 +
    9.10 +from xen.xend.XendClient import server
    9.11 +
    9.12 +class SaveDomain( Wizard ):
    9.13 +    def __init__( self, urlWriter ):
    9.14 +
    9.15 +        sheets = [ ChooseSaveDomain,
    9.16 +                   DoSave ]
    9.17 +
    9.18 +        Wizard.__init__( self, urlWriter, "Save Domain", sheets )
    9.19 +
    9.20 +
    9.21 +class ChooseSaveDomain( Sheet ):
    9.22 +    def __init__( self, urlWriter ):
    9.23 +        Sheet.__init__( self, urlWriter, "Configure Save", 0)
    9.24 +        try:
    9.25 +            domains = server.xend_domains()
    9.26 +            domains.sort()
    9.27 +        except:
    9.28 +            pass
    9.29 +
    9.30 +        domnames = []
    9.31 +        for i in domains:
    9.32 +            if i != 'Domain-0': domnames.append((i,i))
    9.33 +        
    9.34 +        self.addControl( ListControl('domid',
    9.35 +                                     domnames,
    9.36 +                                     'Domain ID:') )
    9.37 +        self.addControl( InputControl( 'file', '',
    9.38 +                                       'Suspend file name:',
    9.39 +                                       ".*") )
    9.40 +
    9.41 +class DoSave( Sheet ):
    9.42 +    def __init__(self, urlWriter ):
    9.43 +        Sheet.__init__(self, urlWriter, "Save Done", 1)
    9.44 +
    9.45 +    def write_BODY( self, request, err ):
    9.46 +
    9.47 +        if not self.passback: self.parseForm( request )
    9.48 +        config = ssxp2hash ( string2sxp( self.passback ) )
    9.49 +      
    9.50 +        try:
    9.51 +            dom_sxp = server.xend_domain_save( config['domid'],
    9.52 +                                                  config['file'] )
    9.53 +            success = "Your domain was successfully saved.\n"
    9.54 +        except Exception, e:
    9.55 +            success = "There was an error saving your domain\n"
    9.56 +            dom_sxp = str(e)
    9.57 +        
    9.58 +        pt = PreTab( success + dom_sxp ) # sxp2prettystring( dom_sxp ) )
    9.59 +        pt.write_BODY( request )
    9.60 +
    9.61 +        request.write( "<input type='hidden' name='passback' value=\"%s\"></p>" % self.passback )
    9.62 +        request.write( "<input type='hidden' name='sheet' value='%s'></p>" % self.location )