ia64/xen-unstable

changeset 11860:a682d1be3f95

[SOLARIS] Xen daemons are managed separately, so we need a way to start
just xend, and we need to disable xend's self-restarter.

Signed-off-by: John Levon <john.levon@sun.com>
author kfraser@localhost.localdomain
date Tue Oct 17 18:52:17 2006 +0100 (2006-10-17)
parents 025e19453f1a
children cd2a7dd45787
files tools/misc/xend tools/python/xen/xend/osdep.py tools/python/xen/xend/server/SrvDaemon.py
line diff
     1.1 --- a/tools/misc/xend	Tue Oct 17 18:50:08 2006 +0100
     1.2 +++ b/tools/misc/xend	Tue Oct 17 18:52:17 2006 +0100
     1.3 @@ -19,6 +19,9 @@
     1.4  
     1.5     The daemon should reconnect to device control interfaces
     1.6     and recover its state when restarted.
     1.7 +
     1.8 +   On Solaris, the daemons are SMF managed, and you should not attempt
     1.9 +   to start xend by hand.
    1.10  """
    1.11  import os
    1.12  import os.path
    1.13 @@ -108,9 +111,10 @@ def main():
    1.14      if not sys.argv[1:]:
    1.15          print 'usage: %s {start|stop|restart}' % sys.argv[0]
    1.16      elif sys.argv[1] == 'start':
    1.17 -        start_xenstored()
    1.18 -        start_consoled()
    1.19 -	start_blktapctrl()
    1.20 +        if os.uname()[0] != "SunOS":
    1.21 +            start_xenstored()
    1.22 +            start_consoled()
    1.23 +            start_blktapctrl()
    1.24          return daemon.start()
    1.25      elif sys.argv[1] == 'trace_start':
    1.26          start_xenstored()
     2.1 --- a/tools/python/xen/xend/osdep.py	Tue Oct 17 18:50:08 2006 +0100
     2.2 +++ b/tools/python/xen/xend/osdep.py	Tue Oct 17 18:52:17 2006 +0100
     2.3 @@ -24,4 +24,13 @@ import os
     2.4      "SunOS": "/usr/lib/xen/scripts",
     2.5  }
     2.6  
     2.7 -scripts_dir = _scripts_dir.get(os.uname()[0], "/etc/xen/scripts")
     2.8 +_xend_autorestart = {
     2.9 +    "Linux": True,
    2.10 +    "SunOS": False,
    2.11 +}
    2.12 +
    2.13 +def _get(var, default=None):
    2.14 +    return var.get(os.uname()[0], default)
    2.15 +
    2.16 +scripts_dir = _get(_scripts_dir, "/etc/xen/scripts")
    2.17 +xend_autorestart = _get(_xend_autorestart)
     3.1 --- a/tools/python/xen/xend/server/SrvDaemon.py	Tue Oct 17 18:50:08 2006 +0100
     3.2 +++ b/tools/python/xen/xend/server/SrvDaemon.py	Tue Oct 17 18:52:17 2006 +0100
     3.3 @@ -17,6 +17,7 @@ import traceback
     3.4  import xen.lowlevel.xc
     3.5  
     3.6  from xen.xend.XendLogging import log
     3.7 +from xen.xend import osdep
     3.8  
     3.9  import relocate
    3.10  import SrvServer
    3.11 @@ -168,8 +169,14 @@ class Daemon:
    3.12              # ready to receive requests.  All subsequent restarts we don't
    3.13              # want this behaviour, or the pipe will eventually fill up, so
    3.14              # we just pass None into run in subsequent cases (by clearing w
    3.15 -            # in the parent of the first fork).
    3.16 +            # in the parent of the first fork).  On some operating systems,
    3.17 +            # restart is managed externally, so we won't fork, and just exit.
    3.18              while True:
    3.19 +
    3.20 +                if not osdep.xend_autorestart:
    3.21 +                    self.run(os.fdopen(w, 'w'))
    3.22 +                    break
    3.23 +
    3.24                  pid = self.fork_pid()
    3.25                  if pid:
    3.26                      if w is not None: