Exemple #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
Exemple #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
Exemple #3
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
Exemple #4
0
def verify_swap(storage, constraints, report_error, report_warning):
    """ Verify the existence of swap.

    :param storage: a storage to check
    :param constraints: a dictionary of constraints
    :param report_error: a function for error reporting
    :param report_warning: a function for warning reporting
    """
    swaps = storage.fsset.swap_devices

    if not swaps:
        installed = util.total_memory()
        required = Size(
            "%s MiB" % (constraints[STORAGE_MIN_RAM] + isys.NO_SWAP_EXTRA_RAM))

        if not constraints[STORAGE_SWAP_IS_RECOMMENDED]:
            if installed < required:
                report_warning(
                    _("You have not specified a swap partition. "
                      "%(requiredMem)s of memory is recommended to continue "
                      "installation without a swap partition, but you only "
                      "have %(installedMem)s.") % {
                          "requiredMem": required,
                          "installedMem": installed
                      })
        else:
            if installed < required:
                report_error(
                    _("You have not specified a swap partition. "
                      "%(requiredMem)s of memory is required to continue "
                      "installation without a swap partition, but you only "
                      "have %(installedMem)s.") % {
                          "requiredMem": required,
                          "installedMem": installed
                      })
            else:
                report_warning(
                    _("You have not specified a swap partition. "
                      "Although not strictly required in all cases, "
                      "it will significantly improve performance "
                      "for most installations."))

    else:
        swap_space = sum((device.size for device in swaps), Size(0))
        disk_space = sum(
            (device.size for device in storage.mountpoints.values()), Size(0))
        recommended = swap_suggestion(disk_space=disk_space, quiet=True)

        log.debug("Total swap space: %s", swap_space)
        log.debug("Used disk space: %s", disk_space)
        log.debug("Recommended swaps space: %s", recommended)

        if swap_space < recommended:
            report_warning(
                _("Your swap space is less than %(size)s "
                  "which is lower than recommended.") % {"size": recommended})