mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
allow a port to be specified for migration.
Signed-off-by: Vincent Hanquez <vincent@xensource.com>
This commit is contained in:
1 parent
91df848ca6
commit
c2c982f908
4 files changed
+13
-6
No files matched your search
@@ -256,12 +256,13 @@ class Xend:
|
||||
{'op' : 'save',
|
||||
'file' : filename })
|
||||
|
||||
def xend_domain_migrate(self, id, dst, live=0, resource=0):
|
||||
def xend_domain_migrate(self, id, dst, live=0, resource=0, port=0):
|
||||
return self.xendPost(self.domainurl(id),
|
||||
{'op' : 'migrate',
|
||||
'destination': dst,
|
||||
'live' : live,
|
||||
'resource' : resource })
|
||||
'resource' : resource,
|
||||
'port' : port })
|
||||
|
||||
def xend_domain_pincpu(self, id, vcpu, cpumap):
|
||||
return self.xendPost(self.domainurl(id),
|
||||
|
||||
@@ -390,12 +390,13 @@ class XendDomain:
|
||||
raise XendError(str(ex))
|
||||
return val
|
||||
|
||||
def domain_migrate(self, domid, dst, live=False, resource=0):
|
||||
def domain_migrate(self, domid, dst, live=False, resource=0, port=0):
|
||||
"""Start domain migration."""
|
||||
|
||||
dominfo = self.domain_lookup(domid)
|
||||
|
||||
port = xroot.get_xend_relocation_port()
|
||||
if port == 0:
|
||||
port = xroot.get_xend_relocation_port()
|
||||
try:
|
||||
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
sock.connect((dst, port))
|
||||
|
||||
@@ -90,7 +90,8 @@ class SrvDomain(SrvDir):
|
||||
[['dom', 'int'],
|
||||
['destination', 'str'],
|
||||
['live', 'int'],
|
||||
['resource', 'int']])
|
||||
['resource', 'int'],
|
||||
['port', 'int']])
|
||||
return fn(req.args, {'dom': self.dom.domid})
|
||||
|
||||
def op_pincpu(self, _, req):
|
||||
|
||||
@@ -40,6 +40,10 @@ gopts.opt('live', short='l',
|
||||
fn=set_true, default=0,
|
||||
use="Use live migration.")
|
||||
|
||||
gopts.opt('port', short='p',
|
||||
fn=set_int, default=0,
|
||||
use="Use specified port for migration.")
|
||||
|
||||
gopts.opt('resource', short='r', val='MBIT',
|
||||
fn=set_int, default=0,
|
||||
use="Set level of resource usage for migration.")
|
||||
@@ -60,5 +64,5 @@ def main(argv):
|
||||
dst = args[1]
|
||||
if dom in [DOM0_NAME, DOM0_ID]:
|
||||
opts.err('Cannot migrate ' + dom)
|
||||
server.xend_domain_migrate(dom, dst, opts.vals.live, opts.vals.resource)
|
||||
server.xend_domain_migrate(dom, dst, opts.vals.live, opts.vals.resource, opts.vals.port)
|
||||
|
||||