ia64/xen-unstable

view tools/python/xen/xm/migrate.py @ 6538:84ee014ebd41

Merge xen-vtx-unstable.hg
author adsharma@los-vmm.sc.intel.com
date Wed Aug 17 12:34:38 2005 -0800 (2005-08-17)
parents 23979fb12c49 f40c6650152e
children 99914b54f7bf
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 #============================================================================
18 """Domain migration.
19 """
21 import sys
23 from xen.xend.XendClient import server
24 from xen.xm.opts import *
26 DOM0_NAME = 'Domain-0'
27 DOM0_ID = '0'
29 gopts = Opts(use="""[options] DOM HOST
31 Migrate domain DOM to host HOST.
32 Xend must be running on the local host and on HOST.
33 """)
35 gopts.opt('help', short='h',
36 fn=set_true, default=0,
37 use="Print this help.")
39 gopts.opt('live', short='l',
40 fn=set_true, default=0,
41 use="Use live migration.")
43 gopts.opt('resource', short='r', val='MBIT',
44 fn=set_int, default=0,
45 use="Set level of resource usage for migration.")
47 def help(argv):
48 gopts.argv = argv
49 gopts.usage()
51 def main(argv):
52 opts = gopts
53 args = opts.parse(argv)
54 if opts.vals.help:
55 opts.usage()
56 return
57 if len(args) != 2:
58 opts.err('Invalid arguments: ' + str(args))
59 dom = args[0]
60 dst = args[1]
61 if dom in [DOM0_NAME, DOM0_ID]:
62 opts.err('Cannot migrate ' + dom)
63 server.xend_domain_migrate(dom, dst, opts.vals.live, opts.vals.resource)