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 8e30a5124e1d4035192c1c4d3429ce81bdecccbe..d739e9842df052a79738d2c4a96a08dffc76a2d8 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