debuggers.hg

view tools/python/xen/xend/server/SrvConsole.py @ 4672:d781b9d08e80

bitkeeper revision 1.1327.2.4 (426918a34Af7gihN8mTkq-P3KrAZXg)

Remove twisted from save/migrate handling.
This needs to use threads, so add thread support for
http server requests.

Signed-off-by: Mike Wray <mike.wray@hp.com>
author mjw@wray-m-3.hpl.hp.com
date Fri Apr 22 15:30:43 2005 +0000 (2005-04-22)
parents dae98734f12e
children 369e382b2f81
line source
1 # Copyright (C) 2004 Mike Wray <mike.wray@hp.com>
3 from xen.xend import sxp
4 from xen.xend import XendConsole
5 from SrvDir import SrvDir
7 class SrvConsole(SrvDir):
8 """An individual console.
9 """
11 def __init__(self, info):
12 SrvDir.__init__(self)
13 self.info = info
14 self.xc = XendConsole.instance()
16 def op_disconnect(self, op, req):
17 val = self.xc.console_disconnect(self.info.console_port)
18 return val
20 def render_POST(self, req):
21 return self.perform(req)
23 def render_GET(self, req):
24 if self.use_sxp(req):
25 req.setHeader("Content-Type", sxp.mime_type)
26 sxp.show(self.info.sxpr(), out=req)
27 else:
28 req.write('<html><head></head><body>')
29 self.print_path(req)
30 #self.ls()
31 req.write('<p>%s</p>' % self.info)
32 req.write('<p><a href="%s">Connect to domain %d</a></p>'
33 % (self.info.uri(), self.info.dom))
34 self.form(req)
35 req.write('</body></html>')
37 def form(self, req):
38 req.write('<form method="post" action="%s">' % req.prePathURL())
39 if self.info.connected():
40 req.write('<input type="submit" name="op" value="disconnect">')
41 req.write('</form>')