[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH] xen: handle TapdiskException when add device failed
From 367b54c018885d5a72bf7d5e76b71516d0342aec Mon Sep 17 00:00:00 2001
From: Yi Li <peteryili@xxxxxxxxxxx> Date: Thu, 20 Mar 2014 21:52:05 +0800 Subject: [PATCH v3] xen: remove TapdiskException when add device using the VmError instead of TapdiskException when add device and check the args when using xm block-attach Signed-off-by: Yi Li <peteryili@xxxxxxxxxxx> --- Âtools/python/xen/xend/server/BlktapController.py | 5 +---- Âtools/python/xen/xm/main.py | 12 ++++++++++++ Â2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/tools/python/xen/xend/server/BlktapController.py b/tools/python/xen/xend/server/BlktapController.py index 60079eb..c8e5e24 100644 --- a/tools/python/xen/xend/server/BlktapController.py +++ b/tools/python/xen/xend/server/BlktapController.py @@ -198,9 +198,6 @@ class Blktap2Controller(BlktapController):  self.waitForBackend_destroy(backpath)  TapdiskController.destroy(path)  -class TapdiskException(Exception): - pass - Âclass TapdiskController(object):  '''class which encapsulates all tapdisk control operations'''  @@ -229,7 +226,7 @@ class TapdiskController(object):  stdout.close()  stderr.close()  if rc: - raise TapdiskException('%s failed (%s %s %s)' % \ + raise VmError('%s failed (%s %s %s)' % \  (args, rc, out, err))  return out  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 2014-03-20 20:13 GMT+08:00 æä <yilikernel@xxxxxxxxx>:
_______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |