Beispiel #1
0
    def setDefaultPartitioning(self, storage):
        autorequests = [
            PartSpec(mountpoint="/",
                     fstype=storage.default_fstype,
                     size=Size("2GiB"),
                     max_size=Size("15GiB"),
                     grow=True,
                     btr=True,
                     lv=True,
                     thin=True,
                     encrypted=True)
        ]

        bootreqs = platform.set_default_partitioning()
        if bootreqs:
            autorequests.extend(bootreqs)

        disk_space = getAvailableDiskSpace(storage)
        swp = swap_suggestion(disk_space=disk_space)
        autorequests.append(
            PartSpec(fstype="swap",
                     size=swp,
                     grow=False,
                     lv=True,
                     encrypted=True))

        for autoreq in autorequests:
            if autoreq.fstype is None:
                if autoreq.mountpoint == "/boot":
                    autoreq.fstype = storage.default_boot_fstype
                else:
                    autoreq.fstype = storage.default_fstype

        storage.autopart_requests = autorequests
Beispiel #2
0
    def createDefaultPartitioning(storage):
        autorequests = [PartSpec(mountpoint="/", fstype=storage.default_fstype,
                                 size=Size("2GiB"),
                                 max_size=Size("15GiB"),
                                 grow=True,
                                 # Allow one to pass in any of following for root partition
                                 # `autopart --type [partition|plain|btrfs|lvm|thinp] [--encrypted]`
                                 btr=True, lv=True, thin=True, encrypted=True)]

        bootreqs = platform.set_default_partitioning()
        if bootreqs:
            autorequests.extend(bootreqs)


        disk_space = getAvailableDiskSpace(storage)
        swp = swap_suggestion(disk_space=disk_space)
        autorequests.append(PartSpec(fstype="swap", size=swp, grow=False,
                                     lv=True, encrypted=True))

        for autoreq in autorequests:
            if autoreq.fstype is None:
                if autoreq.mountpoint == "/boot":
                    autoreq.fstype = storage.default_boot_fstype
                else:
                    autoreq.fstype = storage.default_fstype

        storage.autopart_requests = autorequests
Beispiel #3
0
    def complete_partitioning_requests_test(self):
        def get_fstype(mountpoint):
            if mountpoint == "/boot":
                return "ext4"

            return "xfs"

        storage = Mock()
        storage.get_fstype = get_fstype

        requests = _complete_partitioning_requests(
            storage, [PartSpec("/boot"), PartSpec("/")])
        self.assertEqual(["ext4", "xfs"], [spec.fstype for spec in requests])
    def get_partitioning_test(self, platform, suggest_swap_size):
        storage = create_storage()

        # Set the platform specs.
        platform.set_default_partitioning.return_value = [
            PartSpec(mountpoint="/boot", size=Size("1GiB"))
        ]

        # Set the file system type for /boot.
        storage._bootloader = Mock(stage2_format_types=["xfs"])

        # Set the swap size.
        suggest_swap_size.return_value = Size("1024MiB")

        # Collect the requests.
        requests = AutomaticPartitioningTask._get_partitioning(
            storage=storage, excluded_mount_points=["/home", "/boot", "swap"])

        self.assertEqual(["/"], [spec.mountpoint for spec in requests])

        requests = AutomaticPartitioningTask._get_partitioning(
            storage=storage, excluded_mount_points=[])

        self.assertEqual(["/boot", "/", "/home", None],
                         [spec.mountpoint for spec in requests])
        self.assertEqual(["xfs", "ext4", "ext4", "swap"],
                         [spec.fstype for spec in requests])
        self.assertEqual(
            [Size("1GiB"),
             Size("1GiB"),
             Size("500MiB"),
             Size("1024MiB")], [spec.size for spec in requests])
Beispiel #5
0
    def filter_all_default_partitioning_test(self, proxy_getter):
        proxy = Mock()
        proxy_getter.return_value = proxy

        proxy.NoHome = True
        proxy.NoBoot = True
        proxy.NoSwap = True

        requests = _filter_default_partitions([
            PartSpec("/boot"),
            PartSpec("/"),
            PartSpec("/home"),
            PartSpec(fstype="swap")
        ])

        self.assertEqual(["/"], [spec.mountpoint for spec in requests])
Beispiel #6
0
 def set_default_partitioning(self):
     ret = ARM.set_default_partitioning(self)
     ret.append(
         PartSpec(mountpoint="/",
                  fstype="ext4",
                  size=Size("2GiB"),
                  max_size=Size("3GiB")))
     return ret
Beispiel #7
0
    def get_default_partitioning_test(self, platform):
        platform.set_default_partitioning.return_value = [PartSpec("/boot")]

        requests = get_default_partitioning(PartitioningType.WORKSTATION)
        self.assertEqual(["/boot", "/", "/home", None], [spec.mountpoint for spec in requests])

        requests = get_default_partitioning(PartitioningType.SERVER)
        self.assertEqual(["/boot", "/", None], [spec.mountpoint for spec in requests])
