summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2009-04-03 16:05:02 +0200
committerHans de Goede <hdegoede@redhat.com>2009-04-06 19:49:45 +0200
commitbcb3ff60c76d94c57b7523e739724854b68b7711 (patch)
tree23b98ec8180d4149cbcde9afba902e2aae12ec9b
parent5b52455b64f73d05e338479d16b761792b4dfd9a (diff)
downloadanaconda-bcb3ff60c76d94c57b7523e739724854b68b7711.tar.gz
anaconda-bcb3ff60c76d94c57b7523e739724854b68b7711.tar.xz
anaconda-bcb3ff60c76d94c57b7523e739724854b68b7711.zip
Try to handle devices which live in a subdir of /dev properly
This hopefully fixes cciss (will test once an anaconda with this in has hit rawhide, so I can use rhts to test). This is the second version of this patch, this time it also does the / -> ! translation for sysfs names.
-rw-r--r--bootloader.py3
-rw-r--r--iw/partition_gui.py3
-rw-r--r--iw/upgrade_bootloader_gui.py3
-rw-r--r--storage/__init__.py13
-rw-r--r--storage/devices.py17
-rw-r--r--textw/upgrade_bootloader_text.py3
6 files changed, 24 insertions, 18 deletions
diff --git a/bootloader.py b/bootloader.py
index b9d995e4d..53dba2b74 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 devicePathToName
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(devicePathToName(theDev))
else:
anaconda.id.bootloader.doUpgradeOnly = 0
diff --git a/iw/partition_gui.py b/iw/partition_gui.py
index 24559ee59..0105ef596 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 08f2403df..f35ce0a98 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 devicePathToName
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(devicePathToName(self.bootDev))
def _newToLibata(self, rootPath):
# NOTE: any changes here need to be done in upgrade_bootloader_text too
diff --git a/storage/__init__.py b/storage/__init__.py
index 3d3ba1552..7a9f93bc6 100644
--- a/storage/__init__.py
+++ b/storage/__init__.py
@@ -81,16 +81,9 @@ def storageInitialize(anaconda):
elif devspec.startswith("UUID=") and udev_device_get_uuid(entry) == devspec[5:]:
storage.protectedPartitions = [udev_device_get_name(entry)]
break
- else:
- if devspec.startswith("/dev/"):
- dev = devspec[5:]
- else:
- dev = devspec
-
- name = udev_device_get_name(entry)
- if name == dev:
- storage.protectedPartitions = [name]
- break
+ elif udev_device_get_name(entry) == devicePathToName(devspec):
+ storage.protectedPartitions = [udev_device_get_name(entry)]
+ break
storage.reset()
diff --git a/storage/devices.py b/storage/devices.py
index 9d3b84af0..91462947d 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -131,6 +131,18 @@ def get_device_majors():
device_majors = get_device_majors()
+def devicePathToName(devicePath):
+ if devicePath.startswith("/dev/"):
+ name = devicePath[5:]
+ else:
+ name = devicePath
+
+ if name.startswith("mapper/"):
+ name = name[7:]
+
+ return name
+
+
class Device(object):
""" A generic device.
@@ -461,7 +473,8 @@ class StorageDevice(Device):
def updateSysfsPath(self):
""" Update this device's sysfs path. """
log_method_call(self, self.name, status=self.status)
- path = os.path.join("/sys", self.sysfsBlockDir, self.name)
+ sysfsName = self.name.replace("/", "!")
+ path = os.path.join("/sys", self.sysfsBlockDir, sysfsName)
self.sysfsPath = os.path.realpath(path)[4:]
log.debug("%s sysfsPath set to %s" % (self.name, self.sysfsPath))
@@ -1027,7 +1040,7 @@ class PartitionDevice(StorageDevice):
# no need to clobber our name
else:
self._partedPartition = partition
- self._name = partition.getDeviceNodeName().split("/")[-1]
+ self._name = devicePathToName(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 ab45075f8..20afec62a 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 devicePathToName
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(devicePathToName(self.bootDev))