diff options
author | Chris Lumens <clumens@redhat.com> | 2009-03-26 13:59:28 -0400 |
---|---|---|
committer | Chris Lumens <clumens@redhat.com> | 2009-03-30 17:27:13 -0400 |
commit | f273f08ca8f06fd23bfd02a60bdd050eecfa2833 (patch) | |
tree | 2f24d76a6e7a5a47807040dbdbc438bc90117b2b /platform.py | |
parent | 78b930d80ecddb3a8c28b077a5c96ef06a78d8e2 (diff) | |
download | anaconda-f273f08ca8f06fd23bfd02a60bdd050eecfa2833.tar.gz anaconda-f273f08ca8f06fd23bfd02a60bdd050eecfa2833.tar.xz anaconda-f273f08ca8f06fd23bfd02a60bdd050eecfa2833.zip |
Use PartSpec in the auto partition request list, and assign weights to them.
Also, add a weight method to the Platform classes and have it return an integer
for whatever fstype or mountpoint is provided.
Diffstat (limited to 'platform.py')
-rw-r--r-- | platform.py | 45 |
1 files changed, 41 insertions, 4 deletions
diff --git a/platform.py b/platform.py index 59b87273b..0ad5f4a4b 100644 --- a/platform.py +++ b/platform.py @@ -24,6 +24,8 @@ import iutil import parted import storage from storage.errors import * +from storage.formats import * +from storage.partspec import * import gettext _ = lambda x: gettext.ldgettext("anaconda", x) @@ -122,7 +124,8 @@ class Platform(object): def setDefaultPartitioning(self): """Return the default platform-specific partitioning information.""" - return [("/boot", self.bootFSType, 200, None, 0, 0)] + return [PartSpec(mountpoint="/boot", fstype=self.bootFSType, size=200, + weight=self.weight(mountpoint="/boot"))] @property def supportsMdRaidBoot(self): @@ -146,6 +149,13 @@ class Platform(object): and (not self.maxBootPartSize or size <= self.maxBootPartSize)) + def weight(self, fstype=None, mountpoint=None): + """ Given an fstype (as a string) or a mountpoint, return an integer + for the base sorting weight. This is used to modify the sort + algorithm for partition requests, mainly to make sure bootable + partitions and /boot are placed where they need to be.""" + return 0 + class EFI(Platform): _diskType = parted.diskType["gpt"] _minBootPartSize = 50 @@ -180,10 +190,19 @@ class EFI(Platform): # one on the system. if len(filter(lambda dev: dev.format.type == "efi" and self.validBootPartSize(dev.size), self.anaconda.id.storage.partitions)) == 0: - ret.append(("/boot/efi", "efi", 50, 200, 1, 0)) + ret.append(PartSpec(mountpoint="/boot/efi", fstype="efi", size=20, + maxSize=200, grow=True, weight=self.weight(fstype="efi"))) return ret + def weight(self, fstype=None, mountpoint=None): + if fstype and fstype == "efi" or mountpoint and mountpoint == "/boot/efi": + return 5000 + elif mountpoint and mountpoint == "/boot": + return 2000 + else: + return 0 + class Alpha(Platform): _diskType = parted.diskType["bsd"] @@ -267,9 +286,18 @@ class IPSeriesPPC(PPC): def setDefaultPartitioning(self): ret = PPC.setDefaultPartitioning(self) - ret.insert(0, (None, "PPC PReP Boot", 4, None, 0, 0)) + ret.append(PartSpec(fstype="PPC PReP Boot", size=4, + weight=self.weight(fstype="prepboot"))) return ret + def weight(self, fstype=None, mountpoint=None): + if fstype and fstype == "prepboot": + return 5000 + elif mountpoint and mountpoint == "/boot": + return 2000 + else: + return 0 + class NewWorldPPC(PPC): _diskType = parted.diskType["mac"] _minBootPartSize = (800.00 / 1024.00) @@ -306,9 +334,18 @@ class NewWorldPPC(PPC): def setDefaultPartitioning(self): ret = Platform.setDefaultPartitioning(self) - ret.insert(0, (None, "Apple Bootstrap", 1, 1, 0, 0)) + ret.append(PartSpec(fstype="Apple Bootstrap", size=1, maxSize=1, + weight=self.weight(fstype="appleboot"))) return ret + def weight(self, fstype=None, mountpoint=None): + if fstype and fstype == "appleboot": + return 5000 + elif mountpoint and mountpoint == "/boot": + return 2000 + else: + return 0 + class S390(Platform): _bootloaderPackage = "s390utils" |