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] [PATCH 3 of 3] remus: handle exceptions while installing

To: Shriram Rajagopalan <rshriram@xxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH 3 of 3] remus: handle exceptions while installing/unstalling net buffer
From: Brendan Cully <brendan@xxxxxxxxx>
Date: Tue, 7 Jun 2011 12:27:20 -0700
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx, ian.jackson@xxxxxxxxxxxxx
Delivery-date: Tue, 07 Jun 2011 12:27:54 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <0af6803eeb9f278abd17.1307361112@xxxxxxxxxxxxxxxxxxx>
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/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <patchbomb.1307361109@xxxxxxxxxxxxxxxxxxx> <0af6803eeb9f278abd17.1307361112@xxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Bare except clauses are bad style. Please only handle the exact exceptions you 
are expecting.

Nacked-by: Brendan Cully <brendan@xxxxxxxxx>

On 2011-06-06, at 4:51 AM, Shriram Rajagopalan wrote:

> # HG changeset patch
> # User Shriram Rajagopalan <rshriram@xxxxxxxxx>
> # Date 1307360451 25200
> # Node ID 0af6803eeb9f278abd1739cb54ceb0fc2ed14470
> # Parent  dc243b6893366c453834734e0b4b17a3f233daa2
> remus: handle exceptions while installing/unstalling net buffer
> 
> Signed-off-by: Shriram Rajagopalan <rshriram@xxxxxxxxx>
> 
> diff -r dc243b689336 -r 0af6803eeb9f tools/python/xen/remus/device.py
> --- a/tools/python/xen/remus/device.py        Mon Jun 06 04:40:42 2011 -0700
> +++ b/tools/python/xen/remus/device.py        Mon Jun 06 04:40:51 2011 -0700
> @@ -169,15 +169,21 @@
>         self.vif = vif
>         # voodoo from 
> http://www.linuxfoundation.org/collaborate/workgroups/networking/ifb#Typical_Usage
>         util.runcmd('ip link set %s up' % self.devname)
> -        util.runcmd('tc qdisc add dev %s ingress' % vif.dev)
> +        try:
> +            util.runcmd('tc qdisc add dev %s ingress' % vif.dev)
> +        except: #RTNETLINK file exists error
> +            ##since we already track ifbs via the /var/run/remus/ifb file,
> +            ## RTNETLINK file already exists error is not an issue.
> +            pass
>         util.runcmd('tc filter add dev %s parent ffff: proto ip pref 10 '
>                     'u32 match u32 0 0 action mirred egress redirect '
>                     'dev %s' % (vif.dev, self.devname))
> 
>     def uninstall(self):
> -        util.runcmd('tc filter del dev %s parent ffff: proto ip pref 10 u32' 
> \
> -                        % self.vif.dev)
> -        util.runcmd('tc qdisc del dev %s ingress' % self.vif.dev)
> +        try:
> +            util.runcmd('tc qdisc del dev %s ingress' % self.vif.dev)
> +        except:
> +            pass
>         util.runcmd('ip link set %s down' % self.devname)
> 
> class IMQBuffer(Netbuf):
> @@ -373,9 +379,14 @@
> 
>     def uninstall(self):
>         if self.installed:
> -            req = qdisc.delrequest(self.bufdevno, self.handle)
> -            self.rth.talk(req.pack())
> -            self.installed = False
> -
> -        self.bufdev.uninstall()
> +            try:
> +                req = qdisc.delrequest(self.bufdevno, self.handle)
> +                self.rth.talk(req.pack())
> +                self.installed = False
> +            except:
> +                pass
> +        try:    
> +            self.bufdev.uninstall()
> +        except:
> +            pass
>         self.pool.put(self.bufdev)
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel
> 


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