debuggers.hg

view tools/python/xen/xend/server/SrvNode.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 7fc6eac6da3a
children 369e382b2f81
line source
1 # Copyright (C) 2004 Mike Wray <mike.wray@hp.com>
3 import os
5 from SrvDir import SrvDir
6 from xen.xend import sxp
7 from xen.xend import XendNode
8 from xen.xend.Args import FormFn
10 class SrvNode(SrvDir):
11 """Information about the node.
12 """
14 def __init__(self):
15 SrvDir.__init__(self)
16 self.xn = XendNode.instance()
17 self.add('dmesg', 'SrvDmesg')
18 self.add('log', 'SrvXendLog')
20 def op_shutdown(self, op, req):
21 val = self.xn.shutdown()
22 return val
24 def op_reboot(self, op, req):
25 val = self.xn.reboot()
26 return val
28 def op_cpu_bvt_slice_set(self, op, req):
29 fn = FormFn(self.xn.cpu_bvt_slice_set,
30 [['ctx_allow', 'int']])
31 val = fn(req.args, {})
32 return val
34 def render_POST(self, req):
35 return self.perform(req)
37 def render_GET(self, req):
38 if self.use_sxp(req):
39 req.setHeader("Content-Type", sxp.mime_type)
40 sxp.show(['node'] + self.info(), out=req)
41 else:
42 url = req.prePathURL()
43 if not url.endswith('/'):
44 url += '/'
45 req.write('<html><head></head><body>')
46 self.print_path(req)
47 req.write('<ul>')
48 for d in self.info():
49 req.write('<li> %10s: %s' % (d[0], str(d[1])))
50 req.write('<li><a href="%sdmesg">Xen dmesg output</a>' % url)
51 req.write('<li><a href="%slog>Xend log</a>' % url)
52 req.write('</ul>')
53 req.write('</body></html>')
55 def info(self):
56 return self.xn.info()