summaryrefslogtreecommitdiffstats
path: root/platform.py
diff options
context:
space:
mode:
authorChris Lumens <clumens@redhat.com>2009-03-17 16:17:22 -0400
committerChris Lumens <clumens@redhat.com>2009-03-17 16:55:20 -0400
commit4b0c72ccf680499df5b91723df5645b5e4275104 (patch)
tree78daf8380d4c922c8b80c3d16c5e1b40a18960e0 /platform.py
parent7f0e17e3b750afb9b74fc48a6e6f786cc0005288 (diff)
downloadanaconda-4b0c72ccf680499df5b91723df5645b5e4275104.tar.gz
anaconda-4b0c72ccf680499df5b91723df5645b5e4275104.tar.xz
anaconda-4b0c72ccf680499df5b91723df5645b5e4275104.zip
Make platform.checkBootRequest work better and not use diskset anymore.
Diffstat (limited to 'platform.py')
-rw-r--r--platform.py61
1 files changed, 18 insertions, 43 deletions
diff --git a/platform.py b/platform.py
index 6ce5c7746..71db883a8 100644
--- a/platform.py
+++ b/platform.py
@@ -97,7 +97,7 @@ class Platform(object):
def bootloaderPackage(self):
return self._bootloaderPackage
- def checkBootRequest(self, req, diskset):
+ def checkBootRequest(self, req):
"""Perform an architecture-specific check on the boot device. Not all
platforms may need to do any checks. Raises an exception if there
is a problem, or returns True otherwise."""
@@ -144,25 +144,13 @@ class EFI(Platform):
ret["boot"] = (bootDev.name, N_("EFI System Partition"))
return ret
- def checkBootRequest(self, req, diskset):
- if not req.device or not hasattr(req, "drive"):
- return
-
- bootPart = None
- for drive in req.drive:
- bootPart = diskset.disks[drive].getPartitionByPath("/dev/%s" % req.device)
- if bootPart:
- break
-
- if not bootPart:
- return
-
- if req.mountpoint == "/boot":
- if not bootPart.fileSystem.type.startswith("ext"):
+ def checkBootRequest(self, req):
+ if req.format.mountpoint == "/boot":
+ if not req.format.type.startswith("ext"):
raise FSError("/boot is not ext2")
- elif req.mountpoint == "/boot/efi":
- if not bootPart.fileSystem.type.startswith("fat"):
- raise FSError("/boot/efi is not vfat")
+ elif req.format.mountpoint == "/boot/efi":
+ if not req.format.type.endswith("fat"):
+ raise FSError("/boot/efi is not vfat")
def setDefaultPartitioning(self):
ret = Platform.setDefaultPartitioning(self)
@@ -178,20 +166,12 @@ class EFI(Platform):
class Alpha(Platform):
_diskType = parted.diskType["bsd"]
- def checkBootRequest(self, req, diskset):
- if not req.device or not hasattr(req, "drive"):
- return
-
- bootPart = None
- for drive in req.drive:
- bootPart = diskset.disks[drive].getPartitionByPath("/dev/%s" % req.device)
- if bootPart:
- break
-
- if not bootPart:
- return
+ def checkBootRequest(self, req):
+ disk = req.disk
+ if not disk:
+ raise DeviceError("Boot partition has no disk")
- disk = bootPart.disk
+ disk = disk.partedDisk
# Check that we're a BSD disk label
if not disk.type == self.diskType:
@@ -253,18 +233,13 @@ class IPSeriesPPC(PPC):
return ret
- def checkBootRequest(self, req, diskset):
- if not req.device or not hasattr(req, "drive"):
- return
-
- bootPart = None
- for drive in req.drive:
- bootPart = diskset.disks[drive].getPartitionByPath("/dev/%s" % req.device)
- if bootPart and (bootPart.geometry.end * bootPart.geometry.device.sectorSize /
- (1024.0 * 1024)) > 4096:
- raise DeviceError("Boot partition is located too high")
+ def checkBootRequest(self, req):
+ bootPart = getattr(req, "partedPartition", None)
+ if not bootPart:
+ raise DeviceError("Boot partition has no partedPartition")
- return
+ if bootPart.geometry.end * bootPart.geometry.device.sectorSize / (1024.0 * 1024) > 4096:
+ raise DeviceError("Boot partition is located too high")
def setDefaultPartitioning(self):
ret = PPC.setDefaultPartitioning(self)