Make platform.checkBootRequest work better and not use diskset anymore.
On Tue, 2009-03-17 at 16:26 -0400, Chris Lumens wrote:
> ---
> platform.py | 61 +++++++++++++++++-----------------------------------------
> 1 files changed, 18 insertions(+), 43 deletions(-)
A couple of little issues, noted below.
>
> diff --git a/platform.py b/platform.py
> index 6ce5c77..c4aea3d 100644
> --- a/platform.py
> +++ b/platform.py
> @@ -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.startswith("fat"):
> + raise FSError("/boot/efi is not vfat")
This should probably check for endswith("fat").
>
> def setDefaultPartitioning(self):
> ret = Platform.setDefaultPartitioning(self)
> @@ -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 = req.partedPartition
> + if not bootPart:
> + raise DeviceError("Boot partition has no partedPartition")
You might want to protect this against tracebacks in the case of root on
non-partition by using getattr.
>
> - 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)
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
|