# HG changeset patch
# User Signed-off-by: Shriram Rajagopalan <rshriram@xxxxxxxxx>
# Date 1314721399 -3600
# Node ID e5dd58f9bee1d7c96f3595c2548ae96366154421
# Parent 88ac7613a4f9233661792e36878d197b00f24f75
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>
xen-unstable changeset: 23600:15fc211a13bf
Backport-requested-by: Shriram Rajagopalan <rshriram@xxxxxxxxx>
Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
diff -r 88ac7613a4f9 -r e5dd58f9bee1 tools/python/xen/remus/device.py
--- a/tools/python/xen/remus/device.py Tue Aug 30 17:23:16 2011 +0100
+++ b/tools/python/xen/remus/device.py Tue Aug 30 17:23:19 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 88ac7613a4f9 -r e5dd58f9bee1 tools/python/xen/remus/util.py
--- a/tools/python/xen/remus/util.py Tue Aug 30 17:23:16 2011 +0100
+++ b/tools/python/xen/remus/util.py Tue Aug 30 17:23:19 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
|