[PATCH] Try to handle devices which live in a subdir of /dev properly (ie cciss)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 bootloader.py                    |    3 ++-
 iw/partition_gui.py              |    3 ---
 iw/upgrade_bootloader_gui.py     |    3 ++-
 storage/devices.py               |   10 +++++++++-
 textw/upgrade_bootloader_text.py |    3 ++-
 5 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/bootloader.py b/bootloader.py
index b9d995e..db0478c 100644
--- a/bootloader.py
+++ b/bootloader.py
@@ -28,6 +28,7 @@ import iutil
 import string
 from flags import flags
 from constants import *
+from storage.devices import devicePathToDeviceName
 
 import gettext
 _ = lambda x: gettext.ldgettext("anaconda", x)
@@ -125,7 +126,7 @@ def writeBootloader(anaconda):
         anaconda.id.bootloader.doUpgradeonly = 1
         if bootType == "GRUB":
             anaconda.id.bootloader.useGrubVal = 1
-            anaconda.id.bootloader.setDevice(theDev.split("/")[-1])
+            anaconda.id.bootloader.setDevice(devicePathToDeviceName(theDev))
         else:
             anaconda.id.bootloader.doUpgradeOnly = 0    
 
diff --git a/iw/partition_gui.py b/iw/partition_gui.py
index 24559ee..0105ef5 100644
--- a/iw/partition_gui.py
+++ b/iw/partition_gui.py
@@ -139,9 +139,6 @@ class DiskStripeSlice:
         rc = rc + "%Ld MB" % (self.partition.getSize(unit="MB"),)
         return rc
 
-    def getDeviceName(self):
-        return self.partition.getDeviceNodeName().split("/")[-1]
-
     def update(self):
         disk = self.parent.getDisk()
         (cylinders, heads, sectors) = disk.device.biosGeometry
diff --git a/iw/upgrade_bootloader_gui.py b/iw/upgrade_bootloader_gui.py
index 08f2403..055077e 100644
--- a/iw/upgrade_bootloader_gui.py
+++ b/iw/upgrade_bootloader_gui.py
@@ -24,6 +24,7 @@ from iw_gui import *
 
 import gtk
 from booty import checkbootloader
+from storage.devices import devicePathToDeviceName
 
 from constants import *
 import gettext
@@ -61,7 +62,7 @@ class UpgradeBootloaderWindow (InstallWindow):
                 self.bl.useGrubVal = 1
             else:
                 self.bl.useGrubVal = 0
-            self.bl.setDevice(self.bootDev.split("/")[-1])
+            self.bl.setDevice(devicePathToDeviceName(self.bootDev))
 
     def _newToLibata(self, rootPath):
         # NOTE: any changes here need to be done in upgrade_bootloader_text too
diff --git a/storage/devices.py b/storage/devices.py
index 32e4c23..4189eb4 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -131,6 +131,14 @@ def get_device_majors():
 device_majors = get_device_majors()
 
 
+def devicePathToDeviceName(path):
+    name = path[5:]
+    if name.startswith("mapper/")
+        name = name[7:]
+
+    return name
+
+
 class Device(object):
     """ A generic device.
 
@@ -1018,7 +1026,7 @@ class PartitionDevice(StorageDevice):
             # no need to clobber our name
         else:
             self._partedPartition = partition
-            self._name = partition.getDeviceNodeName().split("/")[-1]
+            self._name = devicePathToDeviceName(partition.getDeviceNodeName())
 
     partedPartition = property(lambda d: d._getPartedPartition(),
                                lambda d,p: d._setPartedPartition(p))
diff --git a/textw/upgrade_bootloader_text.py b/textw/upgrade_bootloader_text.py
index ab45075..27b4f52 100644
--- a/textw/upgrade_bootloader_text.py
+++ b/textw/upgrade_bootloader_text.py
@@ -24,6 +24,7 @@ from constants_text import *
 from flags import flags
 import string
 from booty import checkbootloader
+from storage.devices import devicePathToDeviceName
 
 from constants import *
 import gettext
@@ -173,7 +174,7 @@ class UpgradeBootloaderWindow:
                     self.bl.useGrubVal = 1
                 else:
                     self.bl.useGrubVal = 0
-                self.bl.setDevice(self.bootDev.split("/")[-1])
+                self.bl.setDevice(devicePathToDeviceName(self.bootDev))
 
 
 
-- 
1.6.2

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux