Skip to contentSkip to conversation

Fix for xm block-detach, blktap devices

PATCH New Andres Lagar Cavilla 1 participant 1 message Sep 5, 2006

lore
Share & tools
lore
#0 lore raw

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'.

tools/python/xen/xend/XendDomainInfo.py +9 -0
diff -urN old/tools/python/xen/xend/XendDomainInfo.py new/tools/python/xen/xend/XendDomainInfo.py
@@ -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