direct-io.hg

changeset 2196:443ede9ad110

bitkeeper revision 1.1159.1.39 (411b2c1eB-OtkNjmHHNtVbwq7l26OA)

Add xm migrate command.
author mjw@wray-m-3.hpl.hp.com
date Thu Aug 12 08:36:46 2004 +0000 (2004-08-12)
parents 5de156da549c
children 95d17d8191a5
files .rootkeys tools/python/xen/xend/XendMigrate.py tools/python/xen/xm/main.py tools/python/xen/xm/migrate.py
line diff
     1.1 --- a/.rootkeys	Thu Aug 12 07:44:17 2004 +0000
     1.2 +++ b/.rootkeys	Thu Aug 12 08:36:46 2004 +0000
     1.3 @@ -435,6 +435,7 @@ 40cf2937gKQcATgXKGtNeWb1PDH5nA tools/pyt
     1.4  40f552eariuUSB9TWqCPnDLz5zvxMw tools/python/xen/xm/destroy.py
     1.5  40e41cd2w0I4En6qrJn4em8HkK_oxQ tools/python/xen/xm/help.py
     1.6  40cf2937isyS250zyd0Q2GuEDoNXfQ tools/python/xen/xm/main.py
     1.7 +411b2c1ehdEGO_CwG0tvn85Q-Tfh5g tools/python/xen/xm/migrate.py
     1.8  40cf2937PSslwBliN1g7ofDy2H_RhA tools/python/xen/xm/opts.py
     1.9  40cf2937Z8WCNOnO2FcWdubvEAF9QQ tools/python/xen/xm/shutdown.py
    1.10  40fcefb2K1xqVVT4D-p7nL2GzS4scg tools/sv/Main.rpy
     2.1 --- a/tools/python/xen/xend/XendMigrate.py	Thu Aug 12 07:44:17 2004 +0000
     2.2 +++ b/tools/python/xen/xend/XendMigrate.py	Thu Aug 12 08:36:46 2004 +0000
     2.3 @@ -289,7 +289,7 @@ class XendMigrateInfo(XfrdInfo):
     2.4              eserver.inject('xend.migrate.ok', self.sxpr())
     2.5          else:
     2.6              self.state = 'error'
     2.7 -            self.error(XendError("save failed"))
     2.8 +            self.error(XendError("migrate failed"))
     2.9              eserver.inject('xend.migrate.error', self.sxpr())
    2.10  
    2.11  class XendSaveInfo(XfrdInfo):
     3.1 --- a/tools/python/xen/xm/main.py	Thu Aug 12 07:44:17 2004 +0000
     3.2 +++ b/tools/python/xen/xm/main.py	Thu Aug 12 08:36:46 2004 +0000
     3.3 @@ -11,7 +11,7 @@ from xen.xend import PrettyPrint
     3.4  from xen.xend import sxp
     3.5  from xen.xend.XendClient import XendError, server
     3.6  from xen.xend.XendClient import main as xend_client_main
     3.7 -from xen.xm import create, destroy, shutdown
     3.8 +from xen.xm import create, destroy, migrate, shutdown
     3.9  
    3.10  class Group:
    3.11  
    3.12 @@ -296,6 +296,19 @@ class ProgRestore(Prog):
    3.13  
    3.14  xm.prog(ProgRestore)
    3.15  
    3.16 +class ProgMigrate(Prog):
    3.17 +    group = 'domain'
    3.18 +    name = "migrate"
    3.19 +    info = """Migrate a domain to another machine."""
    3.20 +
    3.21 +    def help(self, args):
    3.22 +        migrate.help(arg)
    3.23 +    
    3.24 +    def main(self, args):
    3.25 +        migrate.main(args)
    3.26 +
    3.27 +xm.prog(ProgMigrate)
    3.28 +
    3.29  class ProgList(Prog):
    3.30      group = 'domain'
    3.31      name = "list"
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/tools/python/xen/xm/migrate.py	Thu Aug 12 08:36:46 2004 +0000
     4.3 @@ -0,0 +1,41 @@
     4.4 +# Copyright (C) 2004 Mike Wray <mike.wray@hp.com>
     4.5 +
     4.6 +"""Domain migration.
     4.7 +"""
     4.8 +
     4.9 +import sys
    4.10 +
    4.11 +from xen.xend.XendClient import server
    4.12 +from xen.xm.opts import *
    4.13 +
    4.14 +DOM0_NAME = 'Domain-0'
    4.15 +DOM0_ID = '0'
    4.16 +
    4.17 +gopts = Opts(use="""[options] DOM HOST
    4.18 +
    4.19 +Migrate domain DOM to host HOST.
    4.20 +The transfer daemon xfrd must be running on the
    4.21 +local host and on HOST.
    4.22 +""")
    4.23 +
    4.24 +gopts.opt('help', short='h',
    4.25 +         fn=set_true, default=0,
    4.26 +         use="Print this help.")
    4.27 +
    4.28 +def help(argv):
    4.29 +    gopts.usage()
    4.30 +    
    4.31 +def main(argv):
    4.32 +    opts = gopts
    4.33 +    args = opts.parse(argv)
    4.34 +    if opts.vals.help:
    4.35 +        opts.usage()
    4.36 +        return
    4.37 +    if len(args) != 2:
    4.38 +        opts.err('Invalid arguments')
    4.39 +    dom = args[0]
    4.40 +    dst = args[1]
    4.41 +    if dom in [DOM0_NAME, DOM0_ID]:
    4.42 +        opts.err('Cannot migrate ' + dom)
    4.43 +    server.xend_domain_migrate(dom, dst)
    4.44 +