diff options
author | kaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk> | 2005-09-28 14:08:52 +0100 |
---|---|---|
committer | kaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk> | 2005-09-28 14:08:52 +0100 |
commit | 460d77e2da8cb4dfc7209b98d35215f474d2ae32 (patch) | |
tree | e593297e256041981f0889d3b1edb40f850ed60a | |
parent | a51b17cfb51a6ddf0e826c32859a1c23ebd61281 (diff) | |
parent | 34a989b22110bee89b34debd6f08734d2570f79e (diff) | |
download | xen-460d77e2da8cb4dfc7209b98d35215f474d2ae32.tar.gz xen-460d77e2da8cb4dfc7209b98d35215f474d2ae32.tar.bz2 xen-460d77e2da8cb4dfc7209b98d35215f474d2ae32.zip |
merge?
-rw-r--r-- | tools/python/xen/web/SrvBase.py | 9 | ||||
-rw-r--r-- | tools/python/xen/xend/XendDomain.py | 1 | ||||
-rw-r--r-- | tools/python/xen/xend/XendDomainInfo.py | 2 | ||||
-rw-r--r-- | tools/python/xen/xend/server/SrvDomainDir.py | 10 | ||||
-rw-r--r-- | tools/python/xen/xend/server/SrvNode.py | 2 | ||||
-rw-r--r-- | tools/python/xen/xend/xenstore/xstransact.py | 22 |
6 files changed, 37 insertions, 9 deletions
diff --git a/tools/python/xen/web/SrvBase.py b/tools/python/xen/web/SrvBase.py index 49a9e058d1..e0b528fcc0 100644 --- a/tools/python/xen/web/SrvBase.py +++ b/tools/python/xen/web/SrvBase.py @@ -81,7 +81,14 @@ class SrvBase(resource.Resource): req.write("Operation not implemented: " + op) return '' else: - return op_method(op, req) + try: + res = op_method(op, req) + except Exception, exn: + log.exception("Request %s failed.", op) + if req.useSxp(): + return ['xend.err', "Exception: " + str(exn)] + else: + return "<p>%s</p>" % str(exn) def print_path(self, req): """Print the path with hyperlinks. diff --git a/tools/python/xen/xend/XendDomain.py b/tools/python/xen/xend/XendDomain.py index dd983e4984..0ec777f6ab 100644 --- a/tools/python/xen/xend/XendDomain.py +++ b/tools/python/xen/xend/XendDomain.py @@ -547,6 +547,7 @@ class XendDomain: except XendError: raise except Exception, exn: + log.exception("") raise XendError(str(exn)) diff --git a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py index 21d365591c..45c0b2be44 100644 --- a/tools/python/xen/xend/XendDomainInfo.py +++ b/tools/python/xen/xend/XendDomainInfo.py @@ -615,7 +615,7 @@ class XendDomainInfo: if not reason in shutdown_reasons.values(): raise XendError('invalid reason:' + reason) self.storeVm("control/shutdown", reason) - if not reason in ['suspend']: + if not reason == 'suspend': self.storeVm('xend/shutdown_start_time', time.time()) diff --git a/tools/python/xen/xend/server/SrvDomainDir.py b/tools/python/xen/xend/server/SrvDomainDir.py index 942a69ea9a..00a498d559 100644 --- a/tools/python/xen/xend/server/SrvDomainDir.py +++ b/tools/python/xen/xend/server/SrvDomainDir.py @@ -152,11 +152,11 @@ class SrvDomainDir(SrvDir): domains = self.xd.list_sorted() req.write('<ul>') for d in domains: - req.write('<li><a href="%s%s"> Domain %s</a>' - % (url, d.getName(), d.getName())) - req.write('id=%s' % d.getDomain()) - req.write('memory=%d'% d.getMemoryTarget()) - req.write('ssidref=%d'% d.getSsidref()) + req.write( + '<li><a href="%s%s">Domain %s</a>: id = %s, memory = %d, ' + 'ssidref = %d.' + % (url, d.getName(), d.getName(), d.getDomid(), + d.getMemoryTarget(), d.getSsidref())) req.write('</li>') req.write('</ul>') diff --git a/tools/python/xen/xend/server/SrvNode.py b/tools/python/xen/xend/server/SrvNode.py index c8b0ad6dfd..8f598a3bb6 100644 --- a/tools/python/xen/xend/server/SrvNode.py +++ b/tools/python/xen/xend/server/SrvNode.py @@ -62,7 +62,7 @@ class SrvNode(SrvDir): for d in self.info(): req.write('<li> %10s: %s' % (d[0], str(d[1]))) req.write('<li><a href="%sdmesg">Xen dmesg output</a>' % url) - req.write('<li><a href="%slog>Xend log</a>' % url) + req.write('<li><a href="%slog">Xend log</a>' % url) req.write('</ul>') req.write('</body></html>') diff --git a/tools/python/xen/xend/xenstore/xstransact.py b/tools/python/xen/xend/xenstore/xstransact.py index 14d8b0472d..503136ad76 100644 --- a/tools/python/xen/xend/xenstore/xstransact.py +++ b/tools/python/xen/xend/xenstore/xstransact.py @@ -42,8 +42,15 @@ class xstransact: '%s, while reading %s' % (ex.args[1], path)) def read(self, *args): + """If no arguments are given, return the value at this transaction's + path. If one argument is given, treat that argument as a subpath to + this transaction's path, and return the value at that path. + Otherwise, treat each argument as a subpath to this transaction's + path, and return a list composed of the values at each of those + instead. + """ if len(args) == 0: - raise TypeError + return xshandle().read(self.path) if len(args) == 1: return self._read(args[0]) ret = [] @@ -191,6 +198,13 @@ class xstransact: def Read(cls, path, *args): + """If only one argument is given (path), return the value stored at + that path. If two arguments are given, treat the second argument as a + subpath within the first, and return the value at the composed path. + Otherwise, treat each argument after the first as a subpath to the + given path, and return a list composed of the values at each of those + instead. This operation is performed inside a transaction. + """ while True: t = cls(path) try: @@ -234,6 +248,12 @@ class xstransact: Remove = classmethod(Remove) def List(cls, path, *args): + """If no arguments are given (path), list its contents, returning the + entries therein, or None if no entries are found. Otherwise, treat + each further argument as a subpath to the given path, and return the + cumulative listing of each of those instead. This operation is + performed inside a transaction. + """ while True: t = cls(path) try: |