From: Ewan Mellor Subject: Re: Who gives exeption routine in main.py 'Not found' in ex ? Date: Mon, 9 Jan 2006 11:13:41 +0000 Message-ID: <20060109111341.GA26952@leeni.uk.xensource.com> References: <20051222153948.GE18194@leeni.uk.xensource.com> <20060106095811.98D651C005@mail2-sv.soft.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20060106095811.98D651C005@mail2-sv.soft.fujitsu.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Yoshinori Katase Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org On Fri, Jan 06, 2006 at 06:58:59PM +0900, Yoshinori Katase wrote: > Hi, Ewan. > I investigated at your suggestion. > > When un-existant domain name(id)s is given xm, > exeption routine in main.py is carried 'Not found' in ex. > > 932: except xen.xend.XendError.XendError, ex: > 933: if len(args) > 0: > 934: handle_xend_error(argv[1], args, ex) > > But in xend.trace, XendEroor shows error DomID. > > | 43 if not dom: > | 44 raise XendError('No such domain ' + str(x)) > | |> XendError.py:__init__ > | | 21 self.value = value > | |< XendError.py:__init__ > | ! Exception: > Traceback (most recent call last): > File "/usr/lib/python/xen/xend/server/SrvDomainDir.py", line 44, in domain > raise XendError('No such domain ' + str(x)) > XendError: No such domain 100 > | ! Exception: > Traceback (most recent call last): > File "/usr/lib/python/xen/xend/server/SrvDomainDir.py", line 52, in get > return self.domain(x) > File "/usr/lib/python/xen/xend/server/SrvDomainDir.py", line 44, in domain > raise XendError('No such domain ' + str(x)) > XendError: No such domain 100 > | |> XendError.py:__str__ > | | 24 return self.value > | |< XendError.py:__str__ > > Who changes xend's error massage ? Deep in the depths of Xend's communication support (just past the adulterers and fornicators, but before you reach the gluttonous and the slothful) you will find xen.web.SrvDir.getChild. This catches XendError and uses noChild and then xen.web.resource.ErrorPage to convert the exception to an HTTP response. This response includes the exception message as the page message. The HTTP response code "404 Not Found" is set by SrvDir.noChild. In the client, in xen.xend.XendProtocol.{xendRequest,handleStatus,handleException} the XendError exception is recreated, but this time using the HTTP reason phrase rather than the exception message. So you get "Not found" from the "404 Not Found", and you've lost the domain ID. Almost any arrangement would be better than this one. Please feel that you have free rein to alter things here (assuming that it still works when you are done ;-) Thank you, Ewan.