[PATCH 2/3] Move platform-specific boot-related data into Platform.

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

 



Stage1 requirements like PReP, EFI, &c are not bootloader-
specific, but platform-specific. Disklabel types are also
dependant on the platform.

Move bootloader from Platform into Anaconda. Also move
bootDevice, bootLoaderDevice, bootFSTypes, and
defaultBootFSTypes from Platform into Storage. Remove
boot kwarg from storage.formats.get_default_filesystem_type
to eliminate the need for platform or anaconda instances
there.
---
 pyanaconda/__init__.py                 |    5 +-
 pyanaconda/bootloader.py               |  129 +++++++++----------------------
 pyanaconda/iw/blpasswidget.py          |    2 +-
 pyanaconda/iw/bootloader_main_gui.py   |    6 +-
 pyanaconda/iw/osbootwidget.py          |    5 +-
 pyanaconda/platform.py                 |  118 ++++++++++++++++--------------
 pyanaconda/storage/__init__.py         |   63 ++++++++++++---
 pyanaconda/storage/formats/__init__.py |   11 +--
 pyanaconda/storage/partitioning.py     |   13 ++--
 pyanaconda/yuminstall.py               |    1 +
 10 files changed, 172 insertions(+), 181 deletions(-)

diff --git a/pyanaconda/__init__.py b/pyanaconda/__init__.py
index a9cfa35..5ba37a3 100644
--- a/pyanaconda/__init__.py
+++ b/pyanaconda/__init__.py
@@ -101,7 +101,10 @@ class Anaconda(object):
 
     @property
     def bootloader(self):
-        return self.platform.bootloader
+        if not self._bootloader:
+            self._bootloader = self.platform._bootloaderClass(self.storage)
+
+        return self._bootloader
 
     @property
     def firstboot(self):
diff --git a/pyanaconda/bootloader.py b/pyanaconda/bootloader.py
index 7fc5f61..4c495d2 100644
--- a/pyanaconda/bootloader.py
+++ b/pyanaconda/bootloader.py
@@ -195,24 +195,10 @@ class BootLoader(object):
     can_update = False
     image_label_attr = "label"
 
-    disklabel_types = []
     encryption_support = False
 
-    # requirements for bootloader stage1 devices
-    stage1_device_types = []
-    stage1_raid_levels = []
-    stage1_raid_metadata = []
-    stage1_raid_member_types = []
-    stage1_format_types = []
-    stage1_mountpoints = []
-    stage1_description = N_("bootloader device")
-    stage1_max_end_mb = None
-
     stage2_is_valid_stage1 = False
 
-    # for UI use, eg: "mdarray": N_("RAID Device")
-    target_descriptions = {}
-
     # requirements for stage2 devices
     stage2_device_types = []
     stage2_raid_levels = []
@@ -224,8 +210,6 @@ class BootLoader(object):
     stage2_description = N_("/boot filesystem")
     stage2_max_end_mb = 2 * 1024 * 1024
 
