Index: xen/xen-unstable.hg/tools/python/xen/xend/XendCheckpoint.py =================================================================== --- xen.orig/xen-unstable.hg/tools/python/xen/xend/XendCheckpoint.py +++ xen/xen-unstable.hg/tools/python/xen/xend/XendCheckpoint.py @@ -21,7 +21,8 @@ import xen.lowlevel.xc import balloon from XendError import XendError from XendLogging import log - +from XendDomainInfo import DEV_MIGRATE_STEP1, DEV_MIGRATE_STEP2 +from XendDomainInfo import DEV_MIGRATE_STEP3 SIGNATURE = "LinuxGuestRecord" XC_SAVE = "xc_save" @@ -65,7 +66,7 @@ def save(fd, dominfo, live, dst): dominfo.setName('migrating-' + domain_name) try: - dominfo.migrateDevices(live, dst, 1, domain_name) + dominfo.migrateDevices(live, dst, DEV_MIGRATE_STEP1, domain_name) write_exact(fd, pack("!i", len(config)), "could not write guest state file: config len") @@ -87,9 +88,11 @@ def save(fd, dominfo, live, dst): log.debug("Suspending %d ...", dominfo.getDomid()) dominfo.shutdown('suspend') dominfo.waitForShutdown() - dominfo.migrateDevices(live, dst, 2, domain_name) + dominfo.migrateDevices(live, dst, DEV_MIGRATE_STEP2, + domain_name) log.info("Domain %d suspended.", dominfo.getDomid()) - dominfo.migrateDevices(live, dst, 3, domain_name) + dominfo.migrateDevices(live, dst, DEV_MIGRATE_STEP3, + domain_name) tochild.write("done\n") tochild.flush() log.debug('Written done') Index: xen/xen-unstable.hg/tools/python/xen/xend/XendDomainInfo.py =================================================================== --- xen.orig/xen-unstable.hg/tools/python/xen/xend/XendDomainInfo.py +++ xen/xen-unstable.hg/tools/python/xen/xend/XendDomainInfo.py @@ -87,6 +87,12 @@ SHUTDOWN_TIMEOUT = 30.0 ZOMBIE_PREFIX = 'Zombie-' +"""Constants for the different stages of ext. device migration """ +DEV_MIGRATE_TEST = 0 +DEV_MIGRATE_STEP1 = 1 +DEV_MIGRATE_STEP2 = 2 +DEV_MIGRATE_STEP3 = 3 + """Minimum time between domain restarts in seconds.""" MINIMUM_RESTART_TIME = 20 @@ -1402,7 +1408,7 @@ class XendDomainInfo: @raise: XendError for a device that cannot be migrated """ for (n, c) in self.info['device']: - rc = self.migrateDevice(n, c, live, dst, 0) + rc = self.migrateDevice(n, c, live, dst, DEV_MIGRATE_TEST) if rc != 0: raise XendError("Device of type '%s' refuses migration." % n) Index: xen/xen-unstable.hg/tools/python/xen/xend/server/tpmif.py =================================================================== --- xen.orig/xen-unstable.hg/tools/python/xen/xend/server/tpmif.py +++ xen/xen-unstable.hg/tools/python/xen/xend/server/tpmif.py @@ -25,6 +25,7 @@ from xen.xend import sxp from xen.xend.XendLogging import log from xen.xend.XendError import XendError from xen.xend import XendRoot +from xen.xend.XendDomainInfo import DEV_MIGRATE_TEST from xen.xend.server.DevController import DevController @@ -78,7 +79,7 @@ class TPMifController(DevController): log.info("Request to live-migrate device to %s. step=%d.", dst, step) - if step == 0: + if step == DEV_MIGRATE_TEST: """Assuming for now that everything is ok and migration with the given tool can proceed. """ @@ -90,8 +91,8 @@ class TPMifController(DevController): for line in fd.readlines(): mo = re.search('Error', line) if mo: - raise XendError("vtpm: Fatal error in migration step %d." % - step) + raise XendError("vtpm: Fatal error in migration step %d: %s" % + (step, line)) return 0 else: log.debug("External migration tool not in configuration.")