First, no longer mention the 2.4 kernel. That was only for people updating
from RHL. Second, use the iutil swap suggestion instead of coming up with
a different one. This means we'll suggest the same amount on upgrade that
we would use on a fresh install.
---
pyanaconda/iw/upgrade_swap_gui.py | 16 +++-----------
pyanaconda/upgrade.py | 40 ++++++------------------------------
2 files changed, 11 insertions(+), 45 deletions(-)
diff --git a/pyanaconda/iw/upgrade_swap_gui.py b/pyanaconda/iw/upgrade_swap_gui.py
index b57d071..ddb8735 100644
--- a/pyanaconda/iw/upgrade_swap_gui.py
+++ b/pyanaconda/iw/upgrade_swap_gui.py
@@ -89,18 +89,12 @@ class UpgradeSwapWindow (InstallWindow):
box = gtk.VBox (False, 5)
box.set_border_width (5)
- label = gtk.Label (_("Recent kernels (2.4 or newer) need significantly more "
- "swap than older kernels, up to twice "
- "the amount of RAM on the system. "
- "You currently have %dMB of swap configured, but "
- "you may create additional swap space on one of "
- "your file systems now.")
- % (iutil.swapAmount() / 1024) +
- _("\n\nThe installer has detected %s MB of RAM.\n") %
- (iutil.memInstalled()/1024))
+ label = gtk.Label(_("You currently have %dMB of swap configured, which "
+ "is less than the recommended miminum of %sMB. You "
+ "may optionally create more swap space on one of "
+ "your file systems now.") % (iutil.swapAmount()/1024, iutil.swapSuggestion()[0]/1024))
label.set_alignment (0.5, 0.0)
-# label.set_size_request(400, 200)
label.set_line_wrap (True)
box.pack_start(label, False)
@@ -115,7 +109,6 @@ class UpgradeSwapWindow (InstallWindow):
self.swapbox = gtk.VBox(False, 5)
box.pack_start(self.swapbox, False)
-
label = gui.MnemonicLabel (_("Select the _partition to put the swap file on:"))
a = gtk.Alignment(0.2, 0.5)
@@ -201,7 +194,6 @@ class UpgradeSwapWindow (InstallWindow):
return rc
def swapTooBig(self):
-
rc = self.intf.messageWindow(_("Warning"),
_("There is not enough space on the device you "
"selected for the swap partition."),
diff --git a/pyanaconda/upgrade.py b/pyanaconda/upgrade.py
index b3560dd..51b25bf 100644
--- a/pyanaconda/upgrade.py
+++ b/pyanaconda/upgrade.py
@@ -165,32 +165,12 @@ def restoreTime(anaconda):
# returns None if no more swap is needed
def upgradeSwapSuggestion(anaconda):
- # mem is in kb -- round it up to the nearest 4Mb
- mem = iutil.memInstalled()
- rem = mem % 16384
- if rem:
- mem = mem + (16384 - rem)
- mem = mem / 1024
+ swap = iutil.swapAmount()/1024
+ (suggestedMin, suggestedMax) = iutil.swapSuggestion(quiet=1)
anaconda.dispatch.skipStep("addswap", 0)
-
- # don't do this if we have more then 250 MB
- if mem > 250:
- anaconda.dispatch.skipStep("addswap", 1)
- return
-
- swap = iutil.swapAmount() / 1024
-
- # if we have twice as much swap as ram and at least 192 megs
- # total, we're safe
- if (swap >= (mem * 1.5)) and (swap + mem >= 192):
- anaconda.dispatch.skipStep("addswap", 1)
- return
-
- # if our total is 512 megs or more, we should be safe
- if (swap + mem >= 512):
- anaconda.dispatch.skipStep("addswap", 1)
- return
+ if suggestedMin <= swap:
+ anaconda.dispatch.skipStep("addswap", permanent=1)
fsList = []
@@ -205,18 +185,12 @@ def upgradeSwapSuggestion(anaconda):
info = (device, space)
fsList.append(info)
- suggestion = mem * 2 - swap
- if (swap + mem + suggestion) < 192:
- suggestion = 192 - (swap + mem)
- if suggestion < 32:
- suggestion = 32
- suggSize = 0
- suggMnt = None
+ suggDev = None
for (device, size) in fsList:
- if (size > suggSize) and (size > (suggestion + 100)):
+ if size > suggestedMin+100:
suggDev = device
- anaconda.upgradeSwapInfo = (fsList, suggestion, suggDev)
+ anaconda.upgradeSwapInfo = (fsList, suggestedMin, suggDev)
# XXX handle going backwards
def upgradeMountFilesystems(anaconda):
--
1.7.4.1