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

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



From 5cc4dc68d29b01cc08761813af0c2eb6831f0260 Mon Sep 17 00:00:00 2001
From: Yi Li <peteryili@xxxxxxxxxxx>
Date: Thu, 20 Mar 2014 20:58:55 +0800
Subject: [PATCH] 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
_______________________________________________
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®.