aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/python/xen/lowlevel/xs/xs.c76
-rw-r--r--tools/python/xen/xend/XendDomainInfo.py4
-rwxr-xr-xtools/python/xen/xend/server/blkif.py5
-rwxr-xr-xtools/python/xen/xend/server/netif.py2
-rw-r--r--tools/python/xen/xend/xenstore/xsnode.py2
5 files changed, 55 insertions, 34 deletions
diff --git a/tools/python/xen/lowlevel/xs/xs.c b/tools/python/xen/lowlevel/xs/xs.c
index 1b86a03f65..726b83e8e1 100644
--- a/tools/python/xen/lowlevel/xs/xs.c
+++ b/tools/python/xen/lowlevel/xs/xs.c
@@ -1,7 +1,7 @@
/*
- Python interface to the Xen Store Daemon.
- Copyright (C) 2005 Mike Wray Hewlett-Packard
-*/
+ * Python interface to the Xen Store Daemon.
+ * Copyright (C) 2005 Mike Wray Hewlett-Packard
+ */
#include <Python.h>
@@ -196,6 +196,7 @@ static PyObject *xspy_mkdir(PyObject *self, PyObject *args, PyObject *kwds)
#define xspy_rm_doc "\n" \
"Remove a path.\n" \
" path [string] : path to remove\n" \
+ "\n" \
"Returns: [int] 0 on success.\n" \
"Raises RuntimeError on error.\n" \
"\n"
@@ -339,13 +340,14 @@ static PyObject *xspy_set_permissions(PyObject *self, PyObject *args,
return val;
}
-#define xspy_watch_doc "\n" \
- "Watch a path, get notifications when it changes.\n" \
- " path [string] : xenstore path.\n" \
- " token [string] : returned in watch notification\n" \
- "\n" \
- "Returns: [int] 0 on success.\n" \
- "Raises RuntimeError on error.\n" \
+#define xspy_watch_doc "\n" \
+ "Watch a path, get notifications when it changes.\n" \
+ " path [string] : xenstore path.\n" \
+ " priority [int] : watch priority (default 0).\n" \
+ " token [string] : returned in watch notification.\n" \
+ "\n" \
+ "Returns: [int] 0 on success.\n" \
+ "Raises RuntimeError on error.\n" \
"\n"
static PyObject *xspy_watch(PyObject *self, PyObject *args, PyObject *kwds)
@@ -371,12 +373,14 @@ static PyObject *xspy_watch(PyObject *self, PyObject *args, PyObject *kwds)
return val;
}
-#define xspy_read_watch_doc "\n" \
- "Read a watch notification.\n" \
- " path [string]: xenstore path.\n" \
- "\n" \
- "Returns: [tuple] (path, token).\n" \
- "Raises RuntimeError on error.\n" \
+#define xspy_read_watch_doc "\n" \
+ "Read a watch notification.\n" \
+ "The notification must be acknowledged by passing\n" \
+ "the token to acknowledge_watch().\n" \
+ " path [string]: xenstore path.\n" \
+ "\n" \
+ "Returns: [tuple] (path, token).\n" \
+ "Raises RuntimeError on error.\n" \
"\n"
static PyObject *xspy_read_watch(PyObject *self, PyObject *args,
@@ -408,7 +412,7 @@ static PyObject *xspy_read_watch(PyObject *self, PyObject *args,
#define xspy_acknowledge_watch_doc "\n" \
"Acknowledge a watch notification that has been read.\n" \
- " token [string] : returned in watch notification\n" \
+ " token [string] : from the watch notification\n" \
"\n" \
"Returns: [int] 0 on success.\n" \
"Raises RuntimeError on error.\n" \
@@ -499,7 +503,7 @@ static PyObject *xspy_transaction_start(PyObject *self, PyObject *args,
#define xspy_transaction_end_doc "\n" \
"End the current transaction.\n" \
"Attempts to commit the transaction unless abort is true.\n" \
- " abort [int]: Abort flag..\n" \
+ " abort [int]: abort flag (default 0).\n" \
"\n" \
"Returns: [int] 0 on success.\n" \
"Raises RuntimeError on error.\n" \
@@ -556,10 +560,7 @@ static PyObject *xspy_introduce_domain(PyObject *self, PyObject *args,
if (!PyArg_ParseTupleAndKeywords(args, kwds, arg_spec, kwd_spec,
&dom, &page, &port, &path))
goto exit;
- printf("%s> dom=%u page=0x%08lx port=%u path=%s\n", __FUNCTION__, dom,
- page, port, path);
xsval = xs_introduce_domain(xh, dom, page, port, path);
- printf("%s> xsval=%d\n", __FUNCTION__, xsval);
val = pyvalue_int(xsval);
exit:
return val;
@@ -590,9 +591,7 @@ static PyObject *xspy_release_domain(PyObject *self, PyObject *args,
if (!PyArg_ParseTupleAndKeywords(args, kwds, arg_spec, kwd_spec,
&dom))
goto exit;
- printf("%s> dom=%u\n", __FUNCTION__, dom);
xsval = xs_release_domain(xh, dom);
- printf("%s> xsval=%d\n", __FUNCTION__, xsval);
val = pyvalue_int(xsval);
exit:
return val;
@@ -651,6 +650,28 @@ static PyObject *xspy_shutdown(PyObject *self, PyObject *args, PyObject *kwds)
return val;
}
+#define xspy_fileno_doc "\n" \
+ "Get the file descriptor of the xenstore socket.\n" \
+ "Allows an xs object to be passed to select().\n" \
+ "\n" \
+ "Returns: [int] file descriptor.\n" \
+ "\n"
+
+static PyObject *xspy_fileno(PyObject *self, PyObject *args, PyObject *kwds)
+{
+ static char *kwd_spec[] = { NULL };
+ static char *arg_spec = "";
+
+ struct xs_handle *xh = xshandle(self);
+ PyObject *val = NULL;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, arg_spec, kwd_spec))
+ goto exit;
+ val = PyInt_FromLong((xh ? xs_fileno(xh) : -1));
+ exit:
+ return val;
+}
+
#define XSPY_METH(_name) { \
.ml_name = #_name, \
.ml_meth = (PyCFunction) xspy_ ## _name, \
@@ -675,17 +696,14 @@ static PyMethodDef xshandle_methods[] = {
XSPY_METH(release_domain),
XSPY_METH(close),
XSPY_METH(shutdown),
+ XSPY_METH(fileno),
{ /* Terminator. */ },
};
static PyObject *xshandle_getattr(PyObject *self, char *name)
{
PyObject *val = NULL;
- if (strcmp(name, "fileno") == 0) {
- struct xs_handle *xh = xshandle(self);
- val = PyInt_FromLong((xh ? xs_fileno(xh) : -1));
- } else
- val = Py_FindMethod(xshandle_methods, self, name);
+ val = Py_FindMethod(xshandle_methods, self, name);
return val;
}
@@ -754,7 +772,7 @@ static PyMethodDef xs_methods[] = {
"Raises RuntimeError on error.\n"
"\n"
},
- { NULL, NULL, 0, NULL }
+ { /* Terminator. */ }
};
PyMODINIT_FUNC initxs (void)
diff --git a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py
index 4e05ac0861..a47709a369 100644
--- a/tools/python/xen/xend/XendDomainInfo.py
+++ b/tools/python/xen/xend/XendDomainInfo.py
@@ -511,7 +511,7 @@ class XendDomainInfo:
self.configure_restart()
self.construct_image()
self.configure()
- self.exportToDB()
+ self.exportToDB(save=True)
except Exception, ex:
# Catch errors, cleanup and re-raise.
print 'Domain construction error:', ex
@@ -523,7 +523,7 @@ class XendDomainInfo:
def register_domain(self):
xd = get_component('xen.xend.XendDomain')
xd._add_domain(self)
- self.exportToDB()
+ self.exportToDB(save=True)
def configure_cpus(self, config):
try:
diff --git a/tools/python/xen/xend/server/blkif.py b/tools/python/xen/xend/server/blkif.py
index 59932a3d8b..dac65c426b 100755
--- a/tools/python/xen/xend/server/blkif.py
+++ b/tools/python/xen/xend/server/blkif.py
@@ -50,6 +50,9 @@ class BlkifBackend:
def getId(self):
return self.id
+ def getEvtchn(self):
+ return self.evtchn
+
def closeEvtchn(self):
if self.evtchn:
channel.eventChannelClose(self.evtchn)
@@ -198,7 +201,7 @@ class BlkDev(Dev):
backend = self.getBackend()
if backend and backend.evtchn:
db = self.db.addChild("evtchn")
- backend.evtchn.exportToDB(db, save=save)
+ backend.evtchn.saveToDB(db, save=save)
def init(self, recreate=False, reboot=False):
self.frontendDomain = self.getDomain()
diff --git a/tools/python/xen/xend/server/netif.py b/tools/python/xen/xend/server/netif.py
index 8c60904ec5..8d89f73605 100755
--- a/tools/python/xen/xend/server/netif.py
+++ b/tools/python/xen/xend/server/netif.py
@@ -95,7 +95,7 @@ class NetDev(Dev):
Dev.exportToDB(self, save=save)
if self.evtchn:
db = self.db.addChild("evtchn")
- self.evtchn.exportToDB(db, save=save)
+ self.evtchn.saveToDB(db, save=save)
def init(self, recreate=False, reboot=False):
self.destroyed = False
diff --git a/tools/python/xen/xend/xenstore/xsnode.py b/tools/python/xen/xend/xenstore/xsnode.py
index fee14c395c..94b264c3cf 100644
--- a/tools/python/xen/xend/xenstore/xsnode.py
+++ b/tools/python/xen/xend/xenstore/xsnode.py
@@ -64,7 +64,7 @@ class Watcher:
def fileno(self):
if self.xs:
- return self.xs.fileno
+ return self.xs.fileno()
else:
return -1