source: trunk/packages/xen-common/xen-common/tools/python/xen/xend/server/SrvDmesg.py @ 34

Last change on this file since 34 was 34, checked in by hartmans, 18 years ago

Add xen and xen-common

File size: 1.7 KB
Line 
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# Copyright (C) 2005 XenSource Ltd
17#============================================================================
18
19
20from xen.xend import XendDmesg
21
22from xen.web.SrvDir import SrvDir
23
24
25class SrvDmesg(SrvDir):
26    """Xen Dmesg output.
27    """
28
29    def __init__(self):
30        SrvDir.__init__(self)
31        self.xd = XendDmesg.instance()
32
33    def render_POST(self, req):
34        self.perform(req)
35
36    def render_GET(self, req):
37        if self.use_sxp(req):
38            req.setHeader("Content-Type", "text/plain")
39            req.write(self.info())
40        else:
41            req.write('<html><head></head><body>')
42            self.print_path(req)
43            req.write('<pre>')
44            req.write(self.info())
45            req.write('</pre></body></html>')
46           
47    def info(self):
48        return self.xd.info()
49
50    def op_clear(self, _1, _2):
51        self.xd.clear()
52        return 0
Note: See TracBrowser for help on using the repository browser.