WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] xsnode.py:

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] xsnode.py:
From: BitKeeper Bot <riel@xxxxxxxxxxx>
Date: Sun, 19 Jun 2005 08:48:22 +0000
Delivery-date: Sun, 19 Jun 2005 18:05:26 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: Xen Development List <xen-devel@xxxxxxxxxxxxxxxxxxx>
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
ChangeSet 1.1713.3.15, 2005/06/19 09:48:22+01:00, cl349@xxxxxxxxxxxxxxxxxxxx

        xsnode.py:
          fileno is a method now.
        netif.py, blkif.py, XendDomainInfo.py:
          Cleanup interface to DB.
        xs.c:
          Don't special case xs_fileno.
          Update comments.
        Signed-off-by: Mike Wray <mike.wray@xxxxxx>
        Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>



 lowlevel/xs/xs.c        |   76 +++++++++++++++++++++++++++++-------------------
 xend/XendDomainInfo.py  |    4 +-
 xend/server/blkif.py    |    5 ++-
 xend/server/netif.py    |    2 -
 xend/xenstore/xsnode.py |    2 -
 5 files changed, 55 insertions(+), 34 deletions(-)


diff -Nru a/tools/python/xen/lowlevel/xs/xs.c 
b/tools/python/xen/lowlevel/xs/xs.c
--- a/tools/python/xen/lowlevel/xs/xs.c 2005-06-19 14:06:29 -04:00
+++ b/tools/python/xen/lowlevel/xs/xs.c 2005-06-19 14:06:29 -04:00
@@ -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 @@
 #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 @@
     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 @@
     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 @@
 
 #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 @@
 #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 @@
     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 @@
     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 @@
     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 @@
      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 @@
       "Raises RuntimeError on error.\n"
       "\n"
     },
-    { NULL, NULL, 0, NULL }
+    { /* Terminator. */ }
 };
 
 PyMODINIT_FUNC initxs (void)
diff -Nru a/tools/python/xen/xend/XendDomainInfo.py 
b/tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   2005-06-19 14:06:29 -04:00
+++ b/tools/python/xen/xend/XendDomainInfo.py   2005-06-19 14:06:29 -04:00
@@ -511,7 +511,7 @@
             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 @@
     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 -Nru a/tools/python/xen/xend/server/blkif.py 
b/tools/python/xen/xend/server/blkif.py
--- a/tools/python/xen/xend/server/blkif.py     2005-06-19 14:06:29 -04:00
+++ b/tools/python/xen/xend/server/blkif.py     2005-06-19 14:06:29 -04:00
@@ -50,6 +50,9 @@
     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 @@
         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 -Nru a/tools/python/xen/xend/server/netif.py 
b/tools/python/xen/xend/server/netif.py
--- a/tools/python/xen/xend/server/netif.py     2005-06-19 14:06:29 -04:00
+++ b/tools/python/xen/xend/server/netif.py     2005-06-19 14:06:29 -04:00
@@ -95,7 +95,7 @@
         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 -Nru a/tools/python/xen/xend/xenstore/xsnode.py 
b/tools/python/xen/xend/xenstore/xsnode.py
--- a/tools/python/xen/xend/xenstore/xsnode.py  2005-06-19 14:06:29 -04:00
+++ b/tools/python/xen/xend/xenstore/xsnode.py  2005-06-19 14:06:29 -04:00
@@ -64,7 +64,7 @@
 
     def fileno(self):
         if self.xs:
-            return self.xs.fileno
+            return self.xs.fileno()
         else:
             return -1
 

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

<Prev in Thread] Current Thread [Next in Thread>