mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
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@xensource.com>
This commit is contained in:
1 parent
ab2a633ba1
commit
00cac7da1c
1 file changed
+6
-6
@@ -151,8 +151,8 @@ class xstransact:
|
||||
|
||||
def Read(cls, path, *args):
|
||||
while True:
|
||||
t = cls(path)
|
||||
try:
|
||||
t = cls(path)
|
||||
v = t.read(*args)
|
||||
t.commit()
|
||||
return v
|
||||
@@ -170,8 +170,8 @@ class xstransact:
|
||||
|
||||
def Write(cls, path, *args, **opts):
|
||||
while True:
|
||||
t = cls(path)
|
||||
try:
|
||||
t = cls(path)
|
||||
t.write(*args, **opts)
|
||||
t.commit()
|
||||
return
|
||||
@@ -189,8 +189,8 @@ class xstransact:
|
||||
|
||||
def Remove(cls, path, *args):
|
||||
while True:
|
||||
t = cls(path)
|
||||
try:
|
||||
t = cls(path)
|
||||
t.remove(*args)
|
||||
t.commit()
|
||||
return
|
||||
@@ -208,8 +208,8 @@ class xstransact:
|
||||
|
||||
def List(cls, path, *args):
|
||||
while True:
|
||||
t = cls(path)
|
||||
try:
|
||||
t = cls(path)
|
||||
v = t.list(*args)
|
||||
t.commit()
|
||||
return v
|
||||
@@ -227,8 +227,8 @@ class xstransact:
|
||||
|
||||
def Gather(cls, path, *args):
|
||||
while True:
|
||||
t = cls(path)
|
||||
try:
|
||||
t = cls(path)
|
||||
v = t.gather(*args)
|
||||
t.commit()
|
||||
return v
|
||||
@@ -246,8 +246,8 @@ class xstransact:
|
||||
|
||||
def Store(cls, path, *args):
|
||||
while True:
|
||||
t = cls(path)
|
||||
try:
|
||||
t = cls(path)
|
||||
v = t.store(*args)
|
||||
t.commit()
|
||||
return v
|
||||
|
||||