[xen-unstable] xend: Fix cleanup_domains() for suspending managed domains

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[xen-unstable] xend: Fix cleanup_domains() for suspending managed domains

Xen patchbot-unstable
# HG changeset patch
# User Keir Fraser <[hidden email]>
# Date 1197454094 0
# Node ID 7b4e560d6caf25fe43edd3d5a86701f8cbc992f8
# Parent  e502e8308e46bf80b9c1fd6c32f4000ea6a62295
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 <[hidden email]>
---
 tools/python/xen/xend/XendDomain.py |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)

diff -r e502e8308e46 -r 7b4e560d6caf tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py Wed Dec 12 10:05:53 2007 +0000
+++ b/tools/python/xen/xend/XendDomain.py Wed Dec 12 10:08:14 2007 +0000
@@ -613,13 +613,19 @@ class XendDomain:
                 if dom.getName() == DOM0_NAME:
                     continue
                 
-                if dom._stateGet() == DOM_STATE_RUNNING:
-                    shutdownAction = dom.info.get('on_xend_stop', 'ignore')
-                    if shutdownAction == 'shutdown':
-                        log.debug('Shutting down domain: %s' % dom.getName())
-                        dom.shutdown("poweroff")
-                    elif shutdownAction == 'suspend':
-                        self.domain_suspend(dom.getName())
+                try:
+                    if dom._stateGet() == DOM_STATE_RUNNING:
+                        shutdownAction = dom.info.get('on_xend_stop', 'ignore')
+                        if shutdownAction == 'shutdown':
+                            log.debug('Shutting down domain: %s' % dom.getName())
+                            dom.shutdown("poweroff")
+                        elif shutdownAction == 'suspend':
+                            self.domain_suspend(dom.getName())
+                        else:
+                            log.debug('Domain %s continues to run.' % dom.getName())
+                except:
+                    log.exception('Domain %s failed to %s.' % \
+                                  (dom.getName(), shutdownAction))
         finally:
             self.domains_lock.release()
 

_______________________________________________
Xen-changelog mailing list
[hidden email]
http://lists.xensource.com/xen-changelog