xend: Fix device release for tap devices

I saw an error message when I shut down a domain.  The error
message showed that release of device(vbd/51712) failed.  But the
device was tap, was not vbd.  I think that a cause of the error message is
because _releaseDevices() calls destroyDevice() by wrong device class.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
This commit is contained in:
Keir Fraser committed 2008-11-28 13:05:58 +00:00
1 parent 2fdd853ff5
commit c4e83a1484
1 file changed
+10 -2
+10 -2
View File
@@ -1990,13 +1990,21 @@ class XendDomainInfo:
for devclass in XendDevices.valid_devices():
for dev in t.list(devclass):
try:
true_devclass = devclass
if devclass == 'vbd':
# In the case of "vbd", the true device class
# may possibly be "tap". Just in case, verify
# device class.
devid = dev.split('/')[-1]
true_devclass = self.getBlockDeviceClass(devid)
log.debug("Removing %s", dev);
self.destroyDevice(devclass, dev, False);
self.destroyDevice(true_devclass, dev, False);
except:
# Log and swallow any exceptions in removal --
# there's nothing more we can do.
log.exception("Device release failed: %s; %s; %s",
self.info['name_label'], devclass, dev)
self.info['name_label'],
true_devclass, dev)
finally:
t.abort()
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.