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
4 """Xen management daemon.
5 Provides console server and HTTP management api.
13 - The daemon is stopped with:
16 The daemon should reconnect to device control interfaces
17 and recover its state when restarted.
19 - On Solaris, the daemons are SMF managed, and you should not attempt
20 - to start xend by hand.
32 from xen.xend.server import SrvDaemon
34 -class CheckError(ValueError):
38 - print >>sys.stderr, "*" * 70
41 - print >>sys.stderr, "*" * 3, message
44 - """Check python logging is installed and raise an error if not.
45 - Logging is standard from Python 2.3 on.
51 - msg("Python logging is not installed.")
52 - msg("Use 'make install-logging' at the xen root to install.")
54 - msg("Alternatively download and install from")
55 - msg("http://www.red-dove.com/python_logging.html")
57 - raise CheckError("logging is not installed")
60 - """Check that the effective user id is 0 (root).
62 - if os.geteuid() != 0:
64 - msg("Xend must be run as root.")
66 - raise CheckError("invalid user")
68 -def start_daemon(daemon, *args):
70 - os.execvp(daemon, (daemon,) + args)
72 -def start_blktapctrl():
73 - start_daemon("blktapctrl", "")
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":
88 - return daemon.start()
89 - elif sys.argv[1] == 'trace_start':
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':
98 - return daemon.stop() or daemon.start()
99 - elif sys.argv[1] == 'status':
100 - return daemon.status()
102 - print 'not an option:', sys.argv[1]
104 + return daemon.start()
106 if __name__ == '__main__':
108 diff -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 = {
113 _xend_autorestart = {
120 diff -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
130 + if not osdep.xend_autorestart:
131 + pidfile = open(XEND_PID_FILE, 'w')
133 + pidfile.write(str(child))
138 # Detach from standard file descriptors, and redirect them to