WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] Re: [Xen-changelog] Added exception handler for Protocol

To: Anthony Liguori <aliguori@xxxxxxxxxx>
Subject: Re: [Xen-devel] Re: [Xen-changelog] Added exception handler for ProtocolError.
From: Ewan Mellor <ewan@xxxxxxxxxxxxx>
Date: Thu, 23 Mar 2006 16:47:03 +0000
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx, xen-changelog@xxxxxxxxxxxxxxxxxxx
Delivery-date: Thu, 23 Mar 2006 16:48:26 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4422CBCA.5080204@xxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <E1FMQAe-0001Fm-0M@xxxxxxxxxxxxxxxxxxxxx> <4422CBCA.5080204@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.9i
On Thu, Mar 23, 2006 at 10:24:42AM -0600, Anthony Liguori wrote:

> Xen patchbot -unstable wrote:
> ># HG changeset patch
> ># User emellor@xxxxxxxxxxxxxxxxxxxxxx
> ># Node ID c1bb4eb565296bdb00aed84fcc877befbcebd8e9
> ># Parent  b55ca95fdc846a5db9f30ba1c5d065fe898f88e7
> >Added exception handler for ProtocolError.
> >
> >Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>
> >
> >diff -r b55ca95fdc84 -r c1bb4eb56529 tools/python/xen/xm/main.py
> >--- a/tools/python/xen/xm/main.py    Thu Mar 23 10:55:56 2006
> >+++ b/tools/python/xen/xm/main.py    Thu Mar 23 10:58:19 2006
> >@@ -1102,6 +1102,12 @@
> >             else:
> >                 err("Error connecting to xend: %s." % ex[1])
> >             sys.exit(1)
> >+        except xmlrpclib.ProtocolError, ex:
> >+            if os.geteuid() != 0:
> >+                err("Most commands need root access.  Please try again as 
> >root.")
> >+            else:
> >+                err("Error connecting to xend: %s." % ex.errmsg)
> >+            sys.exit(1)
> >         except SystemExit:
> >             sys.exit(1)
> >         except xmlrpclib.Fault, ex:
> >  
> 
> Hi Ewan,
> 
> ProtocolError's shouldn't happen.  The case where os.geteuid() != 0 is a 
> possibility (although I thought we had a check earlier for that?).  
> However, if we are getting them for another reason, something's wrong.

I wasn't sure whether you'd get a ProtocolError or an IOError if you tried to
connect to the socket as non-root, so I just threw the geteuid test in -- if
we can confirm that it's not needed (i.e. you are guaranteed to get an
IOError) then we can do without that.

The ProtocolErrors in general were being thrown whenever an exception made it
all the way back to the top of a function registered with the server (i.e. any
of our message handlers).  These exceptions would get translated to a 500
Internal Server Error which would appear at the client as a ProtocolError.  I
don't know whether it is any exception that causes this, or only ones that
inherit from StandardError or something like that.  One particular trigger was
XMLRPCServer.dispatch, which wasn't checking the return value from lookup.
This caused it to try and call None as a function whenever the user specified
a domain that did not exist.

Ewan.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>