ia64/xen-unstable

view tools/python/xen/xend/server/SrvNode.py @ 6932:10d2067f6016

Removed unused impotr and marked some parameters as unused.

Signed-off-by: Ewan Mellor<ewan@xensource.com>
author emellor@ewan
date Sat Sep 17 10:42:49 2005 +0100 (2005-09-17)
parents 3233e7ecfa9f
children 308260e5868c c0c96a494c76
line source
1 #============================================================================
2 # This library is free software; you can redistribute it and/or
3 # modify it under the terms of version 2.1 of the GNU Lesser General Public
4 # License as published by the Free Software Foundation.
5 #
6 # This library is distributed in the hope that it will be useful,
7 # but WITHOUT ANY WARRANTY; without even the implied warranty of
8 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
9 # Lesser General Public License for more details.
10 #
11 # You should have received a copy of the GNU Lesser General Public
12 # License along with this library; if not, write to the Free Software
13 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
14 #============================================================================
15 # Copyright (C) 2004, 2005 Mike Wray <mike.wray@hp.com>
16 #============================================================================
19 from xen.web.SrvDir import SrvDir
20 from xen.xend import sxp
21 from xen.xend import XendNode
22 from xen.xend.Args import FormFn
24 class SrvNode(SrvDir):
25 """Information about the node.
26 """
28 def __init__(self):
29 SrvDir.__init__(self)
30 self.xn = XendNode.instance()
31 self.add('dmesg', 'SrvDmesg')
32 self.add('log', 'SrvXendLog')
34 def op_shutdown(self, _1, _2):
35 val = self.xn.shutdown()
36 return val
38 def op_reboot(self, _1, _2):
39 val = self.xn.reboot()
40 return val
42 def op_cpu_bvt_slice_set(self, _, req):
43 fn = FormFn(self.xn.cpu_bvt_slice_set,
44 [['ctx_allow', 'int']])
45 val = fn(req.args, {})
46 return val
48 def render_POST(self, req):
49 return self.perform(req)
51 def render_GET(self, req):
52 if self.use_sxp(req):
53 req.setHeader("Content-Type", sxp.mime_type)
54 sxp.show(['node'] + self.info(), out=req)
55 else:
56 url = req.prePathURL()
57 if not url.endswith('/'):
58 url += '/'
59 req.write('<html><head></head><body>')
60 self.print_path(req)
61 req.write('<ul>')
62 for d in self.info():
63 req.write('<li> %10s: %s' % (d[0], str(d[1])))
64 req.write('<li><a href="%sdmesg">Xen dmesg output</a>' % url)
65 req.write('<li><a href="%slog>Xend log</a>' % url)
66 req.write('</ul>')
67 req.write('</body></html>')
69 def info(self):
70 return self.xn.info()