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] Many files:

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Many files:
From: BitKeeper Bot <riel@xxxxxxxxxxx>
Date: Fri, 17 Jun 2005 10:24:34 +0000
Delivery-date: Sat, 18 Jun 2005 01:02:16 +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.1.18, 2005/06/17 11:24:34+01:00, cl349@xxxxxxxxxxxxxxxxxxxx

        Many files:
          - watch now takes a token, returned when reading watch
          - More tests
          - Fix domain shared page communication (flush output)
          - Add "home" path for domains
          - More permissions checks in various functions
          - Simplify watch acknowledgement code and fix occasional bug
        xs_watch_stress.c, 12readonly.sh, 11domain-watch.sh, 
10domain-homedir.sh:
          new file
        xs_stress.c, xs_lib.h, xs_lib.c:
          Cleanup whitespace.
        ignore:
          Add tools/xenstore/xs_watch_stress
        Signed-off-by: Rusty Russell <rusty@xxxxxxxxxxxxxxx>
        Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>



 python/xen/lowlevel/xs/xs.c            |   35 +++---
 xenstore/Makefile                      |   14 +-
 xenstore/testsuite/07watch.sh          |  116 +++++++++++++++++---
 xenstore/testsuite/10domain-homedir.sh |   12 ++
 xenstore/testsuite/11domain-watch.sh   |   51 ++++++++
 xenstore/testsuite/12readonly.sh       |   40 ++++++
 xenstore/testsuite/test.sh             |    2 
 xenstore/xenstored_core.c              |  126 +++++++++++++++++-----
 xenstore/xenstored_core.h              |   19 ++-
 xenstore/xenstored_domain.c            |   28 +++-
 xenstore/xenstored_domain.h            |    4 
 xenstore/xenstored_transaction.c       |    1 
 xenstore/xenstored_watch.c             |  189 +++++++++++++++++++++------------
 xenstore/xenstored_watch.h             |   20 ++-
 xenstore/xs.c                          |   62 ++++++----
 xenstore/xs.h                          |   41 +++----
 xenstore/xs_lib.c                      |    3 
 xenstore/xs_lib.h                      |    8 -
 xenstore/xs_stress.c                   |    2 
 xenstore/xs_test.c                     |   35 +++---
 xenstore/xs_watch_stress.c             |  120 ++++++++++++++++++++
 21 files changed, 712 insertions(+), 216 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-17 21:03:20 -04:00
+++ b/tools/python/xen/lowlevel/xs/xs.c 2005-06-17 21:03:20 -04:00
@@ -277,10 +277,11 @@
 
 static PyObject *xspy_watch(PyObject *self, PyObject *args, PyObject *kwds)
 {
-    static char *kwd_spec[] = { "path", "priority", NULL };
-    static char *arg_spec = "s|i";
+    static char *kwd_spec[] = { "path", "priority", "token", NULL };
+    static char *arg_spec = "s|is";
     char *path = NULL;
     int priority = 0;
+    char *token;
 
     struct xs_handle *xh = xshandle(self);
     PyObject *val = NULL;
@@ -289,9 +290,9 @@
     if (!xh)
        goto exit;
     if (!PyArg_ParseTupleAndKeywords(args, kwds, arg_spec, kwd_spec, 
-                                     &path, &priority))
+                                     &path, &priority, &token))
         goto exit;
-    xsval = xs_watch(xh, path, priority);
+    xsval = xs_watch(xh, path, token, priority);
     val = pyvalue_int(xsval);
  exit:
     return val;
@@ -305,14 +306,19 @@
 
     struct xs_handle *xh = xshandle(self);
     PyObject *val = NULL;
-    char *xsval = NULL;
+    char **xsval = NULL;
 
     if (!xh)
        goto exit;
     if (!PyArg_ParseTupleAndKeywords(args, kwds, arg_spec, kwd_spec))
         goto exit;
     xsval = xs_read_watch(xh);
-    val = pyvalue_str(xsval);
+    if(!xsval){
+            val = PyErr_SetFromErrno(PyExc_RuntimeError);
+            goto exit;
+    }
+    /* Create tuple (path, token). */
+    val = Py_BuildValue("(ss)", xsval[0], xsval[1]);
  exit:
     if (xsval)
        free(xsval);
