ia64/xen-unstable

changeset 16590:7b4e560d6caf

xend: Fix cleanup_domains() for suspending managed domains

When unmanaged domains with on_xend_stop="suspend" exist, managed
domains are not suspended by xend stop command. The processing of
cleanup_domains() is aborted by exception. This patch keeps suspending
managed domains even if unmanaged domains exist.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Dec 12 10:08:14 2007 +0000 (2007-12-12)
parents e502e8308e46
children 12cf63d3e4a2
files tools/python/xen/xend/XendDomain.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomain.py	Wed Dec 12 10:05:53 2007 +0000
     1.2 +++ b/tools/python/xen/xend/XendDomain.py	Wed Dec 12 10:08:14 2007 +0000
     1.3 @@ -613,13 +613,19 @@ class XendDomain:
     1.4                  if dom.getName() == DOM0_NAME:
     1.5                      continue
     1.6                  
     1.7 -                if dom._stateGet() == DOM_STATE_RUNNING:
     1.8 -                    shutdownAction = dom.info.get('on_xend_stop', 'ignore')
     1.9 -                    if shutdownAction == 'shutdown':
    1.10 -                        log.debug('Shutting down domain: %s' % dom.getName())
    1.11 -                        dom.shutdown("poweroff")
    1.12 -                    elif shutdownAction == 'suspend':
    1.13 -                        self.domain_suspend(dom.getName())
    1.14 +                try:
    1.15 +                    if dom._stateGet() == DOM_STATE_RUNNING:
    1.16 +                        shutdownAction = dom.info.get('on_xend_stop', 'ignore')
    1.17 +                        if shutdownAction == 'shutdown':
    1.18 +                            log.debug('Shutting down domain: %s' % dom.getName())
    1.19 +                            dom.shutdown("poweroff")
    1.20 +                        elif shutdownAction == 'suspend':
    1.21 +                            self.domain_suspend(dom.getName())
    1.22 +                        else:
    1.23 +                            log.debug('Domain %s continues to run.' % dom.getName())
    1.24 +                except:
    1.25 +                    log.exception('Domain %s failed to %s.' % \
    1.26 +                                  (dom.getName(), shutdownAction))
    1.27          finally:
    1.28              self.domains_lock.release()
    1.29