ia64/xen-unstable
changeset 11348:550821cdee0a
Block IO safety patch for live migration. Xend checks that VBDs are destroyed before unpausing the domain.
author | jchesterfield@dhcp92.uk.xensource.com |
---|---|
date | Wed Aug 30 11:39:27 2006 +0100 (2006-08-30) |
parents | dc773bf49664 |
children | 2d2f3b824fc3 |
files | tools/python/xen/xend/XendCheckpoint.py tools/python/xen/xend/XendDomain.py tools/python/xen/xend/XendDomainInfo.py |
line diff
1.1 --- a/tools/python/xen/xend/XendCheckpoint.py Wed Aug 30 11:05:00 2006 +0100 1.2 +++ b/tools/python/xen/xend/XendCheckpoint.py Wed Aug 30 11:39:27 2006 +0100 1.3 @@ -161,10 +161,12 @@ def restore(xd, fd): 1.4 if handler.store_mfn is None or handler.console_mfn is None: 1.5 raise XendError('Could not read store/console MFN') 1.6 1.7 + #Block until src closes connection 1.8 + os.read(fd, 1) 1.9 dominfo.unpause() 1.10 - 1.11 + 1.12 dominfo.completeRestore(handler.store_mfn, handler.console_mfn) 1.13 - 1.14 + 1.15 return dominfo 1.16 except: 1.17 dominfo.destroy()
2.1 --- a/tools/python/xen/xend/XendDomain.py Wed Aug 30 11:05:00 2006 +0100 2.2 +++ b/tools/python/xen/xend/XendDomain.py Wed Aug 30 11:39:27 2006 +0100 2.3 @@ -431,7 +431,8 @@ class XendDomain: 2.4 sock.send("receive\n") 2.5 sock.recv(80) 2.6 XendCheckpoint.save(sock.fileno(), dominfo, True, live, dst) 2.7 - 2.8 + dominfo.testDeviceComplete() 2.9 + sock.close() 2.10 2.11 def domain_save(self, domid, dst): 2.12 """Start saving a domain to file.
3.1 --- a/tools/python/xen/xend/XendDomainInfo.py Wed Aug 30 11:05:00 2006 +0100 3.2 +++ b/tools/python/xen/xend/XendDomainInfo.py Wed Aug 30 11:39:27 2006 +0100 3.3 @@ -1494,6 +1494,21 @@ class XendDomainInfo: 3.4 if rc != 0: 3.5 raise XendError("Device of type '%s' refuses migration." % n) 3.6 3.7 + def testDeviceComplete(self): 3.8 + """ For Block IO migration safety we must ensure that 3.9 + the device has shutdown correctly, i.e. all blocks are 3.10 + flushed to disk 3.11 + """ 3.12 + while True: 3.13 + test = 0 3.14 + for i in self.getDeviceController('vbd').deviceIDs(): 3.15 + test = 1 3.16 + log.info("Dev %s still active, looping...", i) 3.17 + time.sleep(0.1) 3.18 + 3.19 + if test == 0: 3.20 + break 3.21 + 3.22 def migrateDevices(self, network, dst, step, domName=''): 3.23 """Notify the devices about migration 3.24 """