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

Re: [Xen-devel] [PATCH] xen: handle TapdiskException when add device failed



CC Xen-devel...

On Thu, Mar 20, 2014 at 12:25:06PM +0000, Wei Liu wrote:
> You forgot to CC xen-devel. And plese don't top-post...
> 
> On Thu, Mar 20, 2014 at 07:58:13PM +0800, æä wrote:
> > >From 2098e71261cf6a8b65524033f321d80a4f70c29d Mon Sep 17 00:00:00 2001
> > From: Yi Li <peteryili@xxxxxxxxxxx>
> > Date: Thu, 20 Mar 2014 19:55:10 +0800
> > Subject: [PATCH] xen: handle TapdiskException when add device failed
> > 
> > handle the TapdiskException when add device
> > and check the args when using xm block-attach
> > Signed-off-by: Yi Li <peteryili@xxxxxxxxxxx>
> > ---
> >  tools/python/xen/xend/XendDomainInfo.py |    4 ++--
> >  tools/python/xen/xm/main.py             |   12 ++++++++++++
> >  2 files changed, 14 insertions(+), 2 deletions(-)
> > 
> > diff --git a/tools/python/xen/xend/XendDomainInfo.py
> > b/tools/python/xen/xend/XendDomainInfo.py
> > index 8d4ff5c..2270ab1 100644
> > --- a/tools/python/xen/xend/XendDomainInfo.py
> > +++ b/tools/python/xen/xend/XendDomainInfo.py
> > @@ -65,7 +65,7 @@ from xen.xend.XendConstants import *
> >  from xen.xend.XendAPIConstants import *
> >  from xen.xend.XendCPUPool import XendCPUPool
> >  from xen.xend.server.DevConstants import xenbusState
> > -from xen.xend.server.BlktapController import TapdiskController
> > +from xen.xend.server.BlktapController import TapdiskController,
> > TapdiskException
> > 
> 
> This line is still damaged. You need to tweak your email client
> (presumably gmail) to stop doing that. Or teach git send-email to use
> your SMTP directly instead of copy-and-paste.
> 
> >  from xen.xend.XendVMMetrics import XendVMMetrics
> > 
> > @@ -861,7 +861,7 @@ class XendDomainInfo:
> >                      # blktap1
> >                      dev_type = self.getBlockDeviceClass(devid)
> >                  self._waitForDevice(dev_type, devid)
> > -            except VmError, ex:
> > +            except (VmError, TapdiskException), ex:
> 
> (Not claiming to be a Xend expert, but from a maintainability point of
> view.)
> 
> I don't understand why you can catch a TapdiskException at this point.
> Shouldn't it be caught during VM creation and represented as VmError?
> 
> >From the look of various callsite of "raise VmError", it does show that
> when you fail to create a device, VmError is raised. And the exception
> handling code suggests that as well.
> 
> >                  del self.info['devices'][dev_uuid]
> >                  if dev_type == 'pci':
> >                      for dev in dev_config_dict['devs']:
> > diff --git a/tools/python/xen/xm/main.py b/tools/python/xen/xm/main.py
> > index 5ed781c..ce5d9a2 100644
> > --- a/tools/python/xen/xm/main.py
> > +++ b/tools/python/xen/xm/main.py
> > @@ -2650,6 +2650,18 @@ def parse_block_configuration(args):
> >  def xm_block_attach(args):
> >      arg_check(args, 'block-attach', 4, 5)
> > 
> > +    uname = args[1]
> > +    uname_list = uname.split(":")
> > +    back_dev = uname_list[len(uname_list)-1]
> > +    front_dev = args[2]
> > +    if not os.path.exists(back_dev):
> > +        print "Error: %s not exist " % back_dev
> > +        sys.exit(1)
> > +
> > +    if os.path.exists(front_dev):
> > +        print "Error: %s already exists " % front_dev
> > +        sys.exit(1)
> > +
> >      if serverType == SERVER_XEN_API:
> >          dom   = args[0]
> >          uname = args[1]
> > -- 
> > 1.7.1
> > 
> 
> You can strip the rest if you're sending a new patch.
> 
> Wei.
> 
> > 2014-03-20 19:38 GMT+08:00, Wei Liu <wei.liu2@xxxxxxxxxx>:
> > > On Thu, Mar 20, 2014 at 06:36:54PM +0800, æä wrote:
> > >> >From 79220a11ce64324228ba0390790773b41bf5f156 Mon Sep 17 00:00:00 2001
> > >> From: Yi Li <peteryili@xxxxxxxxxxx>
> > >> Date: Thu, 20 Mar 2014 18:25:03 +0800
> > >> Subject: [PATCH] xen: handle TapdiskException when add device failed
> > >>

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

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