Beispiel #8
0
 def set_platform_bootloader_reqs(self):
     ret = super().set_platform_bootloader_reqs()
     ret.append(
         PartSpec(mountpoint="/boot/efi",
                  fstype="macefi",
                  size=Size("200MiB"),
                  max_size=Size("600MiB"),
                  grow=True))
     return ret
Beispiel #9
0
    def setDefaultPartitioning(self, storage):
        autorequests = [
            PartSpec(mountpoint="/",
                     fstype=storage.default_fstype,
                     size=Size("6GiB"),
                     thin=True,
                     grow=True,
                     lv=True),
            PartSpec(mountpoint="/home",
                     fstype=storage.default_fstype,
                     size=Size("1GiB"),
                     thin=True,
                     lv=True),
            PartSpec(mountpoint="/tmp",
                     fstype=storage.default_fstype,
                     size=Size("1GiB"),
                     thin=True,
                     lv=True),
            PartSpec(mountpoint="/var",
                     fstype=storage.default_fstype,
                     size=Size("15GiB"),
                     thin=True,
                     lv=True),
            PartSpec(mountpoint="/var/log",
                     fstype=storage.default_fstype,
                     size=Size("8GiB"),
                     thin=True,
                     lv=True),
            PartSpec(mountpoint="/var/log/audit",
                     fstype=storage.default_fstype,
                     size=Size("2GiB"),
                     thin=True,
                     lv=True)
        ]

        bootreqs = platform.set_default_partitioning()
        if bootreqs:
            autorequests.extend(bootreqs)

        disk_space = getAvailableDiskSpace(storage)
        swp = swap_suggestion(disk_space=disk_space)
        autorequests.append(
            PartSpec(fstype="swap",
                     size=swp,
                     grow=False,
                     lv=True,
                     encrypted=True))

        for autoreq in autorequests:
            if autoreq.fstype is None:
                if autoreq.mountpoint == "/boot":
                    autoreq.fstype = storage.default_boot_fstype
                    autoreq.size = Size("1GiB")
                else:
                    autoreq.fstype = storage.default_fstype

        storage.autopart_requests = autorequests
        storage.autopart_type = AUTOPART_TYPE_LVM_THINP
Beispiel #10
0
 def set_platform_bootloader_reqs(self):
     """Return the ARM-OMAP platform-specific partitioning information."""
     ret = [
         PartSpec(mountpoint="/boot/uboot",
                  fstype="vfat",
                  size=Size("20MiB"),
                  max_size=Size("200MiB"),
                  grow=True)
     ]
     return ret
Beispiel #11
0
 def set_platform_bootloader_reqs(self):
     ret = PPC.set_platform_bootloader_reqs(self)
     ret.append(PartSpec(fstype="prepboot", size=Size("4MiB")))
     return ret
Beispiel #12
0
 def set_platform_bootloader_reqs(self):
     """Return the default platform-specific partitioning information."""
     ret = super().set_platform_bootloader_reqs()
     ret.append(PartSpec(fstype="biosboot", size=Size("1MiB")))
     return ret
Beispiel #13
0
 def set_platform_boot_partition(self):
     """Return the default /boot partition for this platform."""
     return [PartSpec(mountpoint="/boot", size=Size("1GiB"))]
Beispiel #14
0
 def get_platform_specific_partitioning_test(self):
     requests = _get_platform_specific_partitioning(Platform(),
                                                    [PartSpec("/")])
     self.assertEqual(["/boot", "/"],
                      [spec.mountpoint for spec in requests])
Beispiel #15
0
 def set_platform_bootloader_reqs(self):
     ret = super().set_platform_bootloader_reqs()
     ret.append(PartSpec(fstype="appleboot", size=Size("1MiB")))
     return ret
Beispiel #16
0
 def set_platform_boot_partition(self):
     """Return the default platform-specific partitioning information."""
     return [PartSpec(mountpoint="/boot", size=Size("1GiB"), lv=False)]
Beispiel #17
0
from blivet.size import Size

from pyanaconda.core.configuration.anaconda import conf
from pyanaconda.core.configuration.storage import PartitioningType
from pyanaconda.core.constants import STORAGE_SWAP_IS_RECOMMENDED

from pyanaconda.modules.common.constants.objects import AUTO_PARTITIONING
from pyanaconda.modules.common.constants.services import STORAGE
from pyanaconda.storage.partspec import PartSpec

# Partitioning requirements for servers.
SERVER_PARTITIONING = [
    PartSpec(mountpoint="/",
             size=Size("2GiB"),
             max_size=Size("15GiB"),
             grow=True,
             btr=True,
             lv=True,
             thin=True,
             encrypted=True),
    PartSpec(fstype="swap", grow=False, lv=True, encrypted=True)
]

# Partitioning requirements for workstations.
WORKSTATION_PARTITIONING = [
    PartSpec(mountpoint="/",
             size=Size("1GiB"),
             max_size=Size("50GiB"),
             grow=True,
             btr=True,
             lv=True,
             thin=True,