ia64/xen-unstable

view tools/python/xen/xm/migrate.py @ 12810:cf1ca0615414

Added support for configuration file for xm, and use that to specify
contact and authentication details for the Xen-API server.

The default behaviour is still to use the existing legacy XML-RPC server.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Wed Dec 06 11:02:32 2006 +0000 (2006-12-06)
parents ad22c711ccb7
children 6b3bb79cb1c9
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.xm.opts import *
26 from main import server
28 gopts = Opts(use="""[options] DOM HOST
30 Migrate domain DOM to host HOST.
31 Xend must be running on the local host and on HOST.
32 """)
34 gopts.opt('help', short='h',
35 fn=set_true, default=0,
36 use="Print this help.")
38 gopts.opt('live', short='l',
39 fn=set_true, default=0,
40 use="Use live migration.")
42 gopts.opt('port', short='p', val='portnum',
43 fn=set_int, default=0,
44 use="Use specified port for migration.")
46 gopts.opt('resource', short='r', val='MBIT',
47 fn=set_int, default=0,
48 use="Set level of resource usage for migration.")
50 def help():
51 return str(gopts)
53 def main(argv):
54 opts = gopts
55 args = opts.parse(argv)
57 if len(args) != 2:
58 raise OptionError('Invalid number of arguments')
60 dom = args[0]
61 dst = args[1]
62 server.xend.domain.migrate(dom, dst, opts.vals.live, opts.vals.resource,
63 opts.vals.port)