aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authoremellor@ewan <emellor@ewan>2005-10-05 00:11:30 +0100
committeremellor@ewan <emellor@ewan>2005-10-05 00:11:30 +0100
commitacbce460773919d8a2eef2b688be64865e304807 (patch)
tree960866dcbdddab8bba3327f2007fe0f5d82dafa2 /tools
parent240eceae66fc162e7cca908e984ac3074b6a62ab (diff)
downloadxen-acbce460773919d8a2eef2b688be64865e304807.tar.gz
xen-acbce460773919d8a2eef2b688be64865e304807.tar.bz2
xen-acbce460773919d8a2eef2b688be64865e304807.zip
imported patch /home/emellor/block_detach.patch
Diffstat (limited to 'tools')
-rw-r--r--tools/python/xen/xend/server/DevController.py6
-rw-r--r--tools/python/xen/xm/main.py10
2 files changed, 14 insertions, 2 deletions
diff --git a/tools/python/xen/xend/server/DevController.py b/tools/python/xen/xend/server/DevController.py
index 7992adc143..47b850fc61 100644
--- a/tools/python/xen/xend/server/DevController.py
+++ b/tools/python/xen/xend/server/DevController.py
@@ -78,8 +78,12 @@ class DevController:
backpath = xstransact.Read(frontpath, "backend")
xstransact.Remove(frontpath)
- xstransact.Remove(backpath)
+ if backpath:
+ xstransact.Remove(backpath)
+ else:
+ raise VmError("Device not connected")
+
def configurations(self):
return map(lambda x: self.configuration(int(x)),
diff --git a/tools/python/xen/xm/main.py b/tools/python/xen/xm/main.py
index b7fa555eb2..1ce9985a1c 100644
--- a/tools/python/xen/xm/main.py
+++ b/tools/python/xen/xm/main.py
@@ -166,6 +166,9 @@ def handle_xend_error(cmd, dom, ex):
if error == "Not found" and dom != None:
err("Domain '%s' not found when running 'xm %s'" % (dom, cmd))
sys.exit(1)
+ elif error == "Exception: Device not connected":
+ err("Device not connected")
+ sys.exit(1)
else:
raise ex
@@ -532,7 +535,12 @@ def xm_block_detach(args):
arg_check(args,2,"block-detach")
dom = args[0]
- dev = args[1]
+
+ try:
+ dev = int(args[1])
+ except ValueError, e:
+ err("Invalid device id: %s" % args[1])
+ sys.exit(1)
from xen.xend.XendClient import server
server.xend_domain_device_destroy(dom, 'vbd', dev)