mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
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>
This commit is contained in:
1 parent
8e04472036
commit
0f3e2f8397
2 files changed
+26
-10
No files matched your search
@@ -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)
|
||||
|
||||
@@ -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)
|
||||