ia64/xen-unstable

changeset 16966:5d84464dc1fc

Fix save/restore failure cleanup

The save failure cleanup introduced in 13543:207523704fb1 is
incorrect: if we didn't get as far as actually suspending the domain,
then the guest domain will not be expecting the devices to be removed
(seen on both Linux and Solaris, which don't expect a 'Closing' state
when they hold the device open). Only re-jig devices if we definitely
shut the domain down.

Signed-off-by: John Levon <john.levon@sun.com>
author Keir Fraser <keir.fraser@citrix.com>
date Sat Feb 02 10:51:54 2008 +0000 (2008-02-02)
parents d29d74d4eeac
children b1b93caa7d8e
files tools/python/xen/xend/XendCheckpoint.py
line diff
     1.1 --- a/tools/python/xen/xend/XendCheckpoint.py	Fri Feb 01 12:01:34 2008 +0000
     1.2 +++ b/tools/python/xen/xend/XendCheckpoint.py	Sat Feb 02 10:51:54 2008 +0000
     1.3 @@ -67,6 +67,8 @@ def save(fd, dominfo, network, live, dst
     1.4      # thing is useful for debugging.
     1.5      dominfo.setName('migrating-' + domain_name)
     1.6  
     1.7 +    done_suspend = 0
     1.8 +
     1.9      try:
    1.10          dominfo.migrateDevices(network, dst, DEV_MIGRATE_STEP1, domain_name)
    1.11  
    1.12 @@ -94,6 +96,7 @@ def save(fd, dominfo, network, live, dst
    1.13                  log.debug("Suspending %d ...", dominfo.getDomid())
    1.14                  dominfo.shutdown('suspend')
    1.15                  dominfo.waitForShutdown()
    1.16 +                done_suspend = 1
    1.17                  dominfo.migrateDevices(network, dst, DEV_MIGRATE_STEP2,
    1.18                                         domain_name)
    1.19                  log.info("Domain %d suspended.", dominfo.getDomid())
    1.20 @@ -140,9 +143,14 @@ def save(fd, dominfo, network, live, dst
    1.21          log.exception("Save failed on domain %s (%s).", domain_name,
    1.22                        dominfo.getDomid())
    1.23          
    1.24 -        dominfo.resumeDomain()
    1.25 -        log.debug("XendCheckpoint.save: resumeDomain")
    1.26 -
    1.27 +        # If we didn't get as far as suspending the domain (for
    1.28 +        # example, we couldn't balloon enough memory for the new
    1.29 +        # domain), then we don't want to re-plumb the devices, as the
    1.30 +        # domU will not be expecting it.
    1.31 +        if done_suspend:
    1.32 +            log.debug("XendCheckpoint.save: resumeDomain")
    1.33 +            dominfo.resumeDomain()
    1.34 + 
    1.35          try:
    1.36              dominfo.setName(domain_name)
    1.37          except: