ia64/xen-unstable

changeset 6804:68c4eb06a6aa

Move xshandle to xsutil.py, add IntroduceDomain, fix list to handle empty/non-existant directories and fix Remove.
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
author cl349@firebug.cl.cam.ac.uk
date Tue Sep 13 15:19:39 2005 +0000 (2005-09-13)
parents c66a660872e7
children c2558a2fe658
files tools/python/xen/xend/xenstore/xstransact.py tools/python/xen/xend/xenstore/xsutil.py
line diff
     1.1 --- a/tools/python/xen/xend/xenstore/xstransact.py	Tue Sep 13 14:45:34 2005 +0000
     1.2 +++ b/tools/python/xen/xend/xenstore/xstransact.py	Tue Sep 13 15:19:39 2005 +0000
     1.3 @@ -7,14 +7,7 @@
     1.4  import errno
     1.5  import threading
     1.6  from xen.lowlevel import xs
     1.7 -
     1.8 -handles = {}
     1.9 -
    1.10 -# XXX need to g/c handles from dead threads
    1.11 -def xshandle():
    1.12 -    if not handles.has_key(threading.currentThread()):
    1.13 -        handles[threading.currentThread()] = xs.open()
    1.14 -    return handles[threading.currentThread()]
    1.15 +from xen.xend.xenstore.xsutil import xshandle
    1.16  
    1.17  class xstransact:
    1.18  
    1.19 @@ -100,7 +93,10 @@ class xstransact:
    1.20  
    1.21      def _list(self, key):
    1.22          path = "%s/%s" % (self.path, key)
    1.23 -        return map(lambda x: key + "/" + x, xshandle().ls(path))
    1.24 +        l = xshandle().ls(path)
    1.25 +        if l:
    1.26 +            return map(lambda x: key + "/" + x, l)
    1.27 +        return []
    1.28  
    1.29      def list(self, *args):
    1.30          if len(args) == 0:
    1.31 @@ -139,7 +135,7 @@ class xstransact:
    1.32  
    1.33      Write = classmethod(Write)
    1.34  
    1.35 -    def Remove(cls, *args):
    1.36 +    def Remove(cls, path, *args):
    1.37          while True:
    1.38              try:
    1.39                  t = cls(path)
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/tools/python/xen/xend/xenstore/xsutil.py	Tue Sep 13 15:19:39 2005 +0000
     2.3 @@ -0,0 +1,20 @@
     2.4 +# Copyright (C) 2005 Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
     2.5 +
     2.6 +# This file is subject to the terms and conditions of the GNU General
     2.7 +# Public License.  See the file "COPYING" in the main directory of
     2.8 +# this archive for more details.
     2.9 +
    2.10 +import threading
    2.11 +from xen.lowlevel import xs
    2.12 +
    2.13 +handles = {}
    2.14 +
    2.15 +# XXX need to g/c handles from dead threads
    2.16 +def xshandle():
    2.17 +    if not handles.has_key(threading.currentThread()):
    2.18 +        handles[threading.currentThread()] = xs.open()
    2.19 +    return handles[threading.currentThread()]
    2.20 +
    2.21 +
    2.22 +def IntroduceDomain(domid, page, port, path):
    2.23 +    return xshandle().introduce_domain(domid, page, port, path)