mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 02:30:03 +01:00
The attached patch replaces the current numbers identifying the
individual steps of device migration with constants. Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
This commit is contained in:
1 parent
3c4f089bd8
commit
df0c8173e2
3 files changed
+18
-8
No files matched your search
@@ -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')
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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.")
|
||||
|
||||