xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Shriram Rajagopalan <rshriram@cs.ubc.ca>
To: ian.jackson@eu.citrix.com
Cc: xen-devel@lists.xensource.com
Subject: Re: [PATCH 3 of 3] remus: handle exceptions while installing/unstalling net buffer
Date: Thu, 23 Jun 2011 11:32:06 -0400	[thread overview]
Message-ID: <BANLkTinnUWmrEB9KKSf724O9dm-qx1_SqQ@mail.gmail.com> (raw)
In-Reply-To: <9eed27800ff6a2e6d73f.1308749859@athos.nss.cs.ubc.ca>


[-- Attachment #1.1: Type: text/plain, Size: 3967 bytes --]

On Wed, Jun 22, 2011 at 9:37 AM, Shriram Rajagopalan <rshriram@cs.ubc.ca>wrote:

> # HG changeset patch
> # User Shriram Rajagopalan <rshriram@cs.ubc.ca>
> # Date 1308749695 25200
> # Node ID 9eed27800ff6a2e6d73f138f20af072c1b41925e
> # Parent  794ead1a2be0578d70c38f006e7ab61c7abe9203
> remus: handle exceptions while installing/unstalling net buffer
>
> Signed-off-by: Shriram Rajagopalan <rshriram@cs.ubc.ca>
>
> 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@lists.xensource.com
> 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

[-- Attachment #1.2: Type: text/html, Size: 4971 bytes --]

[-- Attachment #2: Type: text/plain, Size: 138 bytes --]

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

  reply	other threads:[~2011-06-23 15:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-22 13:37 [PATCH 0 of 3] [Resend v2] remus: cleanup python code Shriram Rajagopalan
2011-06-22 13:37 ` [PATCH 1 of 3] remus: remove dead code and unused modules Shriram Rajagopalan
2011-06-22 22:30   ` Brendan Cully
2011-06-23 13:08     ` Shriram Rajagopalan
2011-06-23 14:34       ` Brendan Cully
2011-06-22 13:37 ` [PATCH 2 of 3] remus: move makeheader from image.py to vm.py Shriram Rajagopalan
2011-06-22 22:32   ` Brendan Cully
2011-06-22 13:37 ` [PATCH 3 of 3] remus: handle exceptions while installing/unstalling net buffer Shriram Rajagopalan
2011-06-23 15:32   ` Shriram Rajagopalan [this message]
2011-06-27 14:19     ` Ian Jackson
  -- strict thread matches above, loose matches on Subject: below --
2011-06-06 11:51 [PATCH 0 of 3] remus: cleanup python code Shriram Rajagopalan
2011-06-06 11:51 ` [PATCH 3 of 3] remus: handle exceptions while installing/unstalling net buffer Shriram Rajagopalan
2011-06-07 19:27   ` Brendan Cully
2011-06-21 17:06     ` Ian Jackson
2011-06-21 18:43       ` Shriram Rajagopalan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BANLkTinnUWmrEB9KKSf724O9dm-qx1_SqQ@mail.gmail.com \
    --to=rshriram@cs.ubc.ca \
    --cc=ian.jackson@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).