def _do_autopart(storage, scheme, requests, encrypted=False, luks_fmt_args=None): """Perform automatic partitioning. :param storage: an instance of Blivet :param scheme: a type of the partitioning scheme :param requests: list of partitioning requests :param encrypted: encrypt the scheduled partitions :param luks_fmt_args: arguments for the LUKS format constructor """ log.debug("scheme: %s", scheme) log.debug("requests:\n%s", "".join([str(p) for p in requests])) log.debug("encrypted: %s", encrypted) log.debug("storage.disks: %s", [d.name for d in storage.disks]) log.debug("storage.partitioned: %s", [d.name for d in storage.partitioned if d.format.supported]) log.debug("all names: %s", [d.name for d in storage.devices]) log.debug("boot disk: %s", getattr(storage.bootloader.stage1_disk, "name", None)) disks = get_candidate_disks(storage) log.debug("candidate disks: %s", [d.name for d in disks]) devs = schedule_implicit_partitions(storage, disks, scheme, encrypted, luks_fmt_args) devs = schedule_partitions(storage, disks, devs, scheme, requests, encrypted, luks_fmt_args) # run the autopart function to allocate and grow partitions do_partitioning(storage) schedule_volumes(storage, devs, scheme, requests, encrypted) # grow LVs grow_lvm(storage) # only newly added swaps should appear in the fstab new_swaps = (dev for dev in storage.swaps if not dev.format.exists) storage.set_fstab_swaps(new_swaps)
def _execute_logvol(self, storage, data): """Execute the logvol command. :param storage: an instance of the Blivet's storage object :param data: an instance of kickstart data """ for logvol_data in data.logvol.lvList: self._execute_logvol_data(storage, data, logvol_data) if data.logvol.lvList: grow_lvm(storage)
def _do_autopart(self, storage, scheme, requests, encrypted=False, luks_fmt_args=None): """Perform automatic partitioning. :param storage: an instance of Blivet :param scheme: a type of the partitioning scheme :param requests: list of partitioning requests :param encrypted: encrypt the scheduled partitions :param luks_fmt_args: arguments for the LUKS format constructor """ log.debug("scheme: %s", scheme) log.debug("requests:\n%s", "".join([str(p) for p in requests])) log.debug("encrypted: %s", encrypted) log.debug("storage.disks: %s", [d.name for d in storage.disks]) log.debug("storage.partitioned: %s", [d.name for d in storage.partitioned if d.format.supported]) log.debug("all names: %s", [d.name for d in storage.devices]) log.debug("boot disk: %s", getattr(storage.bootloader.stage1_disk, "name", None)) if not any(d.format.supported for d in storage.partitioned): raise NoDisksError(_("No usable disks selected")) disks = get_candidate_disks(storage) devs = schedule_implicit_partitions(storage, disks, scheme, encrypted, luks_fmt_args) log.debug("candidate disks: %s", disks) log.debug("devs: %s", devs) if not disks: raise NotEnoughFreeSpaceError(_("Not enough free space on disks for " "automatic partitioning")) devs = schedule_partitions(storage, disks, devs, scheme, requests, encrypted, luks_fmt_args) # run the autopart function to allocate and grow partitions do_partitioning(storage) schedule_volumes(storage, devs, scheme, requests, encrypted) # grow LVs grow_lvm(storage) # only newly added swaps should appear in the fstab new_swaps = (dev for dev in storage.swaps if not dev.format.exists) storage.set_fstab_swaps(new_swaps)
def do_autopart(storage, data, min_luks_entropy=None): """ Perform automatic partitioning. :param storage: a :class:`pyanaconda.storage.InstallerStorage` instance :type storage: :class:`pyanaconda.storage.InstallerStorage` :param data: kickstart data :type data: :class:`pykickstart.BaseHandler` :param min_luks_entropy: minimum entropy in bits required for luks format creation; uses default when None :type min_luks_entropy: int :attr:`Blivet.do_autopart` controls whether this method creates the automatic partitioning layout. :attr:`Blivet.autopart_type` controls which variant of autopart used. It uses one of the pykickstart AUTOPART_TYPE_* constants. The set of eligible disks is defined in :attr:`StorageDiscoveryConfig.clear_part_disks`. .. note:: Clearing of partitions is handled separately, in :meth:`pyanaconda.storage.InstallerStorage.clear_partitions`. """ # pylint: disable=unused-argument log.debug("do_autopart: %s", storage.do_autopart) log.debug("encrypted_autopart: %s", storage.encrypted_autopart) log.debug("autopart_type: %s", storage.autopart_type) log.debug("clear_part_type: %s", storage.config.clear_part_type) log.debug("clear_part_disks: %s", storage.config.clear_part_disks) log.debug("autopart_requests:\n%s", "".join([str(p) for p in storage.autopart_requests])) log.debug("storage.disks: %s", [d.name for d in storage.disks]) log.debug("storage.partitioned: %s", [d.name for d in storage.partitioned if d.format.supported]) log.debug("all names: %s", [d.name for d in storage.devices]) log.debug("boot disk: %s", getattr(storage.bootloader.stage1_disk, "name", None)) if not storage.do_autopart: return if not any(d.format.supported for d in storage.partitioned): raise NoDisksError(_("No usable disks selected")) if min_luks_entropy is not None: luks_data.min_entropy = min_luks_entropy disks = _get_candidate_disks(storage) devs = _schedule_implicit_partitions(storage, disks) log.debug("candidate disks: %s", disks) log.debug("devs: %s", devs) if disks == []: raise NotEnoughFreeSpaceError( _("Not enough free space on disks for " "automatic partitioning")) devs = _schedule_partitions(storage, disks, devs) # run the autopart function to allocate and grow partitions do_partitioning(storage) _schedule_volumes(storage, devs) # grow LVs grow_lvm(storage) storage.set_up_bootloader() # only newly added swaps should appear in the fstab new_swaps = (dev for dev in storage.swaps if not dev.format.exists) storage.set_fstab_swaps(new_swaps)
def do_autopart(storage, data, min_luks_entropy=None): """ Perform automatic partitioning. :param storage: a :class:`pyanaconda.storage.InstallerStorage` instance :type storage: :class:`pyanaconda.storage.InstallerStorage` :param data: kickstart data :type data: :class:`pykickstart.BaseHandler` :param min_luks_entropy: minimum entropy in bits required for luks format creation; uses default when None :type min_luks_entropy: int :attr:`Blivet.do_autopart` controls whether this method creates the automatic partitioning layout. :attr:`Blivet.autopart_type` controls which variant of autopart used. It uses one of the pykickstart AUTOPART_TYPE_* constants. The set of eligible disks is defined in :attr:`StorageDiscoveryConfig.clear_part_disks`. .. note:: Clearing of partitions is handled separately, in :meth:`pyanaconda.storage.InstallerStorage.clear_partitions`. """ # pylint: disable=unused-argument log.debug("do_autopart: %s", storage.do_autopart) log.debug("encrypted_autopart: %s", storage.encrypted_autopart) log.debug("autopart_type: %s", storage.autopart_type) log.debug("clear_part_type: %s", storage.config.clear_part_type) log.debug("clear_part_disks: %s", storage.config.clear_part_disks) log.debug("autopart_requests:\n%s", "".join([str(p) for p in storage.autopart_requests])) log.debug("storage.disks: %s", [d.name for d in storage.disks]) log.debug("storage.partitioned: %s", [d.name for d in storage.partitioned if d.format.supported]) log.debug("all names: %s", [d.name for d in storage.devices]) log.debug("boot disk: %s", getattr(storage.bootloader.stage1_disk, "name", None)) if not storage.do_autopart: return if not any(d.format.supported for d in storage.partitioned): raise NoDisksError(_("No usable disks selected")) if min_luks_entropy is not None: luks_data.min_entropy = min_luks_entropy disks = _get_candidate_disks(storage) devs = _schedule_implicit_partitions(storage, disks) log.debug("candidate disks: %s", disks) log.debug("devs: %s", devs) if disks == []: raise NotEnoughFreeSpaceError(_("Not enough free space on disks for " "automatic partitioning")) devs = _schedule_partitions(storage, disks, devs) # run the autopart function to allocate and grow partitions do_partitioning(storage) _schedule_volumes(storage, devs) # grow LVs grow_lvm(storage) storage.set_up_bootloader() # only newly added swaps should appear in the fstab new_swaps = (dev for dev in storage.swaps if not dev.format.exists) storage.set_fstab_swaps(new_swaps)