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: ian.jackson@xxxxxxxxxxxxx
Subject: Re: [Xen-devel] [PATCH 3 of 3] remus: handle exceptions while installing/unstalling net buffer
From: Shriram Rajagopalan <rshriram@xxxxxxxxx>
Date: Thu, 23 Jun 2011 11:32:06 -0400
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Thu, 23 Jun 2011 08:33:56 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <9eed27800ff6a2e6d73f.1308749859@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.1308749856@xxxxxxxxxxxxxxxxxxx> <9eed27800ff6a2e6d73f.1308749859@xxxxxxxxxxxxxxxxxxx>
Reply-to: rshriram@xxxxxxxxx
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Wed, Jun 22, 2011 at 9:37 AM, Shriram Rajagopalan <rshriram@xxxxxxxxx> wrote:
# HG changeset patch
# User Shriram Rajagopalan <rshriram@xxxxxxxxx>
# Date 1308749695 25200
# Node ID 9eed27800ff6a2e6d73f138f20af072c1b41925e
# Parent  794ead1a2be0578d70c38f006e7ab61c7abe9203
remus: handle exceptions while installing/unstalling net buffer

Signed-off-by: Shriram Rajagopalan <rshriram@xxxxxxxxx>

diff -r 794ead1a2be0 -r 9eed27800ff6 tools/python/xen/remus/device.py
--- a/tools/python/xen/remus/device.py  Tue Jun 21 12:11:44 2011 -0700
+++ b/tools/python/xen/remus/device.py  Wed Jun 22 06:34:55 2011 -0700
@@ -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 794ead1a2be0 -r 9eed27800ff6 tools/python/xen/remus/util.py
--- a/tools/python/xen/remus/util.py    Tue Jun 21 12:11:44 2011 -0700
+++ b/tools/python/xen/remus/util.py    Wed Jun 22 06:34:55 2011 -0700
@@ -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-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

As Brendan pointed out, 90% of what I proposed to remove
in patches 1 & 2 of this series might be useful for folks who want to hack on Remus
or live migration code. I ll do the clean up later, more carefully.

Ian, if you have no objection to this patch, could you take in this one alone and
reject patches 1 & 2? Or do you want me to send this one separately again?

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