-    non_linux_format_types = []
-
     # this is so stupid...
     global_preserve_args = ["speakup_synth", "apic", "noapic", "apm", "ide",
                             "noht", "acpi", "video", "pci", "nodmraid",
@@ -416,6 +400,21 @@ class BootLoader(object):
             self.chain_images.append(BootLoaderImage(device=device))
 
     #
+    # platform-specific data access
+    #
+    @property
+    def platform(self):
+        return self.storage.platform
+
+    @property
+    def disklabel_types(self):
+        return self.platform._disklabel_types
+
+    @property
+    def device_descriptions(self):
+        return self.platform._boot_descriptions
+
+    #
     # constraint checking for target devices
     #
     def _is_valid_md(self, device, device_types=None, raid_levels=None,
@@ -540,14 +539,14 @@ class BootLoader(object):
         return self._device_type_index(device, types) is not None
 
     def device_description(self, device):
-        device_types = self.target_descriptions.keys()
+        device_types = self.device_descriptions.keys()
         idx = self._device_type_index(device, device_types)
         if idx is None:
             raise ValueError("No description available for %s" % device.type)
 
         # this looks unnecessarily complicated, but it handles the various
         # device types that we treat as disks
-        return self.target_descriptions[device_types[idx]]
+        return self.device_descriptions[device_types[idx]]
 
     def set_preferred_stage1_type(self, preferred):
         """ Set a preferred type of stage1 device. """
@@ -581,10 +580,14 @@ class BootLoader(object):
         if device is None:
             return False
 
-        try:
-            description = self.device_description(device)
-        except Exception:
-            description = self.stage1_description
+        description = self.device_description(device)
+        device_types = self.platform._boot_stage1_device_types
+        format_types = self.platform._boot_stage1_format_types
+        mountpoints = self.platform._boot_stage1_mountpoints
+        raid_levels = self.platform._boot_stage1_raid_levels
+        raid_member_types = self.platform._boot_stage1_raid_member_types
+        raid_metadata = self.platform._boot_stage1_raid_metadata
+        max_end_mb = self.platform._boot_stage1_max_end_mb
 
         if self.stage2_is_valid_stage1 and device == self.stage2_device:
             # special case
@@ -595,7 +598,7 @@ class BootLoader(object):
             self.warnings = []
             return valid
 
-        if not self._device_type_match(device, self.stage1_device_types):
+        if not self._device_type_match(device, device_types):
             self.errors.append(_("The %s cannot be of type %s")
                                % (description, device.type))
             valid = False
@@ -609,14 +612,14 @@ class BootLoader(object):
             valid = False
 
         if not self._is_valid_location(device,
-                                       max_mb=self.stage1_max_end_mb,
+                                       max_mb=max_end_mb,
                                        desc=description):
             valid = False
 
-        if not self._is_valid_md(device, device_types=self.stage1_device_types,
-                                 raid_levels=self.stage1_raid_levels,
-                                 metadata=self.stage1_raid_metadata,
-                                 member_types=self.stage1_raid_member_types,
+        if not self._is_valid_md(device, device_types=device_types,
+                                 raid_levels=raid_levels,
+                                 metadata=raid_metadata,
+                                 member_types=raid_member_types,
                                  desc=description):
             valid = False
 
@@ -629,8 +632,8 @@ class BootLoader(object):
             valid = False
 
         if not self._is_valid_format(device,
-                                     format_types=self.stage1_format_types,
-                                     mountpoints=self.stage1_mountpoints,
+                                     format_types=format_types,
+                                     mountpoints=mountpoints,
                                      desc=description):
             valid = False
 
@@ -651,9 +654,10 @@ class BootLoader(object):
             of all valid target devices, sorted by device type, then sorted
             according to our drive ordering.
         """
-        slots = [[] for t in self.stage1_device_types]
+        device_types = self.platform._boot_stage1_device_types
+        slots = [[] for t in device_types]
         for device in self.storage.devices:
-            idx = self._device_type_index(device, self.stage1_device_types)
+            idx = self._device_type_index(device, device_types)
             if idx is None:
                 continue
 
@@ -725,9 +729,10 @@ class BootLoader(object):
                                      desc=self.stage2_description):
             valid = False
 
+        non_linux_format_types = self.platform._non_linux_format_types
         if non_linux and \
            not self._is_valid_format(device,
-                                     format_types=self.non_linux_format_types):
+                                     format_types=non_linux_format_types):
             valid = False
 
         if not self.encryption_support and device.encrypted:
@@ -1010,27 +1015,13 @@ class GRUB(BootLoader):
     can_dual_boot = True
     can_update = True
 
-    # list of strings representing options for bootloader target device types
-    stage1_device_types = ["disk"]
-    stage1_raid_levels = []
-    stage1_format_types = []
-    stage1_mountpoints = []
-    stage1_device_disklabel_types = ["msdos", "gpt"]    # gpt?
-
     stage2_is_valid_stage1 = True
     stage2_bootable = True
 
-    target_descriptions = {"disk": N_("Master Boot Record"),
-                           "partition": N_("First sector of boot partition"),
-                           "mdarray": N_("RAID Device")}
-
     # list of strings representing options for boot device types
     stage2_device_types = ["partition", "mdarray"]
     stage2_raid_levels = [mdraid.RAID1]
 
-    # XXX hpfs, if reported by blkid/udev, will end up with a type of None
-    non_linux_format_types = ["vfat", "ntfs", "hpfs"]
-
     packages = ["grub"]
 
     def __init__(self, storage):
@@ -1342,25 +1333,10 @@ class EFIGRUB(GRUB):
     can_dual_boot = False
     _config_dir = "efi/EFI/redhat"
 
-    disklabel_types = ["gpt"]
-
-    # stage1 device types
-    stage1_device_types = ["partition", "mdarray"]
-    stage1_device_raid_levels = [mdraid.RAID1]
-    stage1_device_format_types = ["efi"]
-    stage1_device_mountpoints = ["/boot/efi"]
-
     stage2_is_valid_stage1 = False
     stage2_bootable = False
     stage2_max_end_mb = None
 
-    target_descriptions = {"partition": N_("EFI System Partition"),
-                           "mdarray": N_("RAID Device")}
-
-    stage1_description = target_descriptions["partition"]
-
-    non_linux_format_types = []
-
     def efibootmgr(self, *args, **kwargs):
         if kwargs.pop("capture", False):
             exec_func = iutil.execWithCapture
@@ -1474,8 +1450,6 @@ class GRUB2(GRUB):
     can_dual_boot = True
     can_update = True
 
-    disklabel_types = ["gpt", "msdos"]
-
     # requirements for boot devices
     stage2_device_types = ["partition", "mdarray", "lvmlv"]
     stage2_raid_levels = [mdraid.RAID0, mdraid.RAID1, mdraid.RAID4,
@@ -1671,16 +1645,10 @@ class Yaboot(YabootSILOBase):
     image_label_attr = "short_label"
     packages = ["yaboot"]
 
-    # requirements for bootloader stage1 devices
-    stage1_device_types = ["partition"]
-    stage1_format_types = ["appleboot", "prepboot"]
-
     # stage2 device requirements
     stage2_device_types = ["partition", "mdarray"]
     stage2_device_raid_levels = [mdraid.RAID1]
 
-    non_linux_format_types = ["hfs", "hfs+"]
-
     def __init__(self, storage):
         BootLoader.__init__(self, storage)
 
@@ -1764,14 +1732,6 @@ class Yaboot(YabootSILOBase):
 class IPSeriesYaboot(Yaboot):
     prog = "mkofboot"
 
-    disklabel_types = ["msdos"]
-
-    stage1_format_types = ["prepboot"]
-    stage1_max_end_mb = 10
-
-    target_descriptions = {"partition": N_("PReP Boot Partition"),
-                           "mdarray": N_("RAID Device")}
-
     #
     # configuration
     #
@@ -1785,13 +1745,6 @@ class MacYaboot(Yaboot):
     prog = "mkofboot"
     can_dual_boot = True
 
-    disklabel_types = ["mac"]
-
-    stage1_format_types = ["appleboot"]
-
-    target_descriptions = {"partition": N_("Apple Bootstrap Partition"),
-                           "mdarray": N_("RAID Device")}
-
     #
     # configuration
     #
@@ -1812,10 +1765,6 @@ class ZIPL(BootLoader):
     config_file = "/etc/zipl.conf"
     packages = ["s390utils-base"]
 
-    # stage1 device requirements
-    stage1_device_types = ["disk", "partition"]
-    stage1_device_disklabel_types = ["msdos", "dasd"]
-
     # stage2 device requirements
     stage2_device_types = ["partition", "mdarray", "lvmlv"]
     stage2_device_raid_levels = [mdraid.RAID1]
@@ -1888,8 +1837,6 @@ class SILO(YabootSILOBase):
     _config_file = "silo.conf"
     message_file = "/etc/silo.message"
 
-    disklabel_types = ["sun"]
-
     # stage1 device requirements
     stage1_device_types = ["disk"]
 
diff --git a/pyanaconda/iw/blpasswidget.py b/pyanaconda/iw/blpasswidget.py
index 49316df..b48fa45 100644
--- a/pyanaconda/iw/blpasswidget.py
+++ b/pyanaconda/iw/blpasswidget.py
@@ -31,7 +31,7 @@ class BootloaderPasswordWidget:
         self.parent = parent
         self.intf = anaconda.intf
 
-        self.password = anaconda.platform.bootloader.password
+        self.password = anaconda.bootloader.password
         if self.password:
             usePass = True
         else:
diff --git a/pyanaconda/iw/bootloader_main_gui.py b/pyanaconda/iw/bootloader_main_gui.py
index e6f5c4f..aa20161 100644
--- a/pyanaconda/iw/bootloader_main_gui.py
+++ b/pyanaconda/iw/bootloader_main_gui.py
@@ -97,11 +97,11 @@ class MainBootloaderWindow(InstallWindow):
 
         # XXX for md stage1, should we show md, first member disk, or first
         #     disk?
-        stage1 = anaconda.platform.bootLoaderDevice
+        stage1 = anaconda.storage.bootLoaderDevice
         stage1_desc = anaconda.bootloader.device_description(stage1)
         choices = {"mbr": (stage1, stage1_desc)}
 
-        stage2 = anaconda.platform.bootDevice
+        stage2 = anaconda.storage.bootDevice
         try:
             stage2_desc = anaconda.bootloader.device_description(stage2)
         except ValueError:
@@ -120,7 +120,7 @@ class MainBootloaderWindow(InstallWindow):
             w.set_active(self.bldev == device)
             w.set_data("bootDevice", device)
 
-        bl_disks = anaconda.platform.bootloader.drives
+        bl_disks = anaconda.bootloader.drives
         for i in range(1, 5):
             if len(self.driveorder) < i:
                 break
diff --git a/pyanaconda/iw/osbootwidget.py b/pyanaconda/iw/osbootwidget.py
index 4b66121..09fd6fd 100644
--- a/pyanaconda/iw/osbootwidget.py
+++ b/pyanaconda/iw/osbootwidget.py
@@ -24,6 +24,7 @@ import gobject
 from pyanaconda import iutil
 import parted
 from pyanaconda import gui
+from pyanaconda.bootloader import BootLoaderImage
 import datacombo
 from pyanaconda.constants import *
 from pyanaconda.storage.devices import devicePathToName
@@ -36,7 +37,7 @@ class OSBootWidget:
     """Widget to display OSes to boot and allow adding new ones."""
     
     def __init__(self, anaconda, parent):
-        self.bl = anaconda.platform.bootloader
+        self.bl = anaconda.bootloader
         self.storage = anaconda.storage
         self.parent = parent
         self.intf = anaconda.intf
@@ -288,7 +289,7 @@ class OSBootWidget:
         return model.get_value(iter, 3)
 
     def addEntry(self, widget, *args):
-        image = bootloader.BootLoaderImage(device=None, label=None)
+        image = BootLoaderImage(device=None, label=None)
         self.editOther(image)
 
     def deleteEntry(self, widget, *args):
diff --git a/pyanaconda/platform.py b/pyanaconda/platform.py
index c9d9218..93cd2f8 100644
--- a/pyanaconda/platform.py
+++ b/pyanaconda/platform.py
@@ -23,12 +23,14 @@
 import parted
 
 from pyanaconda import bootloader
+from pyanaconda.storage.devicelibs import mdraid
 
 import iutil
 from flags import flags
 
 import gettext
 _ = lambda x: gettext.ldgettext("anaconda", x)
+N_ = lambda x: x
 
 class Platform(object):
     """Platform
@@ -39,7 +41,22 @@ class Platform(object):
        throughout anaconda."""
     _minimumSector = 0
     _packages = []
+
     _bootloaderClass = bootloader.BootLoader
+    # requirements for bootloader stage1 devices
+    _boot_stage1_device_types = []
+    _boot_stage1_format_types = []
+    _boot_stage1_mountpoints = []
+    _boot_stage1_max_end_mb = None
+    _boot_stage1_raid_levels = []
+    _boot_stage1_raid_metadata = []
+    _boot_stage1_raid_member_types = []
+    _boot_stage1_description = N_("bootloader device")
+    _boot_raid_description = N_("RAID Device")
+    _boot_partition_description = N_("First sector of boot partition")
+    _boot_descriptions = {}
+
+    _disklabel_types = []
 
     def __init__(self, anaconda):
         """Creates a new Platform object.  This is basically an abstract class.
@@ -47,34 +64,11 @@ class Platform(object):
            returned by getPlatform below.  Not all subclasses need to provide
            all the methods in this class."""
         self.anaconda = anaconda
-        self.bootloader = self._bootloaderClass(storage=getattr(anaconda,
-                                                                "storage",
-                                                                None))
-
-    @property
-    def bootDevice(self):
-        """The device that includes the /boot filesystem."""
-        return self.bootloader.stage2_device
-
-    @property
-    def bootLoaderDevice(self):
-        """The device the bootloader will be installed into."""
-        return self.bootloader.stage1_device
-
-    @property
-    def bootFSTypes(self):
-        """A list of all valid filesystem types for the boot partition."""
-        return self.bootloader.stage2_format_types
-
-    @property
-    def defaultBootFSType(self):
-        """The default filesystem type for the boot partition."""
-        return self.bootFSTypes[0]
 
     @property
     def diskLabelTypes(self):
         """A list of valid disklabel types for this architecture."""
-        return self.bootloader.disklabel_types
+        return self._disklabel_types
 
     @property
     def defaultDiskLabelType(self):
@@ -100,33 +94,6 @@ class Platform(object):
 
         return labelType
 
-    def checkBootRequest(self):
-        """Perform an architecture-specific check on the boot device.  Not all
-           platforms may need to do any checks.  Returns a list of errors if
-           there is a problem, or [] otherwise."""
-        req = self.bootDevice
-        if not req:
-            return ([_("You have not created a bootable partition.")], [])
-
-        self.bootloader.is_valid_stage2_device(req)
-        errors = self.bootloader.errors
-        warnings = self.bootloader.warnings
-        return (errors, warnings)
-
-    def checkBootLoaderRequest(self):
-        """ Perform architecture-specific checks on the bootloader device.
-
-            Returns a list of error strings.
-        """
-        req = self.bootLoaderDevice
-        if not req:
-            return ([_("you have not created a bootloader stage1 target device")], [])
-
-        self.bootloader.is_valid_stage1_device(req)
-        errors = self.bootloader.errors
-        warnings = self.bootloader.warnings
-        return (errors, warnings)
-
     @property
     def minimumSector(self, disk):
         """Return the minimum starting sector for the provided disk."""
@@ -134,7 +101,7 @@ class Platform(object):
 
     @property
     def packages (self):
-        _packages = self._packages + self.bootloader.packages
+        _packages = self._packages
         if flags.cmdline.get('fips', None) == '1':
             _packages.append('dracut-fips')
         return _packages
@@ -142,8 +109,9 @@ class Platform(object):
     def setDefaultPartitioning(self):
         """Return the default platform-specific partitioning information."""
         from storage.partspec import PartSpec
-        return [PartSpec(mountpoint="/boot", fstype=self.defaultBootFSType, size=500,
-                         weight=self.weight(mountpoint="/boot"))]
+        return [PartSpec(mountpoint="/boot",
+                         fstype=self.anaconda.storage.defaultBootFSType,
+                         size=500, weight=self.weight(mountpoint="/boot"))]
 
     def weight(self, fstype=None, mountpoint=None):
         """ Given an fstype (as a string) or a mountpoint, return an integer
@@ -157,6 +125,16 @@ class Platform(object):
 
 class X86(Platform):
     _bootloaderClass = bootloader.GRUB2
+    _boot_stage1_device_types = ["disk"]
+    _boot_mbr_description = N_("Master Boot Record")
+    _boot_descriptions = {"disk": _boot_mbr_description,
+                          "partition": Platform._boot_partition_description,
+                          "mdarray": Platform._boot_raid_description}
+
+
+    _disklabel_types = ["gpt", "msdos"]
+    # XXX hpfs, if reported by blkid/udev, will end up with a type of None
+    _non_linux_format_types = ["vfat", "ntfs", "hpfs"]
 
     def setDefaultPartitioning(self):
         """Return the default platform-specific partitioning information."""
@@ -178,6 +156,18 @@ class X86(Platform):
 class EFI(Platform):
     _bootloaderClass = bootloader.EFIGRUB
 
+    _boot_stage1_format_types = ["efi"]
+    _boot_stage1_device_types = ["partition", "mdarray"]
+    _boot_stage1_raid_levels = [mdraid.RAID1]
+    _boot_stage1_raid_metadata = ["1.0"]
+    _boot_stage1_raid_member_types = ["partition"]
+    _boot_stage1_mountpoints = ["/boot/efi"]
+    _boot_efi_description = N_("EFI System Partition")
+    _boot_descriptions = {"partition": _boot_efi_description,
+                          "mdarray": Platform._boot_raid_description}
+
+    _disklabel_types = ["gpt"]
+
     def setDefaultPartitioning(self):
         from storage.partspec import PartSpec
         ret = Platform.setDefaultPartitioning(self)
@@ -197,6 +187,7 @@ class EFI(Platform):
 class PPC(Platform):
     _ppcMachine = iutil.getPPCMachine()
     _bootloaderClass = bootloader.Yaboot
+    _boot_stage1_device_types = ["partition"]
 
     @property
     def ppcMachine(self):
@@ -204,6 +195,11 @@ class PPC(Platform):
 
 class IPSeriesPPC(PPC):
     _bootloaderClass = bootloader.IPSeriesYaboot
+    _boot_stage1_format_types = ["prepboot"]
+    _boot_stage1_max_end_mb = 10
+    _boot_prep_description = N_("PReP Boot Partition")
+    _boot_descriptions = {"partition": _boot_prep_description}
+    _disklabel_types = ["msdos"]
 
     def setDefaultPartitioning(self):
         from storage.partspec import PartSpec
@@ -223,6 +219,11 @@ class IPSeriesPPC(PPC):
 
 class NewWorldPPC(PPC):
     _bootloaderClass = bootloader.MacYaboot
+    _boot_stage1_format_types = ["appleboot"]
+    _boot_apple_description = N_("Apple Bootstrap Partition")
+    _boot_descriptions = {"partition": _boot_apple_description}
+    _disklabel_types = ["mac"]
+    _non_linux_format_types = ["hfs", "hfs+"]
 
     def setDefaultPartitioning(self):
         from storage.partspec import PartSpec
@@ -246,6 +247,8 @@ class PS3(PPC):
 class S390(Platform):
     _bootloaderClass = bootloader.ZIPL
     _packages = ["s390utils"]
+    _disklabel_types = ["msdos", "dasd"]
+    _boot_stage1_device_types = ["disk", "partition"]
 
     def __init__(self, anaconda):
         Platform.__init__(self, anaconda)
@@ -253,7 +256,8 @@ class S390(Platform):
     def setDefaultPartitioning(self):
         """Return the default platform-specific partitioning information."""
         from storage.partspec import PartSpec
-        return [PartSpec(mountpoint="/boot", fstype=self.defaultBootFSType, size=500,
+        return [PartSpec(mountpoint="/boot", size=500,
+                         fstype=self.anaconda.storage.defaultBootFSType,
                          weight=self.weight(mountpoint="/boot"), asVol=True,
                          singlePV=True)]
 
@@ -266,6 +270,10 @@ class S390(Platform):
 
 class Sparc(Platform):
     _bootloaderClass = bootloader.SILO
+    _boot_stage1_format_types = []
+    _boot_stage1_mountpoints = []
+    _boot_stage1_max_end_mb = None
+    _disklabel_types = ["sun"]
 
     @property
     def minimumSector(self, disk):
diff --git a/pyanaconda/storage/__init__.py b/pyanaconda/storage/__init__.py
index 4fff7b1..25aef14 100644
--- a/pyanaconda/storage/__init__.py
+++ b/pyanaconda/storage/__init__.py
@@ -35,7 +35,6 @@ from pyanaconda import iutil
 from pyanaconda.constants import *
 from pykickstart.constants import *
 from pyanaconda.flags import flags
-from pyanaconda import platform
 
 from errors import *
 from devices import *
@@ -368,7 +367,6 @@ class Storage(object):
 
         self._nextID = 0
         self.defaultFSType = get_default_filesystem_type()
-        self.defaultBootFSType = get_default_filesystem_type(boot=True)
         self._dumpFile = "/tmp/storage.state"
 
         # these will both be empty until our reset method gets called
@@ -387,7 +385,7 @@ class Storage(object):
 
         # now set the boot partition's flag
         try:
-            boot = self.platform.bootDevice
+            boot = self.bootDevice
             if boot.type == "mdarray":
                 bootDevs = boot.parents
             else:
@@ -472,8 +470,8 @@ class Storage(object):
            hasattr(self.anaconda, "upgradeRoot"):
             self.anaconda.rootParts = None
             self.anaconda.upgradeRoot = None
-        if self.platform:
-            self.platform.bootloader.clear_drive_list()
+        if self.anaconda:
+            self.anaconda.bootloader.clear_drive_list()
         self.dumpState("initial")
         if w:
             w.pop()
@@ -1069,7 +1067,7 @@ class Storage(object):
         root = self.fsset.rootDevice
         swaps = self.fsset.swapDevices
         try:
-            boot = self.platform.bootDevice
+            boot = self.bootDevice
         except (DeviceError, AttributeError):
             # AttributeError means we have no anaconda or platform. it's ok.
             boot = None
@@ -1157,14 +1155,23 @@ class Storage(object):
             warnings.append(_("Installing on a FireWire device.  This may "
                               "or may not produce a working system."))
 
-        if self.platform and self.anaconda.dispatch.step_enabled('instbootloader'):
-            (e, w) = self.platform.checkBootRequest()
-            errors.extend(e)
-            warnings.extend(w)
+        if self.anaconda and self.anaconda.dispatch.step_enabled('instbootloader'):
+            stage1 = self.anaconda.bootloader.stage1_device
+            if not stage1:
+                errors.append(_("you have not created a bootloader stage1 "
+                                "target device"))
+            else:
+                self.anaconda.bootloader.is_valid_stage1_device(stage1)
+                errors.extend(self.anaconda.bootloader.errors)
+                warnings.extend(self.anaconda.bootloader.warnings)
 
-            (e, w) = self.platform.checkBootLoaderRequest()
-            errors.extend(e)
-            warnings.extend(w)
+            stage2 = self.anaconda.bootloader.stage2_device
+            if not stage2:
+                errors.append(_("You have not created a bootable partition."))
+            else:
+                self.anaconda.bootloader.is_valid_stage2_device(stage2)
+                errors.extend(self.anaconda.bootloader.errors)
+                warnings.extend(self.anaconda.bootloader.warnings)
 
         if not swaps:
             from pyanaconda.storage.size import Size
@@ -1297,6 +1304,36 @@ class Storage(object):
         self.fsset.createSwapFile(device, size)
 
     @property
+    def bootDevice(self):
+        dev = None
+        if self.anaconda:
+            dev = self.anaconda.bootloader.stage2_device
+        return dev
+
+    @property
+    def bootLoaderDevice(self):
+        dev = None
+        if self.anaconda:
+            dev = self.anaconda.bootloader.stage1_device
+        return dev
+
+    @property
+    def bootFSTypes(self):
+        """A list of all valid filesystem types for the boot partition."""
+        fstypes = []
+        if self.anaconda:
+            fstypes = self.anaconda.bootloader.stage2_format_types
+        return fstypes
+
+    @property
+    def defaultBootFSType(self):
+        """The default filesystem type for the boot partition."""
+        fstype = None
+        if self.anaconda:
+            fstype = self.bootFSTypes[0]
+        return fstype
+
+    @property
     def mountpoints(self):
         return self.fsset.mountpoints
 
diff --git a/pyanaconda/storage/formats/__init__.py b/pyanaconda/storage/formats/__init__.py
index 463ce20..9a468b9 100644
--- a/pyanaconda/storage/formats/__init__.py
+++ b/pyanaconda/storage/formats/__init__.py
@@ -48,15 +48,8 @@ def register_device_format(fmt_class):
                                                            fmt_class._type))
 
 default_fstypes = ("ext4", "ext3", "ext2")
-def get_default_filesystem_type(boot=None):
-    from pyanaconda import platform
-
-    if boot:
-        fstypes = [platform.getPlatform(None).defaultBootFSType]
-    else:
-        fstypes = default_fstypes
-
-    for fstype in fstypes:
+def get_default_filesystem_type():
+    for fstype in default_fstypes:
         try:
             supported = get_device_format_class(fstype).supported
         except AttributeError:
diff --git a/pyanaconda/storage/partitioning.py b/pyanaconda/storage/partitioning.py
index 79a7aee..709d174 100644
--- a/pyanaconda/storage/partitioning.py
+++ b/pyanaconda/storage/partitioning.py
@@ -117,19 +117,19 @@ def _schedulePartitions(storage, disks):
         if request.fstype is None:
             request.fstype = storage.defaultFSType
         elif request.fstype in ("prepboot", "efi") and \
-                storage.platform.bootLoaderDevice:
+                storage.bootLoaderDevice:
             # there should never be a need for more than one of these
             # partitions, so skip them.
             log.info("skipping unneeded stage1 request")
             continue
-        elif request.fstype == "biosboot":
-            boot_disk = storage.platform.bootloader.stage1_drive
+        elif request.fstype == "biosboot" and storage.anaconda:
+            boot_disk = storage.anaconda.bootloader.stage1_drive
             if boot_disk and boot_disk.format.labelType != "gpt":
                 # biosboot is only needed for gpt disklabels on non-efi x86
                 log.info("skipping bios boot request for msdos disklabel")
                 continue
 
-            gpt_check = getattr(storage.platform.bootloader,
+            gpt_check = getattr(storage.anaconda.bootloader,
                                 "_gpt_disk_has_bios_boot",
                                 None)
             if gpt_check and gpt_check(boot_disk):
@@ -918,7 +918,7 @@ def doPartitioning(storage, bootloader=None):
             part.req_size = part.req_base_size
 
     try:
-        storage.platform.bootDevice.req_bootable = True
+        storage.bootDevice.req_bootable = True
     except AttributeError:
         # there's no stage2 device. hopefully it's temporary.
         pass
@@ -980,7 +980,8 @@ def doPartitioning(storage, bootloader=None):
         storage.devicetree._addDevice(device)
 
     # make sure the stage1_device gets updated
-    storage.platform.bootloader.stage1_device = None
+    if storage.anaconda:
+        storage.anaconda.bootloader.stage1_device = None
 
 def allocatePartitions(storage, disks, partitions, freespace, bootloader=None):
     """ Allocate partitions based on requested features.
diff --git a/pyanaconda/yuminstall.py b/pyanaconda/yuminstall.py
index 905e317..e3afdff 100644
--- a/pyanaconda/yuminstall.py
+++ b/pyanaconda/yuminstall.py
@@ -1475,6 +1475,7 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon
             # New installs only - upgrades will already have all this stuff.
             self.selectBestKernel(anaconda)
             map(self.selectPackage, anaconda.platform.packages)
+            map(self.selectPackage, anaconda.bootloader.packages)
             self.selectFSPackages(anaconda.storage)
             self.selectAnacondaNeeds()
         else:
-- 
1.7.3.4

_______________________________________________
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