# HG changeset patch
# User jchesterfield@xxxxxxxxxxxxxxxxxxxxxxx
# Node ID 550821cdee0ac5fad9b5134eedffa118df4b6e11
# Parent dc773bf496642b9d2fd58bff05d2619665275409
Block IO safety patch for live migration. Xend checks that VBDs are destroyed
before unpausing the domain.
---
tools/python/xen/xend/XendCheckpoint.py | 6 ++++--
tools/python/xen/xend/XendDomain.py | 3 ++-
tools/python/xen/xend/XendDomainInfo.py | 15 +++++++++++++++
3 files changed, 21 insertions(+), 3 deletions(-)
diff -r dc773bf49664 -r 550821cdee0a tools/python/xen/xend/XendCheckpoint.py
--- a/tools/python/xen/xend/XendCheckpoint.py Wed Aug 30 11:05:00 2006 +0100
+++ b/tools/python/xen/xend/XendCheckpoint.py Wed Aug 30 11:39:27 2006 +0100
@@ -161,10 +161,12 @@ def restore(xd, fd):
if handler.store_mfn is None or handler.console_mfn is None:
raise XendError('Could not read store/console MFN')
+ #Block until src closes connection
+ os.read(fd, 1)
dominfo.unpause()
-
+
dominfo.completeRestore(handler.store_mfn, handler.console_mfn)
-
+
return dominfo
except:
dominfo.destroy()
diff -r dc773bf49664 -r 550821cdee0a tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py Wed Aug 30 11:05:00 2006 +0100
+++ b/tools/python/xen/xend/XendDomain.py Wed Aug 30 11:39:27 2006 +0100
@@ -431,7 +431,8 @@ class XendDomain:
sock.send("receive\n")
sock.recv(80)
XendCheckpoint.save(sock.fileno(), dominfo, True, live, dst)
-
+ dominfo.testDeviceComplete()
+ sock.close()
def domain_save(self, domid, dst):
"""Start saving a domain to file.
diff -r dc773bf49664 -r 550821cdee0a tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py Wed Aug 30 11:05:00 2006 +0100
+++ b/tools/python/xen/xend/XendDomainInfo.py Wed Aug 30 11:39:27 2006 +0100
@@ -1493,6 +1493,21 @@ class XendDomainInfo:
rc = self.migrateDevice(n, c, network, dst, DEV_MIGRATE_TEST)
if rc != 0:
raise XendError("Device of type '%s' refuses migration." % n)
+
+ def testDeviceComplete(self):
+ """ For Block IO migration safety we must ensure that
+ the device has shutdown correctly, i.e. all blocks are
+ flushed to disk
+ """
+ while True:
+ test = 0
+ for i in self.getDeviceController('vbd').deviceIDs():
+ test = 1
+ log.info("Dev %s still active, looping...", i)
+ time.sleep(0.1)
+
+ if test == 0:
+ break
def migrateDevices(self, network, dst, step, domName=''):
"""Notify the devices about migration
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|