@@ -323,7 +329,8 @@
                                        PyObject *kwds)
 {
     static char *kwd_spec[] = { NULL };
-    static char *arg_spec = "";
+    static char *arg_spec = "s";
+    char *token = "";
 
     struct xs_handle *xh = xshandle(self);
     PyObject *val = NULL;
@@ -331,9 +338,9 @@
 
     if (!xh)
        goto exit;
-    if (!PyArg_ParseTupleAndKeywords(args, kwds, arg_spec, kwd_spec))
+    if (!PyArg_ParseTupleAndKeywords(args, kwds, arg_spec, kwd_spec, &token))
         goto exit;
-    xsval = xs_acknowledge_watch(xh);
+    xsval = xs_acknowledge_watch(xh, token);
     val = pyvalue_int(xsval);
  exit:
     return val;
@@ -341,9 +348,10 @@
 
 static PyObject *xspy_unwatch(PyObject *self, PyObject *args, PyObject *kwds)
 {
-    static char *kwd_spec[] = { "path", NULL };
-    static char *arg_spec = "s|";
+    static char *kwd_spec[] = { "path", "token", NULL };
+    static char *arg_spec = "s|s";
     char *path = NULL;
+    char *token = "";
 
     struct xs_handle *xh = xshandle(self);
     PyObject *val = NULL;
@@ -351,9 +359,10 @@
 
     if (!xh)
        goto exit;
-    if (!PyArg_ParseTupleAndKeywords(args, kwds, arg_spec, kwd_spec, &path))
+    if (!PyArg_ParseTupleAndKeywords(args, kwds, arg_spec, kwd_spec, &path,
+                                    &token))
         goto exit;
-    xsval = xs_unwatch(xh, path);
+    xsval = xs_unwatch(xh, path, token);
     val = pyvalue_int(xsval);
  exit:
     return val;
diff -Nru a/tools/xenstore/Makefile b/tools/xenstore/Makefile
--- a/tools/xenstore/Makefile   2005-06-17 21:03:20 -04:00
+++ b/tools/xenstore/Makefile   2005-06-17 21:03:20 -04:00
@@ -41,8 +41,9 @@
 xs_test: xs_test.o xs_lib.o utils.o
 xs_random: xs_random.o xs_test_lib.o xs_lib.o talloc.o utils.o
 xs_stress: xs_stress.o xs_test_lib.o xs_lib.o talloc.o utils.o
+xs_watch_stress: xs_watch_stress.o xs_test_lib.o xs_lib.o talloc.o utils.o
 
-xs_test.o xs_stress.o xenstored_core_test.o xenstored_watch_test.o 
xenstored_transaction_test.o xenstored_domain_test.o xs_random.o xs_test_lib.o 
talloc_test.o fake_libxc.o: CFLAGS=$(BASECFLAGS) $(TESTFLAGS)
+xs_test.o xs_stress.o xs_watch_stress.o xenstored_core_test.o 
xenstored_watch_test.o xenstored_transaction_test.o xenstored_domain_test.o 
xs_random.o xs_test_lib.o talloc_test.o fake_libxc.o: CFLAGS=$(BASECFLAGS) 
$(TESTFLAGS)
 
 xenstored_%_test.o: xenstored_%.c
        $(COMPILE.c) -o $@ $<
@@ -63,8 +64,9 @@
 libxenstore-pic.a: $(LIB_OBJS_PIC)
 
 clean: testsuite-clean
-       rm -f *.o *.opic *.a xen
-       rm -f xs_test xenstored xenstored_test xs_random xs_stress xs_dom0_test
+       rm -f *.o *.opic *.a
+       rm -f xen xenstored xs_random xs_stress xs_watch_stress
+       rm -f xs_test xenstored_test xs_dom0_test
        -$(RM) $(PROG_DEP)
 
 check: testsuite-run randomcheck stresstest
@@ -83,9 +85,11 @@
        $(TESTENV) ./xs_random --fast /tmp/xs_random 100000 $(RANDSEED)
        $(TESTENV) ./xs_random --fail /tmp/xs_random 10000 $(RANDSEED)
 
-stresstest: xs_stress xenstored_test
+stresstest: xs_stress xs_watch_stress xenstored_test
        rm -rf $(TESTDIR)/store
-       export $(TESTENV); PID=`./xenstored_test --output-pid`; ./xs_stress 
10000; ret=$$?; kill $$PID; exit $$ret
+       export $(TESTENV); PID=`./xenstored_test --output-pid`; ./xs_stress 
5000; ret=$$?; kill $$PID; exit $$ret
+       rm -rf $(TESTDIR)/store
+       export $(TESTENV); PID=`./xenstored_test --output-pid`; 
./xs_watch_stress; ret=$$?; kill $$PID; exit $$ret
 
 xs_dom0_test: xs_dom0_test.o utils.o
        $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -lxc -o $@
diff -Nru a/tools/xenstore/testsuite/07watch.sh 
b/tools/xenstore/testsuite/07watch.sh
--- a/tools/xenstore/testsuite/07watch.sh       2005-06-17 21:03:20 -04:00
+++ b/tools/xenstore/testsuite/07watch.sh       2005-06-17 21:03:20 -04:00
@@ -3,30 +3,118 @@
 # Watch something, write to it, check watch has fired.
 [ "`echo -e 'write /test create contents' | ./xs_test 2>&1`" = "" ]
 
-[ "`echo -e '1 watch /test 100\n2 write /test create contents2\n1 waitwatch\n1 
ackwatch' | ./xs_test 2>&1`" = "1:/test" ]
+[ "`echo -e '1 watch /test token 100
+2 write /test create contents2
+1 waitwatch
+1 ackwatch token' | ./xs_test 2>&1`" = "1:/test:token" ]
 
 # Check that reads don't set it off.
-[ "`echo -e '1 watch /test 100\n2 read /test\n1 waitwatch' | ./xs_test 2>&1`" 
= "2:contents2
+[ "`echo -e '1 watch /test token 100
+2 read /test
+1 waitwatch' | ./xs_test 2>&1`" = "2:contents2
 1:waitwatch timeout" ]
 
-# mkdir, setperm and rm should (also /tests watching dirs)
+# mkdir, setperm and rm should (also tests watching dirs)
 [ "`echo -e 'mkdir /dir' | ./xs_test 2>&1`" = "" ]
-[ "`echo -e '1 watch /dir 100\n2 mkdir /dir/newdir\n1 waitwatch\n1 ackwatch\n2 
setperm /dir/newdir 0 READ\n1 waitwatch\n1 ackwatch\n2 rm /dir/newdir\n1 
waitwatch\n1 ackwatch' | ./xs_test 2>&1`" = "1:/dir/newdir
-1:/dir/newdir
-1:/dir/newdir" ]
+[ "`echo -e '1 watch /dir token 100
+2 mkdir /dir/newdir
+1 waitwatch
+1 ackwatch token
+2 setperm /dir/newdir 0 READ
+1 waitwatch
+1 ackwatch token
+2 rm /dir/newdir
+1 waitwatch
+1 ackwatch token' | ./xs_test 2>&1`" = "1:/dir/newdir:token
+1:/dir/newdir:token
+1:/dir/newdir:token" ]
 
 # ignore watches while doing commands, should work.
-[ "`echo -e 'watch /dir 100\nwrite /dir/test create contents\nread 
/dir/test\nwaitwatch\nackwatch' | ./xs_test 2>&1`" = "contents
-/dir/test" ]
+[ "`echo -e 'watch /dir token 100
+write /dir/test create contents
+read /dir/test
+waitwatch
+ackwatch token' | ./xs_test 2>&1`" = "contents
+/dir/test:token" ]
 
 # watch priority /test.
-[ "`echo -e '1 watch /dir 1\n3 watch /dir 3\n2 watch /dir 2\nwrite /dir/test 
create contents\n3 waitwatch\n3 ackwatch\n2 waitwatch\n2 ackwatch\n1 
waitwatch\n1 ackwatch' | ./xs_test 2>&1`" = "3:/dir/test
-2:/dir/test
-1:/dir/test" ]
+[ "`echo -e '1 watch /dir token1 1
+3 watch /dir token3 3
+2 watch /dir token2 2
+write /dir/test create contents
+3 waitwatch
+3 ackwatch token3
+2 waitwatch
+2 ackwatch token2
+1 waitwatch
+1 ackwatch token1' | ./xs_test 2>&1`" = "3:/dir/test:token3
+2:/dir/test:token2
+1:/dir/test:token1" ]
 
 # If one dies (without acking), the other should still get ack.
-[ "`echo -e '1 watch /dir 0\n2 watch /dir 1\nwrite /dir/test create 
contents\n2 waitwatch\n2 close\n1 waitwatch\n1 ackwatch' | ./xs_test 2>&1`" = 
"2:/dir/test
-1:/dir/test" ]
+[ "`echo -e '1 watch /dir token1 0
+2 watch /dir token2 1
+write /dir/test create contents
+2 waitwatch
+2 close
+1 waitwatch
+1 ackwatch token1' | ./xs_test 2>&1`" = "2:/dir/test:token2
+1:/dir/test:token1" ]
 
 # If one dies (without reading at all), the other should still get ack.
-[ "`echo -e '1 watch /dir 0\n2 watch /dir 1\nwrite /dir/test create 
contents\n2 close\n1 waitwatch\n1 ackwatch' | ./xs_test 2>&1`" = "1:/dir/test" ]
+[ "`echo -e '1 watch /dir token1 0
+2 watch /dir token2 1
+write /dir/test create contents
+2 close
+1 waitwatch
+1 ackwatch token1' | ./xs_test 2>&1`" = "1:/dir/test:token1" ]
+
+# unwatch
+[ "`echo -e '1 watch /dir token1 0
+1 unwatch /dir token1
+1 watch /dir token2 0
+2 write /dir/test2 create contents
+1 waitwatch
+1 unwatch /dir token2' | ./xs_test 2>&1`" = "1:/dir/test2:token2" ]
+
+# unwatch while watch pending.
+[ "`echo -e '1 watch /dir token1 0
+2 watch /dir token2 1
+write /dir/test create contents
+2 unwatch /dir token2
+1 waitwatch
+1 ackwatch token1' | ./xs_test 2>&1`" = "1:/dir/test:token1" ]
+
+# check we only get notified once.
+[ "`echo -e '1 watch /test token 100
+2 write /test create contents2
+1 waitwatch
+1 ackwatch token
+1 waitwatch' | ./xs_test 2>&1`" = "1:/test:token
+1:waitwatch timeout" ]
+

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

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