From 0621e74942fa09f300e8b63d5e586db4575ba180 Mon Sep 17 00:00:00 2001 From: ghost Date: Mon, 19 Jan 2009 11:12:54 +0100 Subject: use OSError instead of IOError and small fix for sr devices --- lib/python/Components/Harddisk.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'lib/python/Components') diff --git a/lib/python/Components/Harddisk.py b/lib/python/Components/Harddisk.py index 8e30a512..d739e984 100644 --- a/lib/python/Components/Harddisk.py +++ b/lib/python/Components/Harddisk.py @@ -351,12 +351,15 @@ class HarddiskManager: def addHotplugPartition(self, device, physdev = None): if not physdev: dev, part = self.splitDeviceName(device) - physdev = dev try: - import os - physdev = os.readlink("/sys/block/" + dev + "/device")[6:] - except IOError: - print "couldn't determine blockdev physdev for device", dev + physdev = readlink("/sys/block/" + dev + "/device")[6:] + except OSError: + print "couldn't determine blockdev physdev for device", dev, "try", device, "now" + try: + physdev = readlink("/sys/block/" + device + "/device")[6:] + except OSError: + physdev = dev + print "couldn't determine blockdev physdev for device", device # device is the device name, without /dev # physdev is the physical device path, which we (might) use to determine the userfriendly name -- cgit v1.2.3