ia64/xen-unstable

changeset 7214:33cd9a7a903b

imported patch /home/emellor/block_detach.patch
author emellor@ewan
date Wed Oct 05 00:11:30 2005 +0100 (2005-10-05)
parents 22449386d38d
children c60036fe7418
files tools/python/xen/xend/server/DevController.py tools/python/xen/xm/main.py
line diff
     1.1 --- a/tools/python/xen/xend/server/DevController.py	Wed Oct 05 00:00:42 2005 +0100
     1.2 +++ b/tools/python/xen/xend/server/DevController.py	Wed Oct 05 00:11:30 2005 +0100
     1.3 @@ -78,8 +78,12 @@ class DevController:
     1.4          backpath = xstransact.Read(frontpath, "backend")
     1.5  
     1.6          xstransact.Remove(frontpath)
     1.7 -        xstransact.Remove(backpath)
     1.8  
     1.9 +        if backpath:
    1.10 +            xstransact.Remove(backpath)
    1.11 +        else:
    1.12 +            raise VmError("Device not connected")
    1.13 +           
    1.14  
    1.15      def configurations(self):
    1.16          return map(lambda x: self.configuration(int(x)),
     2.1 --- a/tools/python/xen/xm/main.py	Wed Oct 05 00:00:42 2005 +0100
     2.2 +++ b/tools/python/xen/xm/main.py	Wed Oct 05 00:11:30 2005 +0100
     2.3 @@ -166,6 +166,9 @@ def handle_xend_error(cmd, dom, ex):
     2.4      if error == "Not found" and dom != None:
     2.5          err("Domain '%s' not found when running 'xm %s'" % (dom, cmd))
     2.6          sys.exit(1)
     2.7 +    elif error == "Exception: Device not connected":
     2.8 +        err("Device not connected")
     2.9 +        sys.exit(1)
    2.10      else:
    2.11          raise ex
    2.12      
    2.13 @@ -532,7 +535,12 @@ def xm_block_detach(args):
    2.14      arg_check(args,2,"block-detach")
    2.15  
    2.16      dom = args[0]
    2.17 -    dev = args[1]
    2.18 +
    2.19 +    try:
    2.20 +        dev = int(args[1])
    2.21 +    except ValueError, e:
    2.22 +        err("Invalid device id: %s" % args[1])
    2.23 +        sys.exit(1)
    2.24  
    2.25      from xen.xend.XendClient import server
    2.26      server.xend_domain_device_destroy(dom, 'vbd', dev)