[anaconda] Create and use free space snapshot for swap suggestion (#1132436)
Vratislav Podzimek
vpodzime at redhat.com
Thu Aug 28 15:54:26 UTC 2014
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.
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()
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()
+
ksdata.bootloader.execute(storage, ksdata, instClass)
ksdata.autopart.execute(storage, ksdata, instClass)
ksdata.partition.execute(storage, ksdata, instClass)
--
1.9.3
More information about the anaconda-patches
mailing list