ia64/xen-unstable

changeset 6945:da5e4c8a0fea

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>
author emellor@ewan
date Sun Sep 18 10:09:22 2005 +0100 (2005-09-18)
parents 702e7f173465
children e703abaf6e3d
files tools/python/xen/xend/xenstore/xstransact.py
line diff
     1.1 --- a/tools/python/xen/xend/xenstore/xstransact.py	Sat Sep 17 22:34:34 2005 +0100
     1.2 +++ b/tools/python/xen/xend/xenstore/xstransact.py	Sun Sep 18 10:09:22 2005 +0100
     1.3 @@ -151,8 +151,8 @@ class xstransact:
     1.4  
     1.5      def Read(cls, path, *args):
     1.6          while True:
     1.7 +            t = cls(path)
     1.8              try:
     1.9 -                t = cls(path)
    1.10                  v = t.read(*args)
    1.11                  t.commit()
    1.12                  return v
    1.13 @@ -170,8 +170,8 @@ class xstransact:
    1.14  
    1.15      def Write(cls, path, *args, **opts):
    1.16          while True:
    1.17 +            t = cls(path)
    1.18              try:
    1.19 -                t = cls(path)
    1.20                  t.write(*args, **opts)
    1.21                  t.commit()
    1.22                  return
    1.23 @@ -189,8 +189,8 @@ class xstransact:
    1.24  
    1.25      def Remove(cls, path, *args):
    1.26          while True:
    1.27 +            t = cls(path)
    1.28              try:
    1.29 -                t = cls(path)
    1.30                  t.remove(*args)
    1.31                  t.commit()
    1.32                  return
    1.33 @@ -208,8 +208,8 @@ class xstransact:
    1.34  
    1.35      def List(cls, path, *args):
    1.36          while True:
    1.37 +            t = cls(path)
    1.38              try:
    1.39 -                t = cls(path)
    1.40                  v = t.list(*args)
    1.41                  t.commit()
    1.42                  return v
    1.43 @@ -227,8 +227,8 @@ class xstransact:
    1.44  
    1.45      def Gather(cls, path, *args):
    1.46          while True:
    1.47 +            t = cls(path)
    1.48              try:
    1.49 -                t = cls(path)
    1.50                  v = t.gather(*args)
    1.51                  t.commit()
    1.52                  return v
    1.53 @@ -246,8 +246,8 @@ class xstransact:
    1.54  
    1.55      def Store(cls, path, *args):
    1.56          while True:
    1.57 +            t = cls(path)
    1.58              try:
    1.59 -                t = cls(path)
    1.60                  v = t.store(*args)
    1.61                  t.commit()
    1.62                  return v