aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorcl349@firebug.cl.cam.ac.uk <cl349@firebug.cl.cam.ac.uk>2005-09-13 15:19:39 +0000
committercl349@firebug.cl.cam.ac.uk <cl349@firebug.cl.cam.ac.uk>2005-09-13 15:19:39 +0000
commit0f3e2f839713aae83388d1df5d9406f2edfb69d5 (patch)
treeeed2bea41fbe38fd010cf9de73942088a5de6032 /tools
parent8e04472036ce4b04eb4b9264cad903d6ff04b862 (diff)
downloadxen-0f3e2f839713aae83388d1df5d9406f2edfb69d5.tar.gz
xen-0f3e2f839713aae83388d1df5d9406f2edfb69d5.tar.bz2
xen-0f3e2f839713aae83388d1df5d9406f2edfb69d5.zip
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>
Diffstat (limited to 'tools')
-rw-r--r--tools/python/xen/xend/xenstore/xstransact.py16
-rw-r--r--tools/python/xen/xend/xenstore/xsutil.py20
2 files changed, 26 insertions, 10 deletions
diff --git a/tools/python/xen/xend/xenstore/xstransact.py b/tools/python/xen/xend/xenstore/xstransact.py
index 0b8d8612a1..aa3c5eab62 100644
--- a/tools/python/xen/xend/xenstore/xstransact.py
+++ b/tools/python/xen/xend/xenstore/xstransact.py
@@ -7,14 +7,7 @@
import errno
import threading
from xen.lowlevel import xs
-
-handles = {}
-
-# XXX need to g/c handles from dead threads
-def xshandle():
- if not handles.has_key(threading.currentThread()):
- handles[threading.currentThread()] = xs.open()
- return handles[threading.currentThread()]
+from xen.xend.xenstore.xsutil import xshandle
class xstransact:
@@ -100,7 +93,10 @@ class xstransact:
def _list(self, key):
path = "%s/%s" % (self.path, key)
- return map(lambda x: key + "/" + x, xshandle().ls(path))
+ l = xshandle().ls(path)
+ if l:
+ return map(lambda x: key + "/" + x, l)
+ return []
def list(self, *args):
if len(args) == 0:
@@ -139,7 +135,7 @@ class xstransact:
Write = classmethod(Write)
- def Remove(cls, *args):
+ def Remove(cls, path, *args):
while True:
try:
t = cls(path)
diff --git a/tools/python/xen/xend/xenstore/xsutil.py b/tools/python/xen/xend/xenstore/xsutil.py
new file mode 100644
index 0000000000..1dca916dd8
--- /dev/null
+++ b/tools/python/xen/xend/xenstore/xsutil.py
@@ -0,0 +1,20 @@
+# Copyright (C) 2005 Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
+
+# This file is subject to the terms and conditions of the GNU General
+# Public License. See the file "COPYING" in the main directory of
+# this archive for more details.
+
+import threading
+from xen.lowlevel import xs
+
+handles = {}
+
+# XXX need to g/c handles from dead threads
+def xshandle():
+ if not handles.has_key(threading.currentThread()):
+ handles[threading.currentThread()] = xs.open()
+ return handles[threading.currentThread()]
+
+
+def IntroduceDomain(domid, page, port, path):
+ return xshandle().introduce_domain(domid, page, port, path)