Fix for xm block-detach, blktap devices
PATCH 1/1 Fix for xm block-detach, blktap devices
Hi,
a new take on a solution for the problem described in the subject line.
The idea is to have destroyDevice in XendDomainInfo scan the frontend devices for the domain to see which one matches the provided devid string. Because 'tap' and 'vbd' block devices are all under the same 'vbd' hierarchy in the frontend, this works when xm block-detach calls this function with deviceClass='vbd'.
Signed-off-by Andres Lagar-Cavilla <[email protected]>
tools/python/xen/xend/XendDomainInfo.py +9 -0
@@ -1087,6 +1087,15 @@ ## public: def destroyDevice(self, deviceClass, devid): + if type(devid) is str: + devicePath = '%s/device/%s' % (self.dompath, deviceClass) + for entry in xstransact.List(devicePath): + backend = xstransact.Read('%s/%s' % (devicePath, entry), "backend") + devName = xstransact.Read(backend, "dev") + if devName == devid: + # We found the integer matching our devid, use it instead + devid = entry + break return self.getDeviceController(deviceClass).destroyDevice(devid)
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel