[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Always start transactions on an existing path.



# HG changeset patch
# User cl349@xxxxxxxxxxxxxxxxxxxx
# Node ID d0b3c7061368319bae88e81028962cf54f46bf60
# Parent  47dca2f335de3493e9bcef04459a7d37ccc5ebf0
Always start transactions on an existing path.
Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>

diff -r 47dca2f335de -r d0b3c7061368 
tools/python/xen/xend/xenstore/xstransact.py
--- a/tools/python/xen/xend/xenstore/xstransact.py      Fri Sep  9 13:20:51 2005
+++ b/tools/python/xen/xend/xenstore/xstransact.py      Fri Sep  9 16:06:04 2005
@@ -4,6 +4,7 @@
 # Public License.  See the file "COPYING" in the main directory of
 # this archive for more details.
 
+import errno
 import threading
 from xen.lowlevel import xs
 
@@ -18,9 +19,18 @@
 class xstransact:
 
     def __init__(self, path):
+        self.in_transaction = False
         self.path = path.rstrip("/")
-        xshandle().transaction_start(path)
-        self.in_transaction = True
+        while True:
+            try:
+                xshandle().transaction_start(path)
+                self.in_transaction = True
+                return
+            except RuntimeError, ex:
+                if ex.args[0] == errno.ENOENT and path != "/":
+                    path = "/".join(path.split("/")[0:-1]) or "/"
+                else:
+                    raise
 
     def __del__(self):
         if self.in_transaction:

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.