Fix handling of devid_end when devid is an integer, but not present as a device.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
This commit is contained in:
emellor@leeni.uk.xensource.com committed 2005-11-25 17:05:45 +00:00
1 parent 837853a460
commit b7a3863d9a
1 file changed
+3 -2
+3 -2
View File
@@ -93,10 +93,11 @@ class BlkifController(DevController):
try:
DevController.destroyDevice(self, int(devid))
except ValueError:
devid_end = devid.split('/')[-1]
devid_end = type(devid) is str and devid.split('/')[-1] or None
for i in self.deviceIDs():
d = self.readBackend(i, 'dev')
if d == devid or d == devid_end:
if d == devid or (devid_end and d == devid_end):
DevController.destroyDevice(self, i)
return
raise VmError("Device %s not connected" % devid)
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.