ia64/xen-unstable

view tools/python/xen/xm/migrate.py @ 8824:52b2dc7fb9b7

Parse --port argument to migration.

Patch by Andres Lagar Cavilla <andreslc@cs.toronto.edu>.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author emellor@leeni.uk.xensource.com
date Fri Feb 10 02:09:19 2006 +0100 (2006-02-10)
parents 669b6252deee
children 5c9c44fc1c39
line source
1 #============================================================================
2 # This library is free software; you can redistribute it and/or
3 # modify it under the terms of version 2.1 of the GNU Lesser General Public
4 # License as published by the Free Software Foundation.
5 #
6 # This library is distributed in the hope that it will be useful,
7 # but WITHOUT ANY WARRANTY; without even the implied warranty of
8 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
9 # Lesser General Public License for more details.
10 #
11 # You should have received a copy of the GNU Lesser General Public
12 # License along with this library; if not, write to the Free Software
13 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
14 #============================================================================
15 # Copyright (C) 2004, 2005 Mike Wray <mike.wray@hp.com>
16 # Copyright (c) 2005 XenSource Ltd.
17 #============================================================================
19 """Domain migration.
20 """
22 import sys
24 from xen.xend.XendClient import server
25 from xen.xm.opts import *
27 gopts = Opts(use="""[options] DOM HOST
29 Migrate domain DOM to host HOST.
30 Xend must be running on the local host and on HOST.
31 """)
33 gopts.opt('help', short='h',
34 fn=set_true, default=0,
35 use="Print this help.")
37 gopts.opt('live', short='l',
38 fn=set_true, default=0,
39 use="Use live migration.")
41 gopts.opt('port', short='p', val='portnum',
42 fn=set_int, default=0,
43 use="Use specified port for migration.")
45 gopts.opt('resource', short='r', val='MBIT',
46 fn=set_int, default=0,
47 use="Set level of resource usage for migration.")
49 def help(argv):
50 gopts.argv = argv
51 gopts.usage()
53 def main(argv):
54 opts = gopts
55 args = opts.parse(argv)
56 if opts.vals.help:
57 opts.usage()
58 return
59 if len(args) != 2:
60 opts.err('Invalid arguments: ' + str(args))
61 dom = args[0]
62 dst = args[1]
63 server.xend_domain_migrate(dom, dst, opts.vals.live, opts.vals.resource, opts.vals.port)