# HG changeset patch
# User emellor@xxxxxxxxxxxxxxxxxxxxxx
# Node ID 83b092a2cbe61b1bb962f6bc8560bae4c1ede5b7
# Parent 73d847cafc8799a186171df59dd04158fc2c79bf
The attached patch replaces the current numbers identifying the
individual steps of device migration with constants.
Signed-off-by: Stefan Berger <stefanb@xxxxxxxxxx>
diff -r 73d847cafc87 -r 83b092a2cbe6 tools/python/xen/xend/XendCheckpoint.py
--- a/tools/python/xen/xend/XendCheckpoint.py Fri Apr 21 11:56:40 2006 +0100
+++ b/tools/python/xen/xend/XendCheckpoint.py Fri Apr 21 11:57:34 2006 +0100
@@ -21,7 +21,8 @@ import balloon
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')
diff -r 73d847cafc87 -r 83b092a2cbe6 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py Fri Apr 21 11:56:40 2006 +0100
+++ b/tools/python/xen/xend/XendDomainInfo.py Fri Apr 21 11:57:34 2006 +0100
@@ -86,6 +86,12 @@ SHUTDOWN_TIMEOUT = 30.0
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)
diff -r 73d847cafc87 -r 83b092a2cbe6 tools/python/xen/xend/server/tpmif.py
--- a/tools/python/xen/xend/server/tpmif.py Fri Apr 21 11:56:40 2006 +0100
+++ b/tools/python/xen/xend/server/tpmif.py Fri Apr 21 11:57:34 2006 +0100
@@ -25,6 +25,7 @@ from xen.xend.XendLogging import log
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.")
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|