ia64/xen-unstable

changeset 9808:83b092a2cbe6

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>
author emellor@leeni.uk.xensource.com
date Fri Apr 21 11:57:34 2006 +0100 (2006-04-21)
parents 73d847cafc87
children 1d7e2066cf11
files tools/python/xen/xend/XendCheckpoint.py tools/python/xen/xend/XendDomainInfo.py tools/python/xen/xend/server/tpmif.py
line diff
     1.1 --- a/tools/python/xen/xend/XendCheckpoint.py	Fri Apr 21 11:56:40 2006 +0100
     1.2 +++ b/tools/python/xen/xend/XendCheckpoint.py	Fri Apr 21 11:57:34 2006 +0100
     1.3 @@ -21,7 +21,8 @@ import xen.lowlevel.xc
     1.4  import balloon
     1.5  from XendError import XendError
     1.6  from XendLogging import log
     1.7 -
     1.8 +from XendDomainInfo import DEV_MIGRATE_STEP1, DEV_MIGRATE_STEP2
     1.9 +from XendDomainInfo import DEV_MIGRATE_STEP3
    1.10  
    1.11  SIGNATURE = "LinuxGuestRecord"
    1.12  XC_SAVE = "xc_save"
    1.13 @@ -65,7 +66,7 @@ def save(fd, dominfo, live, dst):
    1.14      dominfo.setName('migrating-' + domain_name)
    1.15  
    1.16      try:
    1.17 -        dominfo.migrateDevices(live, dst, 1, domain_name)
    1.18 +        dominfo.migrateDevices(live, dst, DEV_MIGRATE_STEP1, domain_name)
    1.19  
    1.20          write_exact(fd, pack("!i", len(config)),
    1.21                      "could not write guest state file: config len")
    1.22 @@ -87,9 +88,11 @@ def save(fd, dominfo, live, dst):
    1.23                  log.debug("Suspending %d ...", dominfo.getDomid())
    1.24                  dominfo.shutdown('suspend')
    1.25                  dominfo.waitForShutdown()
    1.26 -                dominfo.migrateDevices(live, dst, 2, domain_name)
    1.27 +                dominfo.migrateDevices(live, dst, DEV_MIGRATE_STEP2,
    1.28 +                                       domain_name)
    1.29                  log.info("Domain %d suspended.", dominfo.getDomid())
    1.30 -                dominfo.migrateDevices(live, dst, 3, domain_name)
    1.31 +                dominfo.migrateDevices(live, dst, DEV_MIGRATE_STEP3,
    1.32 +                                       domain_name)
    1.33                  tochild.write("done\n")
    1.34                  tochild.flush()
    1.35                  log.debug('Written done')
     2.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Fri Apr 21 11:56:40 2006 +0100
     2.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Fri Apr 21 11:57:34 2006 +0100
     2.3 @@ -87,6 +87,12 @@ SHUTDOWN_TIMEOUT = 30.0
     2.4  
     2.5  ZOMBIE_PREFIX = 'Zombie-'
     2.6  
     2.7 +"""Constants for the different stages of ext. device migration """
     2.8 +DEV_MIGRATE_TEST  = 0
     2.9 +DEV_MIGRATE_STEP1 = 1
    2.10 +DEV_MIGRATE_STEP2 = 2
    2.11 +DEV_MIGRATE_STEP3 = 3
    2.12 +
    2.13  """Minimum time between domain restarts in seconds."""
    2.14  MINIMUM_RESTART_TIME = 20
    2.15  
    2.16 @@ -1402,7 +1408,7 @@ class XendDomainInfo:
    2.17          @raise: XendError for a device that cannot be migrated
    2.18          """
    2.19          for (n, c) in self.info['device']:
    2.20 -            rc = self.migrateDevice(n, c, live, dst, 0)
    2.21 +            rc = self.migrateDevice(n, c, live, dst, DEV_MIGRATE_TEST)
    2.22              if rc != 0:
    2.23                  raise XendError("Device of type '%s' refuses migration." % n)
    2.24  
     3.1 --- a/tools/python/xen/xend/server/tpmif.py	Fri Apr 21 11:56:40 2006 +0100
     3.2 +++ b/tools/python/xen/xend/server/tpmif.py	Fri Apr 21 11:57:34 2006 +0100
     3.3 @@ -25,6 +25,7 @@ from xen.xend import sxp
     3.4  from xen.xend.XendLogging import log
     3.5  from xen.xend.XendError import XendError
     3.6  from xen.xend import XendRoot
     3.7 +from xen.xend.XendDomainInfo import DEV_MIGRATE_TEST
     3.8  
     3.9  from xen.xend.server.DevController import DevController
    3.10  
    3.11 @@ -78,7 +79,7 @@ class TPMifController(DevController):
    3.12                  log.info("Request to live-migrate device to %s. step=%d.",
    3.13                           dst, step)
    3.14  
    3.15 -                if step == 0:
    3.16 +                if step == DEV_MIGRATE_TEST:
    3.17                      """Assuming for now that everything is ok and migration
    3.18                         with the given tool can proceed.
    3.19                      """
    3.20 @@ -90,8 +91,8 @@ class TPMifController(DevController):
    3.21                      for line in fd.readlines():
    3.22                          mo = re.search('Error', line)
    3.23                          if mo:
    3.24 -                            raise XendError("vtpm: Fatal error in migration step %d." %
    3.25 -                                            step)
    3.26 +                            raise XendError("vtpm: Fatal error in migration step %d: %s" %
    3.27 +                                            (step, line))
    3.28                      return 0
    3.29              else:
    3.30                  log.debug("External migration tool not in configuration.")