ChangeSet 1.1550.1.4, 2005/05/25 18:18:43+01:00, cl349@xxxxxxxxxxxxxxxxxxxx
relocate.py, SrvDomain.py, XendDomain.py:
Support vm relocation using XendCheckpoint.
Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>
XendDomain.py | 6 ++++++
server/SrvDomain.py | 10 +---------
server/relocate.py | 14 ++++++++++++++
3 files changed, 21 insertions(+), 9 deletions(-)
diff -Nru a/tools/python/xen/xend/XendDomain.py
b/tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py 2005-05-25 14:02:20 -04:00
+++ b/tools/python/xen/xend/XendDomain.py 2005-05-25 14:02:20 -04:00
@@ -14,6 +14,7 @@
import xen.lowlevel.xc; xc = xen.lowlevel.xc.new()
+from xen.xend.server import relocate
import sxp
import XendRoot; xroot = XendRoot.instance()
import XendCheckpoint
@@ -510,6 +511,11 @@
# Need a cancel too?
# Don't forget to cancel restart for it.
dominfo = self.domain_lookup(id)
+
+ port = xroot.get_xend_relocation_port()
+ sock = relocate.setupRelocation(dst, port)
+
+ XendCheckpoint.save(self, sock.fileno(), dominfo)
return None
def domain_save(self, id, dst, progress=False):
diff -Nru a/tools/python/xen/xend/server/SrvDomain.py
b/tools/python/xen/xend/server/SrvDomain.py
--- a/tools/python/xen/xend/server/SrvDomain.py 2005-05-25 14:02:20 -04:00
+++ b/tools/python/xen/xend/server/SrvDomain.py 2005-05-25 14:02:20 -04:00
@@ -75,15 +75,7 @@
['destination', 'str'],
['live', 'int'],
['resource', 'int']])
- info = fn(req.args, {'dom': self.dom.id})
- #req.setResponseCode(http.ACCEPTED)
- host = info.dst_host
- port = info.dst_port
- dom = info.dst_dom
- url = "http://%s:%d/xend/domain/%d" % (host, port, dom)
- req.setHeader("Location", url)
- print 'do_migrate> url=', url
- return url
+ return fn(req.args, {'dom': self.dom.id})
def op_pincpu(self, op, req):
fn = FormFn(self.xd.domain_pincpu,
diff -Nru a/tools/python/xen/xend/server/relocate.py
b/tools/python/xen/xend/server/relocate.py
--- a/tools/python/xen/xend/server/relocate.py 2005-05-25 14:02:20 -04:00
+++ b/tools/python/xen/xend/server/relocate.py 2005-05-25 14:02:20 -04:00
@@ -1,3 +1,5 @@
+
+import socket
import sys
import StringIO
@@ -123,3 +125,15 @@
port = xroot.get_xend_relocation_port()
interface = xroot.get_xend_relocation_address()
reactor.listenTCP(port, factory, interface=interface)
+
+def setupRelocation(dst, port):
+ try:
+ sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ sock.connect((dst, port))
+ except socket.error, err:
+ raise XendError("can't connect: %s" % err[1])
+
+ sock.send("receive\n")
+ print sock.recv(80)
+
+ return sock
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|