[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Add bindings for xs_get_domain_path().



# HG changeset patch
# User cl349@xxxxxxxxxxxxxxxxxxxx
# Node ID 931526414a644fc467a749a2f957f0c95b6c65f4
# Parent  6a48f88101d3fc8aa591b171f66b091fd4fb35e6
Add bindings for xs_get_domain_path().
Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>

diff -r 6a48f88101d3 -r 931526414a64 tools/python/xen/lowlevel/xs/xs.c
--- a/tools/python/xen/lowlevel/xs/xs.c Fri Sep 16 20:12:42 2005
+++ b/tools/python/xen/lowlevel/xs/xs.c Fri Sep 16 22:27:04 2005
@@ -812,6 +812,48 @@
     return val;
 }
 
+#define xspy_get_domain_path_doc "\n"                  \
+       "Return store path of domain.\n"                \
+       " domid [int]: domain id\n"                     \
+       "\n"                                            \
+       "Returns: [string] domain store path.\n"        \
+       "         None if domid doesn't exist.\n"       \
+       "Raises RuntimeError on error.\n"               \
+       "\n"
+
+static PyObject *xspy_get_domain_path(PyObject *self, PyObject *args,
+                                     PyObject *kwds)
+{
+    static char *kwd_spec[] = { "domid", NULL };
+    static char *arg_spec = "i";
+    int domid = 0;
+
+    struct xs_handle *xh = xshandle(self);
+    char *xsval = NULL;
+    PyObject *val = NULL;
+
+    if (!xh)
+        goto exit;
+    if (!PyArg_ParseTupleAndKeywords(args, kwds, arg_spec, kwd_spec,
+                                     &domid))
+        goto exit;
+    Py_BEGIN_ALLOW_THREADS
+    xsval = xs_get_domain_path(xh, domid);
+    Py_END_ALLOW_THREADS
+    if (!xsval) {
+        if (errno == ENOENT) {
+            Py_INCREF(Py_None);
+            val = Py_None;
+        } else
+            PyErr_SetFromErrno(PyExc_RuntimeError);
+        goto exit;
+    }
+    val = PyString_FromString(xsval);
+    free(xsval);
+ exit:
+    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"       \
@@ -858,6 +900,7 @@
      XSPY_METH(release_domain),
      XSPY_METH(close),
      XSPY_METH(shutdown),
+     XSPY_METH(get_domain_path),
      XSPY_METH(fileno),
      { /* Terminator. */ },
 };
diff -r 6a48f88101d3 -r 931526414a64 tools/python/xen/xend/xenstore/xsutil.py
--- a/tools/python/xen/xend/xenstore/xsutil.py  Fri Sep 16 20:12:42 2005
+++ b/tools/python/xen/xend/xenstore/xsutil.py  Fri Sep 16 22:27:04 2005
@@ -18,3 +18,6 @@
 
 def IntroduceDomain(domid, page, port, path):
     return xshandle().introduce_domain(domid, page, port, path)
+
+def GetDomainPath(domid):
+    return xshandle().get_domain_path(domid)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.