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] Don't log every time around the big transaction writing

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Don't log every time around the big transaction writing the device details.
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Sat, 03 Dec 2005 12:04:08 +0000
Delivery-date: Sat, 03 Dec 2005 12:04:35 +0000
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/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 emellor@xxxxxxxxxxxxxxxxxxxxxx
# Node ID f23db20517850e84fbc40fe3c09211d9f5defa39
# Parent  1caed7031f6bd896b26eedcc337f519bf3d2787c
Don't log every time around the big transaction writing the device details.
This transaction may be starved for a short while, and logging inside the while
loop won't help!

Use new xstransact.complete to tidy up one other transaction.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>

diff -r 1caed7031f6b -r f23db2051785 
tools/python/xen/xend/server/DevController.py
--- a/tools/python/xen/xend/server/DevController.py     Fri Dec  2 15:33:38 2005
+++ b/tools/python/xen/xend/server/DevController.py     Fri Dec  2 15:35:22 2005
@@ -22,7 +22,7 @@
 from xen.xend.XendError import VmError
 from xen.xend.XendLogging import log
 
-from xen.xend.xenstore.xstransact import xstransact
+from xen.xend.xenstore.xstransact import xstransact, complete
 from xen.xend.xenstore.xswatch import xswatch
 
 DEVICE_CREATE_TIMEOUT = 10
@@ -85,6 +85,8 @@
         (backpath, frontpath) = self.addStoreEntries(config, devid, back,
                                                      front)
 
+        import xen.xend.XendDomain
+        count = 0
         while True:
             t = xstransact()
             try:
@@ -97,16 +99,19 @@
                     
                     raise VmError("Device %s is already connected." % dev_str)
 
-                log.debug('DevController: writing %s to %s.', str(front),
-                          frontpath)
-                log.debug('DevController: writing %s to %s.', str(back),
-                          backpath)
+                if count == 0:
+                    log.debug('DevController: writing %s to %s.', str(front),
+                              frontpath)
+                    log.debug('DevController: writing %s to %s.', str(back),
+                              backpath)
+                elif count % 50 == 0:
+                    log.debug(
+                      'DevController: still waiting to write device entries.')
 
                 t.remove(frontpath)
                 t.remove(backpath)
 
                 t.mkdir(backpath)
-                import xen.xend.XendDomain
                 t.set_permissions(backpath,
                                   {'dom': xen.xend.XendDomain.PRIV_DOMAIN },
                                   {'dom'  : self.vm.getDomid(),
@@ -117,6 +122,8 @@
 
                 if t.commit():
                     return devid
+
+                count += 1
             except:
                 t.abort()
                 raise
@@ -273,20 +280,17 @@
         the device configuration instead.
         """
         path = self.frontendMiscPath()
-        while True:
-            t = xstransact(path)
-            try:
-                result = t.read("nextDeviceID")
-                if result:
-                    result = int(result)
-                else:
-                    result = 0
-                t.write("nextDeviceID", str(result + 1))
-                if t.commit():
-                    return result
-            except:
-                t.abort()
-                raise
+        return complete(path, self._allocateDeviceID)
+
+
+    def _allocateDeviceID(self, t):
+        result = t.read("nextDeviceID")
+        if result:
+            result = int(result)
+        else:
+            result = 0
+        t.write("nextDeviceID", str(result + 1))
+        return result
 
 
     def readBackend(self, devid, *args):

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Don't log every time around the big transaction writing the device details., Xen patchbot -unstable <=