]> git.pld-linux.org Git - packages/xen.git/blame - xen-initscript.patch
restoring -j1
[packages/xen.git] / xen-initscript.patch
CommitLineData
7f560d13
JR
1--- xen-4.1.0/tools/misc/xend.orig 2010-02-02 20:43:01.000000000 +0000
2+++ xen-4.1.0/tools/misc/xend 2010-02-02 21:16:13.000000000 +0000
3@@ -8,103 +8,16 @@
4 """Xen management daemon.
5 Provides console server and HTTP management api.
6
7- Run:
8- xend start
9-
10- Restart:
11- xend restart
12-
13- The daemon is stopped with:
14- xend stop
15-
16 The daemon should reconnect to device control interfaces
17 and recover its state when restarted.
18
19- On Solaris, the daemons are SMF managed, and you should not attempt
20- to start xend by hand.
21 """
22-import fcntl
23-import glob
24-import os
25-import os.path
26 import sys
27-import socket
28-import signal
29-import time
30-import commands
31-
32 from xen.xend.server import SrvDaemon
33
34-class CheckError(ValueError):
35- pass
36-
37-def hline():
38- print >>sys.stderr, "*" * 70
39-
40-def msg(message):
41- print >>sys.stderr, "*" * 3, message
42-
43-def check_logging():
44- """Check python logging is installed and raise an error if not.
45- Logging is standard from Python 2.3 on.
46- """
47- try:
48- import logging
49- except ImportError:
50- hline()
51- msg("Python logging is not installed.")
52- msg("Use 'make install-logging' at the xen root to install.")
53- msg("")
54- msg("Alternatively download and install from")
55- msg("http://www.red-dove.com/python_logging.html")
56- hline()
57- raise CheckError("logging is not installed")
58-
59-def check_user():
60- """Check that the effective user id is 0 (root).
61- """
62- if os.geteuid() != 0:
63- hline()
64- msg("Xend must be run as root.")
65- hline()
66- raise CheckError("invalid user")
67-
68-def start_daemon(daemon, *args):
69- if os.fork() == 0:
70- os.execvp(daemon, (daemon,) + args)
71-
72-def start_blktapctrl():
73- start_daemon("blktapctrl", "")
74-
75 def main():
76- try:
77- check_logging()
78- check_user()
79- except CheckError:
80- sys.exit(1)
81-
82 daemon = SrvDaemon.instance()
83- if not sys.argv[1:]:
84- print 'usage: %s {start|stop|reload|restart}' % sys.argv[0]
85- elif sys.argv[1] == 'start':
86- if os.uname()[0] != "SunOS":
87- start_blktapctrl()
88- return daemon.start()
89- elif sys.argv[1] == 'trace_start':
90- start_blktapctrl()
91- return daemon.start(trace=1)
92- elif sys.argv[1] == 'stop':
93- return daemon.stop()
94- elif sys.argv[1] == 'reload':
95- return daemon.reloadConfig()
96- elif sys.argv[1] == 'restart':
97- start_blktapctrl()
98- return daemon.stop() or daemon.start()
99- elif sys.argv[1] == 'status':
100- return daemon.status()
101- else:
102- print 'not an option:', sys.argv[1]
103- return 1
104+ return daemon.start()
105
106 if __name__ == '__main__':
107 sys.exit(main())
108diff -up xen-3.4.0/tools/python/xen/xend/osdep.py.fix xen-3.4.0/tools/python/xen/xend/osdep.py
109--- xen-3.4.0/tools/python/xen/xend/osdep.py.fix 2009-05-18 13:05:38.000000000 +0200
110+++ xen-3.4.0/tools/python/xen/xend/osdep.py 2009-05-20 15:39:18.000000000 +0200
111@@ -27,7 +27,7 @@ _scripts_dir = {
112
113 _xend_autorestart = {
114 "NetBSD": True,
115- "Linux": True,
116+ "Linux": False,
117 "SunOS": False,
118 }
119
120diff -up xen-3.4.0/tools/python/xen/xend/server/SrvDaemon.py.fix xen-3.4.0/tools/python/xen/xend/server/SrvDaemon.py
121--- xen-3.4.0/tools/python/xen/xend/server/SrvDaemon.py.fix 2009-05-18 13:05:38.000000000 +0200
122+++ xen-3.4.0/tools/python/xen/xend/server/SrvDaemon.py 2009-05-20 15:39:18.000000000 +0200
123@@ -110,7 +110,14 @@ class Daemon:
124 # Fork, this allows the group leader to exit,
125 # which means the child can never again regain control of the
126 # terminal
127- if os.fork():
128+ child = os.fork()
129+ if child:
130+ if not osdep.xend_autorestart:
131+ pidfile = open(XEND_PID_FILE, 'w')
132+ try:
133+ pidfile.write(str(child))
134+ finally:
135+ pidfile.close()
136 os._exit(0)
137
138 # Detach from standard file descriptors, and redirect them to
This page took 0.076903 seconds and 4 git commands to generate.