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-3.1-testing] Cleanup xenstore after console device

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-3.1-testing] Cleanup xenstore after console device teardown
From: "Xen patchbot-3.1-testing" <patchbot-3.1-testing@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 15 Jan 2008 07:10:18 -0800
Delivery-date: Tue, 15 Jan 2008 07:10:24 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
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/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/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 1200395954 0
# Node ID 0918b4bbffbb5235b6f6c8860b38b928da3595d2
# Parent  afd468fb5730d7760c68cb6eb4cadf0e2cf2530e
Cleanup xenstore after console device teardown

After the changes in 13616:b111908dd70b, DevController was leaking
xenstore entries every time we took down a console device, as there
was no equivalent to 'xenstore-rm -t' used in the hotplug scripts for
"real" devices. Implement the moral equivalent whenever removal is
forced.

Signed-off-by: John Levon <john.levon@xxxxxxx>
---
 tools/python/xen/xend/server/DevController.py |   22 +++++++++++++++++-----
 1 files changed, 17 insertions(+), 5 deletions(-)

diff -r afd468fb5730 -r 0918b4bbffbb 
tools/python/xen/xend/server/DevController.py
--- a/tools/python/xen/xend/server/DevController.py     Tue Jan 15 11:16:18 
2008 +0000
+++ b/tools/python/xen/xend/server/DevController.py     Tue Jan 15 11:19:14 
2008 +0000
@@ -231,11 +231,23 @@ class DevController:
         self.writeBackend(dev, 'state', str(xenbusState['Closing']))
 
         if force:
-            frontpath = self.frontendPath(dev)
-            backpath = xstransact.Read(frontpath, "backend")
-            if backpath:
-                xstransact.Remove(backpath)
-            xstransact.Remove(frontpath)
+            try:
+                frontpath = self.frontendPath(dev)
+                while True:
+                    t = xstransact()
+                    backpath = t.read("%s/backend" % frontpath)
+                    if backpath:
+                        t.remove(backpath)
+                        # tidy up empty directories
+                        while not t.list(backpath):
+                            t.remove(backpath)
+                            backpath = os.path.dirname(backpath)
+                    t.remove(frontpath)
+                    if t.commit():
+                        break
+            except:
+                t.abort()
+                raise
 
         self.vm._removeVm("device/%s/%d" % (self.deviceClass, dev))
 

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-3.1-testing] Cleanup xenstore after console device teardown, Xen patchbot-3.1-testing <=