Checking for ram to early...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hey people :)

Anaconda exits if the system has less than 64 Mb of ram.  This is logical because if the system has less, its just not possible to install.  But I think we are not giving the power user the opportunity to circumvent this situation. see (368311).  What I suggest is to make the check after the running of the post script.  If the user was intelligent enough to add some temporary swap, anaconda should install successfully.

patch attached, comments appreciated.

--
Joel Andres Granados
Red Hat / Brno, Czech Republic
diff --git a/anaconda b/anaconda
index f241448..29862ec 100755
--- a/anaconda
+++ b/anaconda
@@ -425,7 +425,7 @@ def runVNC(vncStartedCB=None):
             iutil.execConsole()
 
 def checkMemory(opts):
-    if iutil.memInstalled() < isys.MIN_RAM:
+    if iutil.memInstalled() + iutil.swapInstalled() < isys.MIN_RAM:
         from snack import SnackScreen, ButtonChoiceWindow
 
         screen = SnackScreen()
@@ -441,7 +441,7 @@ def checkMemory(opts):
 
     # override display mode if machine cannot nicely run X
     if not flags.test:
-        if iutil.memInstalled() < isys.MIN_GUI_RAM:
+        if iutil.memInstalled() + iutil.swapInstalled() < isys.MIN_GUI_RAM:
             stdoutLog.warning(_("You do not have enough RAM to use the graphical "
                                 "installer.  Starting text mode."))
             opts.display_mode = 't'
@@ -834,8 +834,6 @@ if __name__ == "__main__":
     log.info("Display mode = %s" %(opts.display_mode,))
     log.info("Method = %s" %(anaconda.methodstr,))
 
-    checkMemory(opts)
-
     # this lets install classes force text mode instlls
     if instClass.forceTextMode:
         stdoutLog.info(_("Install class forcing text mode installation"))
@@ -968,6 +966,8 @@ if __name__ == "__main__":
     anaconda.id.setDisplayMode(opts.display_mode)
     instClass.setInstallData(anaconda)
 
+    checkMemory(opts)
+
     anaconda.setDispatch()
 
     # download and run Dogtail script
diff --git a/iutil.py b/iutil.py
index 2483e0c..80d6497 100644
--- a/iutil.py
+++ b/iutil.py
@@ -224,6 +224,21 @@ def memInstalled():
 
     return int(mem)
 
+## Get the amount of swap in the system.
+# @return The amount of installed Swap.
+def swapInstalled():
+    f = open("/proc/meminfo", "r")
+    lines = f.readlines()
+    f.close()
+
+    for l in lines:
+        if l.startswith("SwapTotal:"):
+            fields = string.split(l)
+            mem = fields[1]
+            break
+
+    return int(mem)
+
 ## Suggest the size of the swap partition that will be created.
 # @param quiet Should size information be logged?
 # @return A tuple of the minimum and maximum swap size, in megabytes.
diff --git a/loader2/loader.c b/loader2/loader.c
index d00c174..f6887c6 100644
--- a/loader2/loader.c
+++ b/loader2/loader.c
@@ -983,22 +983,6 @@ static int checkFrameBuffer() {
 }
 #endif
 
-
-/* make sure they have enough ram */
-static void checkForRam(void) {
-    if (totalMemory() < MIN_RAM) {
-        char *buf;
-        int i;
-        i = asprintf(&buf, _("You do not have enough RAM to install %s "
-                             "on this machine."), getProductName());
-        startNewt();
-        newtWinMessage(_("Error"), _("OK"), buf);
-        free(buf);
-        stopNewt();
-        exit(0);
-    }
-}
-
 static int haveDeviceOfType(int type) {
     struct device ** devices;
 
@@ -1665,8 +1649,6 @@ int main(int argc, char ** argv) {
     }
     initializeConsole();
 
-    checkForRam();
-
     /* iSeries vio console users will be ssh'ing in to the primary
        partition, so use a terminal type that is appripriate */
     if (isVioConsole())
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux