Skip to contentSkip to conversation

Start of code to persistent store connections when xenstored restarts:

PATCH New Rusty Russell 1 participant 1 message Aug 4, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 2/11 Start of code to persistent store connections when xenstored restarts:

# HG changeset patch
# User Rusty Russell <[email protected]>
# Node ID e158ae50d2613b3e01d41c395b8dbc34c9766f73
# Parent bdc6aabe3e1a6f83e7119c68212c2c33a4cb851f
Start of code to persistent store connections when xenstored restarts:
Create tool/xenstored directory during initialization.

tools/xenstore/Makefile +2 -2
diff -r bdc6aabe3e1a -r e158ae50d261 tools/xenstore/Makefile
@@ -87,9 +87,9 @@
 	$(TESTENV) ./xs_random --fail /tmp/xs_random 10000 $(RANDSEED)
 
 stresstest: xs_stress xs_watch_stress xenstored_test
-	rm -rf $(TESTDIR)/store
+	rm -rf $(TESTDIR)/store $(TESTDIR)/transactions
 	export $(TESTENV); PID=`./xenstored_test --output-pid --trace-file=/tmp/trace`; ./xs_stress 5000; ret=$$?; kill $$PID; exit $$ret
-	rm -rf $(TESTDIR)/store
+	rm -rf $(TESTDIR)/store $(TESTDIR)/transactions
 	export $(TESTENV); PID=`./xenstored_test --output-pid`; ./xs_watch_stress; ret=$$?; kill $$PID; exit $$ret
 
 xs_dom0_test: xs_dom0_test.o utils.o
tools/xenstore/testsuite/02directory.sh +8 -7
diff -r bdc6aabe3e1a -r e158ae50d261 tools/xenstore/testsuite/02directory.sh
@@ -1,22 +1,23 @@
 #! /bin/sh
 
-# Root directory has nothing in it.
-[ "`echo -e 'dir /' | ./xs_test 2>&1`" = "" ]
+# Root directory has only tool dir in it.
+[ "`echo -e 'dir /' | ./xs_test 2>&1`" = "tool" ]
 
 # Create a file.
 [ "`echo -e 'write /test create contents' | ./xs_test 2>&1`" = "" ]
 
 # Directory shows it.
-[ "`echo -e 'dir /' | ./xs_test 2>&1`" = "test" ]
+[ "`echo -e 'dir /' | ./xs_test 2>&1 | sort`" = "test
+tool" ]
 
 # Make a new directory.
 [ "`echo -e 'mkdir /dir' | ./xs_test 2>&1`" = "" ]
 
 # Check it's there.
-DIR="`echo -e 'dir /' | ./xs_test 2>&1`"
-[ "$DIR" = "test
-dir" ] || [ "$DIR" = "dir
-test" ]
+DIR="`echo -e 'dir /' | ./xs_test 2>&1 | sort`"
+[ "$DIR" = "dir
+test
+tool" ]
 
 # Check it's empty.
 [ "`echo -e 'dir /dir' | ./xs_test 2>&1`" = "" ]
tools/xenstore/testsuite/08transaction.sh +46 -44

125 lines not on this page · raw message

tools/xenstore/testsuite/09domain.sh +3 -2
diff -r bdc6aabe3e1a -r e158ae50d261 tools/xenstore/testsuite/09domain.sh
@@ -4,8 +4,9 @@
 # Create a domain, write an entry.
 [ "`echo -e 'introduce 1 100 7 /my/home
 1 write /entry1 create contents
-dir /' | ./xs_test 2>&1`" = "handle is 1
-entry1" ]
+dir /' | ./xs_test 2>&1 | sort`" = "entry1
+handle is 1
+tool" ]
 
 # Release that domain.
 [ "`echo -e 'release 1' | ./xs_test`" = "" ]
tools/xenstore/testsuite/12readonly.sh +5 -4
diff -r bdc6aabe3e1a -r e158ae50d261 tools/xenstore/testsuite/12readonly.sh
@@ -4,16 +4,17 @@
 [ "`echo 'write /test create contents' | ./xs_test 2>&1`" = "" ]
 
 # These are all valid.
-[ "`echo 'dir /
-read /test
+[ "`echo dir / | ./xs_test --readonly 2>&1 | sort`" = "test
+tool" ]
+
+[ "`echo 'read /test
 getperm /test
 watch /test token 0
 unwatch /test token 
 start /
 commit
 start /
-abort' | ./xs_test --readonly 2>&1`" = "test
-contents
+abort' | ./xs_test --readonly 2>&1`" = "contents
 0 READ" ]
 
 # These don't work
tools/xenstore/xenstored_core.c +43 -12

70 lines not on this page · raw message

tools/xenstore/xenstored_domain.c +43 -24

94 lines not on this page · raw message

tools/xenstore/xenstored_domain.h +3 -0
diff -r bdc6aabe3e1a -r e158ae50d261 tools/xenstore/xenstored_domain.h
@@ -35,4 +35,7 @@
 
 /* Returns the implicit path of a connection (only domains have this) */
 const char *get_implicit_path(const struct connection *conn);
+
+/* Read existing connection information from store. */
+void restore_existing_connections(void);
 #endif /* _XENSTORED_DOMAIN_H */
tools/xenstore/xs_random.c +6 -0
diff -r bdc6aabe3e1a -r e158ae50d261 tools/xenstore/xs_random.c
@@ -987,6 +987,8 @@
 	char *cmd = talloc_asprintf(NULL, "echo -n r0 > %s/.perms", dir);
 	if (mkdir(dir, 0700) != 0)
 		barf_perror("Creating directory %s", dir);
+	if (mkdir(talloc_asprintf(cmd, "%s/tool", dir), 0700) != 0)
+		barf_perror("Creating directory %s/tool", dir);
 	do_command(cmd);
 	talloc_free(cmd);
 }
@@ -1211,6 +1213,10 @@
 	char *nodename;
 	bool ret = false;
 
+	/* Ignore tool/ dir. */
+	if (streq(node, "/tool"))
+		return true;
+
 	/* FILE backend expects talloc'ed pointer. */
 	nodename = talloc_strdup(NULL, node);
 	permsa = a->get_perms(ah, nodename, &numpermsa);
Signature · 1 line
A bad analogy is like a leaky screwdriver -- Richard Braakman