ia64/xen-unstable

changeset 7591:a51ec6d425e7

Removed the event server, and all it entails. This is unused, and a big pile
of crusty rubbish.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author emellor@leeni.uk.xensource.com
date Mon Oct 31 16:56:34 2005 +0100 (2005-10-31)
parents 69958a5b94a3
children 4e6c0734c409
files tools/examples/xend-config.sxp tools/python/xen/xend/XendRoot.py tools/python/xen/xend/server/SrvDaemon.py
line diff
     1.1 --- a/tools/examples/xend-config.sxp	Mon Oct 31 16:54:05 2005 +0100
     1.2 +++ b/tools/examples/xend-config.sxp	Mon Oct 31 16:56:34 2005 +0100
     1.3 @@ -25,9 +25,6 @@
     1.4  # Port xend should use for the HTTP interface, if xend-http-server is set.
     1.5  #(xend-port            8000)
     1.6  
     1.7 -# Port xend should use for the event interface.  This interface is deprecated.
     1.8 -#(xend-event-port      8001)
     1.9 -
    1.10  # Port xend should use for the relocation interface, if xend-relocation-server
    1.11  # is set.
    1.12  #(xend-relocation-port 8002)
     2.1 --- a/tools/python/xen/xend/XendRoot.py	Mon Oct 31 16:54:05 2005 +0100
     2.2 +++ b/tools/python/xen/xend/XendRoot.py	Mon Oct 31 16:56:34 2005 +0100
     2.3 @@ -17,7 +17,7 @@
     2.4  #============================================================================
     2.5  
     2.6  """Xend root class.
     2.7 -Creates the event server and handles configuration.
     2.8 +Creates the servers and handles configuration.
     2.9  
    2.10  Other classes get config variables by importing this module,
    2.11  using instance() to get a XendRoot instance, and then
    2.12 @@ -72,9 +72,6 @@ class XendRoot:
    2.13      """Default port xend serves HTTP at. """
    2.14      xend_port_default         = '8000'
    2.15  
    2.16 -    """Default port xend serves events at. """
    2.17 -    xend_event_port_default   = '8001'
    2.18 -
    2.19      """Default port xend serves relocation at. """
    2.20      xend_relocation_port_default = '8002'
    2.21  
    2.22 @@ -210,21 +207,16 @@ class XendRoot:
    2.23          """
    2.24          return self.get_config_int('xend-port', self.xend_port_default)
    2.25  
    2.26 -    def get_xend_event_port(self):
    2.27 -        """Get the port xend listens at for connection to its event server.
    2.28 -        """
    2.29 -        return self.get_config_int('xend-event-port', self.xend_event_port_default)
    2.30 -
    2.31      def get_xend_relocation_port(self):
    2.32          """Get the port xend listens at for connection to its relocation server.
    2.33          """
    2.34          return self.get_config_int('xend-relocation-port', self.xend_relocation_port_default)
    2.35  
    2.36      def get_xend_address(self):
    2.37 -        """Get the address xend listens at for its HTTP and event ports.
    2.38 +        """Get the address xend listens at for its HTTP port.
    2.39          This defaults to the empty string which allows all hosts to connect.
    2.40          If this is set to 'localhost' only the localhost will be able to connect
    2.41 -        to the HTTP and event ports.
    2.42 +        to the HTTP port.
    2.43          """
    2.44          return self.get_config_value('xend-address', self.xend_address_default)
    2.45  
    2.46 @@ -232,7 +224,7 @@ class XendRoot:
    2.47          """Get the address xend listens at for its relocation server port.
    2.48          This defaults to the empty string which allows all hosts to connect.
    2.49          If this is set to 'localhost' only the localhost will be able to connect
    2.50 -        to the HTTP and event ports.
    2.51 +        to the relocation port.
    2.52          """
    2.53          return self.get_config_value('xend-relocation-address', self.xend_relocation_address_default)
    2.54  
     3.1 --- a/tools/python/xen/xend/server/SrvDaemon.py	Mon Oct 31 16:54:05 2005 +0100
     3.2 +++ b/tools/python/xen/xend/server/SrvDaemon.py	Mon Oct 31 16:56:34 2005 +0100
     3.3 @@ -19,7 +19,6 @@ import xen.lowlevel.xc
     3.4  from xen.xend.server import SrvServer
     3.5  from xen.xend.XendLogging import log
     3.6  
     3.7 -import event
     3.8  import relocate
     3.9  from params import *
    3.10  
    3.11 @@ -273,7 +272,6 @@ class Daemon:
    3.12              log.info("Xend changeset: %s.", xinfo['xen_changeset'])
    3.13              del xc
    3.14  
    3.15 -            event.listenEvent(self)
    3.16              relocate.listenRelocation()
    3.17              servers = SrvServer.create()
    3.18              self.daemonize()
     4.1 --- a/tools/python/xen/xend/server/event.py	Mon Oct 31 16:54:05 2005 +0100
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,196 +0,0 @@
     4.4 -#============================================================================
     4.5 -# This library is free software; you can redistribute it and/or
     4.6 -# modify it under the terms of version 2.1 of the GNU Lesser General Public
     4.7 -# License as published by the Free Software Foundation.
     4.8 -#
     4.9 -# This library is distributed in the hope that it will be useful,
    4.10 -# but WITHOUT ANY WARRANTY; without even the implied warranty of
    4.11 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    4.12 -# Lesser General Public License for more details.
    4.13 -#
    4.14 -# You should have received a copy of the GNU Lesser General Public
    4.15 -# License along with this library; if not, write to the Free Software
    4.16 -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    4.17 -#============================================================================
    4.18 -# Copyright (C) 2004, 2005 Mike Wray <mike.wray@hp.com>
    4.19 -# Copyright (C) 2005 XenSource Ltd
    4.20 -#============================================================================
    4.21 -
    4.22 -import sys
    4.23 -import StringIO
    4.24 -
    4.25 -from xen.web import protocol, tcp, unix
    4.26 -
    4.27 -from xen.xend import scheduler
    4.28 -from xen.xend import sxp
    4.29 -from xen.xend import PrettyPrint
    4.30 -from xen.xend.XendError import XendError
    4.31 -from xen.xend import XendLogging
    4.32 -from xen.xend import XendRoot
    4.33 -
    4.34 -
    4.35 -xroot = XendRoot.instance()
    4.36 -
    4.37 -
    4.38 -DEBUG = 0
    4.39 -
    4.40 -class EventProtocol(protocol.Protocol):
    4.41 -    """Asynchronous handler for a connected event socket.
    4.42 -    """
    4.43 -
    4.44 -    def __init__(self, daemon):
    4.45 -        #protocol.Protocol.__init__(self)
    4.46 -        self.daemon = daemon
    4.47 -        # Event queue.
    4.48 -        self.queue = []
    4.49 -        self.parser = sxp.Parser()
    4.50 -        self.pretty = 1
    4.51 -
    4.52 -    def dataReceived(self, data):
    4.53 -        try:
    4.54 -            self.parser.input(data)
    4.55 -            while(self.parser.ready()):
    4.56 -                val = self.parser.get_val()
    4.57 -                res = self.dispatch(val)
    4.58 -                self.send_result(res)
    4.59 -            if self.parser.at_eof():
    4.60 -                self.loseConnection()
    4.61 -        except SystemExit:
    4.62 -            raise
    4.63 -        except:
    4.64 -            self.send_error()
    4.65 -
    4.66 -    def loseConnection(self):
    4.67 -        if self.transport:
    4.68 -            self.transport.loseConnection()
    4.69 -        if self.connected:
    4.70 -            scheduler.now(self.connectionLost)
    4.71 -
    4.72 -    def connectionLost(self, reason=None):
    4.73 -        pass
    4.74 -
    4.75 -    def send_reply(self, sxpr):
    4.76 -        io = StringIO.StringIO()
    4.77 -        if self.pretty:
    4.78 -            PrettyPrint.prettyprint(sxpr, out=io)
    4.79 -        else:
    4.80 -            sxp.show(sxpr, out=io)
    4.81 -        print >> io
    4.82 -        io.seek(0)
    4.83 -        if self.transport:
    4.84 -            return self.transport.write(io.getvalue())
    4.85 -        else:
    4.86 -            return 0
    4.87 -
    4.88 -    def send_result(self, res):
    4.89 -        if res is None:
    4.90 -            resp = ['ok']
    4.91 -        else:
    4.92 -            resp = ['ok', res]
    4.93 -        return self.send_reply(resp)
    4.94 -
    4.95 -    def send_error(self):
    4.96 -        (extype, exval) = sys.exc_info()[:2]
    4.97 -        return self.send_reply(['err',
    4.98 -                                ['type', str(extype)],
    4.99 -                                ['value', str(exval)]])
   4.100 -
   4.101 -    def send_event(self, val):
   4.102 -        return self.send_reply(['event', val[0], val[1]])
   4.103 -
   4.104 -    def queue_event(self, name, v):
   4.105 -        # Despite the name we don't queue the event here.
   4.106 -        # We send it because the transport will queue it.
   4.107 -        self.send_event([name, v])
   4.108 -        
   4.109 -    def opname(self, name):
   4.110 -         return 'op_' + name.replace('.', '_')
   4.111 -
   4.112 -    def operror(self, name, req):
   4.113 -        raise XendError('Invalid operation: ' +name)
   4.114 -
   4.115 -    def dispatch(self, req):
   4.116 -        op_name = sxp.name(req)
   4.117 -        op_method_name = self.opname(op_name)
   4.118 -        op_method = getattr(self, op_method_name, self.operror)
   4.119 -        return op_method(op_name, req)
   4.120 -
   4.121 -    def op_help(self, _1, _2):
   4.122 -        def nameop(x):
   4.123 -            if x.startswith('op_'):
   4.124 -                return x[3:].replace('_', '.')
   4.125 -            else:
   4.126 -                return x
   4.127 -        
   4.128 -        l = [ nameop(k) for k in dir(self) if k.startswith('op_') ]
   4.129 -        return l
   4.130 -
   4.131 -    def op_quit(self, _1, _2):
   4.132 -        self.loseConnection()
   4.133 -
   4.134 -    def op_exit(self, _1, _2):
   4.135 -        sys.exit(0)
   4.136 -
   4.137 -    def op_pretty(self, _1, _2):
   4.138 -        self.pretty = 1
   4.139 -
   4.140 -    def op_info(self, _1, _2):
   4.141 -        val = ['info']
   4.142 -        #val += self.daemon.blkifs()
   4.143 -        #val += self.daemon.netifs()
   4.144 -        #val += self.daemon.usbifs()
   4.145 -        return val
   4.146 -
   4.147 -    def op_trace(self, _, v):
   4.148 -        mode = (v[1] == 'on')
   4.149 -        self.daemon.tracing(mode)
   4.150 -
   4.151 -    def op_log_stderr(self, _, v):
   4.152 -        mode = v[1]
   4.153 -        if mode == 'on':
   4.154 -            XendLogging.addLogStderr()
   4.155 -        else:
   4.156 -            XendLogging.removeLogStderr()
   4.157 -
   4.158 -    def op_domain_ls(self, _1, _2):
   4.159 -        xd = xroot.get_component("xen.xend.XendDomain")
   4.160 -        return xd.list_names()
   4.161 -
   4.162 -    def op_domain_configure(self, _, v):
   4.163 -        domid = sxp.child_value(v, "dom")
   4.164 -        config = sxp.child_value(v, "config")
   4.165 -        if domid is None:
   4.166 -            raise XendError("missing domain id")
   4.167 -        if config is None:
   4.168 -            raise XendError("missing domain config")
   4.169 -        xd = xroot.get_component("xen.xend.XendDomain")
   4.170 -        xd.domain_configure(domid, config)
   4.171 -
   4.172 -    def op_domain_unpause(self, _, v):
   4.173 -        domid = sxp.child_value(v, "dom")
   4.174 -        if domid is None:
   4.175 -            raise XendError("missing domain id")
   4.176 -        xd = xroot.get_component("xen.xend.XendDomain")
   4.177 -        xd.domain_unpause(domid)
   4.178 -
   4.179 -class EventFactory(protocol.ServerFactory):
   4.180 -    """Asynchronous handler for the event server socket.
   4.181 -    """
   4.182 -
   4.183 -    def __init__(self, daemon):
   4.184 -        protocol.ServerFactory.__init__(self)
   4.185 -        self.daemon = daemon
   4.186 -
   4.187 -    def buildProtocol(self, _):
   4.188 -        return EventProtocol(self.daemon)
   4.189 -
   4.190 -def listenEvent(daemon):
   4.191 -    factory = EventFactory(daemon)
   4.192 -    if xroot.get_xend_unix_server():
   4.193 -        path = '/var/lib/xend/event-socket'
   4.194 -        unix.listenUNIX(path, factory)
   4.195 -    if xroot.get_xend_http_server():
   4.196 -        port = xroot.get_xend_event_port()
   4.197 -        interface = xroot.get_xend_address()
   4.198 -        l = tcp.listenTCP(port, factory, interface=interface)
   4.199 -        l.setCloExec()