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

[Xen-changelog] In all cases, move the creation of a new transaction outside of the block



# HG changeset patch
# User emellor@ewan
# Node ID da5e4c8a0fea3f8e452fc9e3fe7dbb31776bd4e7
# Parent  702e7f173465b5cbc16d0fc38f81602e9480e9c8
In all cases, move the creation of a new transaction outside of the block
handling exceptions raised inside that transaction.  If the creation (start) of
the transaction fails, then t has not been assigned, and in any case no
transaction has been created, so it is wrong to attempt to abort that
(non-existent) transaction.

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

diff -r 702e7f173465 -r da5e4c8a0fea 
tools/python/xen/xend/xenstore/xstransact.py
--- a/tools/python/xen/xend/xenstore/xstransact.py      Sat Sep 17 21:34:34 2005
+++ b/tools/python/xen/xend/xenstore/xstransact.py      Sun Sep 18 09:09:22 2005
@@ -151,8 +151,8 @@
 
     def Read(cls, path, *args):
         while True:
-            try:
-                t = cls(path)
+            t = cls(path)
+            try:
                 v = t.read(*args)
                 t.commit()
                 return v
@@ -170,8 +170,8 @@
 
     def Write(cls, path, *args, **opts):
         while True:
-            try:
-                t = cls(path)
+            t = cls(path)
+            try:
                 t.write(*args, **opts)
                 t.commit()
                 return
@@ -189,8 +189,8 @@
 
     def Remove(cls, path, *args):
         while True:
-            try:
-                t = cls(path)
+            t = cls(path)
+            try:
                 t.remove(*args)
                 t.commit()
                 return
@@ -208,8 +208,8 @@
 
     def List(cls, path, *args):
         while True:
-            try:
-                t = cls(path)
+            t = cls(path)
+            try:
                 v = t.list(*args)
                 t.commit()
                 return v
@@ -227,8 +227,8 @@
 
     def Gather(cls, path, *args):
         while True:
-            try:
-                t = cls(path)
+            t = cls(path)
+            try:
                 v = t.gather(*args)
                 t.commit()
                 return v
@@ -246,8 +246,8 @@
 
     def Store(cls, path, *args):
         while True:
-            try:
-                t = cls(path)
+            t = cls(path)
+            try:
                 v = t.store(*args)
                 t.commit()
                 return v

_______________________________________________
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®.