[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] remus: handle exceptions while installing/unstalling net buffer



# HG changeset patch
# User Signed-off-by: Shriram Rajagopalan <rshriram@xxxxxxxxx>
# Date 1309184318 -3600
# Node ID 15fc211a13bfa911c855ddce02f3bbe291dbc037
# Parent  d3027374a8c0d548c6ff468c4d747300e858904b
remus: handle exceptions while installing/unstalling net buffer

Signed-off-by: Shriram Rajagopalan <rshriram@xxxxxxxxx>
Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---


diff -r d3027374a8c0 -r 15fc211a13bf tools/python/xen/remus/device.py
--- a/tools/python/xen/remus/device.py  Mon Jun 27 14:48:57 2011 +0100
+++ b/tools/python/xen/remus/device.py  Mon Jun 27 15:18:38 2011 +0100
@@ -169,15 +169,25 @@
         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 util.PipeException, e:
+            # check if error indicates that ingress qdisc
+            # already exists on the vif. If so, ignore it.
+            ignoreme = 'RTNETLINK answers: File exists'
+            if ignoreme in str(e):
+                pass
+            else:
+                raise e
         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 util.PipeException, e:
+            pass
         util.runcmd('ip link set %s down' % self.devname)
 
 class IMQBuffer(Netbuf):
@@ -373,9 +383,15 @@
 
     def uninstall(self):
         if self.installed:
-            req = qdisc.delrequest(self.bufdevno, self.handle)
-            self.rth.talk(req.pack())
+            try:
+                req = qdisc.delrequest(self.bufdevno, self.handle)
+                self.rth.talk(req.pack())
+            except IOError, e:
+                pass
             self.installed = False
 
-        self.bufdev.uninstall()
-        self.pool.put(self.bufdev)
+            try:
+                self.bufdev.uninstall()
+            except util.PipeException, e:
+                pass
+            self.pool.put(self.bufdev)
diff -r d3027374a8c0 -r 15fc211a13bf tools/python/xen/remus/util.py
--- a/tools/python/xen/remus/util.py    Mon Jun 27 14:48:57 2011 +0100
+++ b/tools/python/xen/remus/util.py    Mon Jun 27 15:18:38 2011 +0100
@@ -65,8 +65,10 @@
         proc.wait()
         if proc.returncode:
             print ' '.join(args)
-            print stderr.strip()
-            raise PipeException('%s failed' % args[0], proc.returncode)
+            errmsg = stderr.strip()
+            print errmsg
+            raise PipeException('%s failed (errmsg: %s)' % (args[0], errmsg),
+                                proc.returncode)
         return stdout
     except (OSError, IOError), inst:
         raise PipeException('could not run %s' % args[0], inst.errno)

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.