[anaconda] Create and use free space snapshot for swap suggestion (#1132436)
Brian C. Lane
bcl at redhat.com
Thu Aug 28 23:49:32 UTC 2014
On Thu, Aug 28, 2014 at 05:54:26PM +0200, Vratislav Podzimek wrote:
> Otherwise when creating swap on an LV there's no free space on the disk by that
> time, because it is occupied by the LV's VG's PV.
was confused by 'snapshot' at first, thinking it was related to LVM
snapshots :) Maybe say - "snapshot free space before partitioning" or
something like that.
>
> Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
> ---
> pyanaconda/kickstart.py | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
> index 95252a7..fc180ae 100644
> --- a/pyanaconda/kickstart.py
> +++ b/pyanaconda/kickstart.py
> @@ -210,7 +210,7 @@ def getAvailableDiskSpace(storage):
> """
>
>
> - free_space = storage.getFreeSpace()
> + free_space = storage.freeSpaceSnapshot
> return int(sum(disk_free.convertTo("MiB") for disk_free, fs_free in free_space.values()))
>
> def refreshAutoSwapSize(storage):
> @@ -749,6 +749,7 @@ class LogVolData(commands.logvol.F20_LogVolData):
> vgname = ksdata.onPart.get(self.vgname, self.vgname)
>
> if self.mountpoint == "swap":
> + import pdb; pdb.set_trace()
That's going to make things way more interactive than we want :p
> type = "swap"
> self.mountpoint = ""
> if self.recommended or self.hibernation:
> @@ -1778,6 +1779,10 @@ def doKickstartStorage(storage, ksdata, instClass):
> if not any(d for d in storage.disks
> if not d.format.hidden and not d.protected):
> return
> +
> + # snapshot free space now so that we know how much we had avaiable
> + storage.createFreeSpaceSnapshot()
> +
Does this work correctly with the multitude of partitioning schemes? eg.
What if there are pre-existing partitions but clearpart --all is used in
the kickstart?
> ksdata.bootloader.execute(storage, ksdata, instClass)
> ksdata.autopart.execute(storage, ksdata, instClass)
> ksdata.partition.execute(storage, ksdata, instClass)
--
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)
More information about the anaconda-patches
mailing list