[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH] xend: fix vbd/tapdisk device destruction
Hi Ryan, I detected problems by testing your patch. In the case of inactive domains: xm block-detach failed. # xm block-list vm2 Vdev BE handle state evt-ch ring-ref BE-path 769 -1 0 -1 -1 -1 ?? 833 -1 0 -1 -1 -1 ?? # xm block-detach vm2 833 Error: (22, 'Invalid argument') Usage: xm block-detach <Domain> <DevId> [-f|--force] Destroy a domain's virtual block device In the case of active domains: xm block-deatch succeeded. But I saw the following message in xend.log. # xm block-list vm2 Vdev BE handle state evt-ch ring-ref BE-path 769 0 0 4 10 8 /local/domain/0/backend/vbd/3/769 833 0 0 4 11 9 /local/domain/0/backend/vbd/3/833 # xm block-detach vm2 833 # xm block-list vm2 Vdev BE handle state evt-ch ring-ref BE-path 769 0 0 4 10 8 /local/domain/0/backend/vbd/3/769 [2009-06-24 12:49:00 4433] DEBUG (XendDomainInfo:1268) error reading backend for device (833): To solve all problems, I will send a patch instead of your patch. Best regards, Kan Tue, 23 Jun 2009 10:10:39 -0700, "Ryan O'Connor" wrote: >blktap2 devices attach as a regular 'vbd' rather than a 'tap' device. >Accordingly, Xend should use 'vbd' as the device class of blktap2 devices. >This >patch determines the appropriate device class by reading the 'type' field >of the >backend's xenstore entry. > >Signed-off-by: Ryan O'Connor <rjo@xxxxxxxxx> > >diff -r 3c7536d6b583 -r 3f100fc620fd tools/python/xen/xend/XendDomainInfo.py >--- a/tools/python/xen/xend/XendDomainInfo.py Tue Jun 23 17:27:01 2009 +0100 >+++ b/tools/python/xen/xend/XendDomainInfo.py Tue Jun 23 10:09:20 2009 -0700 >@@ -1244,13 +1244,33 @@ class XendDomainInfo: > dev_num += 1 > return sxprs > >- def getBlockDeviceClass(self, devid): >- # To get a device number from the devid, >- # we temporarily use the device controller of VBD. >- dev = self.getDeviceController('vbd').convertToDeviceNumber(devid) >- dev_info = self._getDeviceInfo_vbd(dev) >- if dev_info: >- return dev_info[0] >+ def getBlockDeviceClass(self, devid, deviceClass=False): >+ backendType = 'vbd' >+ >+ # For backwards compatability, we may have to get deviceClass >ourselves >+ if not deviceClass: >+ t = xstransact("%s/device" % self.dompath) >+ for devclass in XendDevices.valid_devices(): >+ if devid in t.list(devclass): >+ deviceClass = devclass >+ break >+ t.abort() >+ >+ try: >+ # Note: deviceClass may be incorrect, so we cannot trust >readBackend >+ # or readFrontend from the Device Controller to succeed >+ backendPath = xstransact.Read("%s/device/%s/%s" >+ % (self.dompath, deviceClass, >devid), >+ "backend") >+ backendType = xstransact.Read(backendPath, "type") >+ except Exception, ex: >+ # we can probably just assume the block device is a VBD >+ log.debug("error reading backend for device (%s): %s", devid, >str(ex)) >+ >+ if backendType == 'tap': >+ return 'tap' >+ else: >+ return 'vbd' > > def _getDeviceInfo_vif(self, mac): > for dev_type, dev_info in self.info.all_devices_sxpr(): >@@ -2217,7 +2237,7 @@ class XendDomainInfo: > # may possibly be "tap". Just in case, verify > # device class. > devid = dev.split('/')[-1] >- true_devclass = self.getBlockDeviceClass(devid) >+ true_devclass = self.getBlockDeviceClass(devid >, devclass) > log.debug("Removing %s", dev); > self.destroyDevice(true_devclass, dev, False); > except: > >_______________________________________________ >Xen-devel mailing list >Xen-devel@xxxxxxxxxxxxxxxxxxx >http://lists.xensource.com/xen-devel _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |