WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] xend: Cleanup destroy and destroyDomain m

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] xend: Cleanup destroy and destroyDomain methods
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 29 Aug 2008 08:30:11 -0700
Delivery-date: Fri, 29 Aug 2008 08:30:21 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1219913053 -3600
# Node ID c8377b335fbee14e624ce47ba107e4b109436901
# Parent  ab50f558a6f344d0aa0277823fce39b6b20b5784
xend: Cleanup destroy and destroyDomain methods

When domains are destroyed, _prepare_phantom_paths() method
and _cleanup_phantom_devs() method are called twice as follows.

destroy()@XendDomainInfo.py
    _prepare_phantom_paths() --------------- 1
    _cleanupVm()
    destroyDomain()
        _prepare_phantom_paths() ----------- 2
        xc.domain_destroy_hook()
        xc.domain_pause()
        do_FLR()
        xc.domain_destroy()
        XendDomain.remove_domain()
        cleanupDomain()
        _cleanup_phantom_devs() ------------ 1
    _cleanup_phantom_devs() ---------------- 2
    XendDomain.domain_delete_by_dominfo()

This is a cleanup patch.  It combines destroyDomain() method
into destroy() method, then _prepare_phantom_paths() method and
_cleanup_phantom_devs() method are called only once.

Signed-off-by: Masaki Kanno <kanno.masaki@xxxxxxxxxxxxxx>
---
 tools/python/xen/xend/XendDomainInfo.py |   36 ++++++++++----------------------
 1 files changed, 12 insertions(+), 24 deletions(-)

diff -r ab50f558a6f3 -r c8377b335fbe tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Thu Aug 28 09:40:10 2008 +0100
+++ b/tools/python/xen/xend/XendDomainInfo.py   Thu Aug 28 09:44:13 2008 +0100
@@ -2408,29 +2408,14 @@ class XendDomainInfo:
         if self.domid is None:
             return
 
+        from xen.xend import XendDomain
         log.debug("XendDomainInfo.destroy: domid=%s", str(self.domid))
 
         paths = self._prepare_phantom_paths()
 
         self._cleanupVm()
         if self.dompath is not None:
-            self.destroyDomain()
-
-        self._cleanup_phantom_devs(paths)
-
-        if "transient" in self.info["other_config"] \
-           and bool(self.info["other_config"]["transient"]):
-            from xen.xend import XendDomain
-            XendDomain.instance().domain_delete_by_dominfo(self)
-
-
-    def destroyDomain(self):
-        log.debug("XendDomainInfo.destroyDomain(%s)", str(self.domid))
-
-        paths = self._prepare_phantom_paths()
-
-        try:
-            if self.domid is not None:
+            try:
                 xc.domain_destroy_hook(self.domid)
                 xc.domain_pause(self.domid)
                 do_FLR(self.domid)
@@ -2438,14 +2423,17 @@ class XendDomainInfo:
                 for state in DOM_STATES_OLD:
                     self.info[state] = 0
                 self._stateSet(DOM_STATE_HALTED)
-        except:
-            log.exception("XendDomainInfo.destroy: xc.domain_destroy failed.")
-
-        from xen.xend import XendDomain
-        XendDomain.instance().remove_domain(self)
-
-        self.cleanupDomain()
+            except:
+                log.exception("XendDomainInfo.destroy: domain destruction 
failed.")
+
+            XendDomain.instance().remove_domain(self)
+            self.cleanupDomain()
+
         self._cleanup_phantom_devs(paths)
+
+        if "transient" in self.info["other_config"] \
+           and bool(self.info["other_config"]["transient"]):
+            XendDomain.instance().domain_delete_by_dominfo(self)
 
 
     def resetDomain(self):

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] xend: Cleanup destroy and destroyDomain methods, Xen patchbot-unstable <=