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

Re: [Xen-devel] [PATCH] xen: handle TapdiskException when xm block-attach failed


[How to preduce]

On dom0: (b.vhd is exist,but a.vhd is not exist)

1: xm block-attach 0 tap2:tapdisk:vhd:/root/a.vhd /dev/xvdz w

Error: ('create', '-avhd:/root/a.vhd') failed (512Â )
Usage: xm block-attach <Domain> <BackDev> <FrontDev> <Mode> [BackDomain]
Create a new virtual block device.

2: xm block-attach 0 tap2:tapdisk:vhd:/root/b.vhd /dev/xvdz w

it will report that
Error: The device "/dev/xvdz" is already defined
Usage: xm block-attach <Domain> <BackDev> <FrontDev> <Mode> [BackDomain]

Create a new virtual block device.

[Expected Result]

the step 2 should be success.


2014-03-20 9:25 GMT+08:00 æä <yilikernel@xxxxxxxxx>:
From 7a4b67d235569d81307095ad1366bc03bae5b812 Mon Sep 17 00:00:00 2001
From: Yi Li <peteryili@xxxxxxxxxxx>
Date: Thu, 20 Mar 2014 09:15:45 +0800
Subject: [PATCH] xen: handle TapdiskException when xm block-attach failed

Maybe we should handle the TapdiskException for the command below
'xm block-attach 0 tap2:tapdisk:vhd:/root/a.vhd /dev/xvdz w'
or /dev/xvdz said it is already defined.

Signed-off-by: Yi Li <peteryili@xxxxxxxxxxx>
Âtools/python/xen/xend/XendDomainInfo.py |ÂÂÂ 4 ++--
Â1 files changed, 2 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

Âfrom xen.xend.XendVMMetrics import XendVMMetrics

@@ -861,7 +861,7 @@ class XendDomainInfo:
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ dev_type = self.getBlockDeviceClass(devid)
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ self._waitForDevice(dev_type, devid)
-ÂÂÂÂÂÂÂÂÂÂÂ except VmError, ex:
+ÂÂÂÂÂÂÂÂÂÂÂ except (VmError, TapdiskException), ex:
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ del self.info['devices'][dev_uuid]
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ if dev_type == 'pci':
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ for dev in dev_config_dict['devs']:

Xen-devel mailing list



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