use OSError instead of IOError and small fix for sr devices
authorghost <andreas.monzner@multimedia-labs.de>
Mon, 19 Jan 2009 10:12:54 +0000 (11:12 +0100)
committerghost <andreas.monzner@multimedia-labs.de>
Mon, 19 Jan 2009 10:12:54 +0000 (11:12 +0100)
lib/python/Components/Harddisk.py

index 8e30a51..d739e98 100644 (file)
@@ -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