Skip to contentSkip to conversation

UNTESTED: xend - Wait for child to exit on xenstored startup

PATCH In review Bastian Blank 1 participant 1 message Mar 26, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 2/3 UNTESTED: xend - Wait for child to exit on xenstored startup

# HG changeset patch
# User Bastian Blank <[email protected]>
# Date 1206528849 -3600
# Node ID f5eb725e1b5ed106be403bb2fa20dc74f98bcfc0 # Parent 784e9c500e4e6b2d6a76b639d695c8eaa5c99b62 Wait for child to exit on xenstored startup.

tools/misc/xend +7 -1
diff -r 784e9c500e4e -r f5eb725e1b5e tools/misc/xend
@@ -98,8 +98,14 @@ def start_xenstored():
     args = ['xenstored', "--pid-file", pidfname]
     if os.getenv("XENSTORED_TRACE"):
         args.extend(["-T", "/var/log/xen/xenstored-trace.log"])
-    if os.fork() == 0:
+    pid = os.fork()
+    if pid == 0:
         os.execvp('xenstored', args)
+    p, status = os.waitpid(pid, 0)
+    if os.WIFEXITED(status):
+        status = os.WEXITSTATUS(status)
+        if status:
+            raise RuntimeError("Failed to start xenstored: %d" % status)
 
 def start_consoled():
     if os.fork() == 0:
Signature · 2 lines
No one can guarantee the actions of another.
		-- Spock, "Day of the Dove", stardate unknown