diff options
| -rwxr-xr-x | anaconda | 37 | ||||
| -rw-r--r-- | isys/isys.c | 1 | ||||
| -rw-r--r-- | isys/isys.h | 5 | ||||
| -rwxr-xr-x | isys/isys.py | 1 |
4 files changed, 34 insertions, 10 deletions
@@ -349,24 +349,42 @@ def runVNC(): sys.stdin.readline() iutil.execConsole() -def checkMemory(anaconda): - if iutil.memInstalled() < isys.MIN_RAM: - from snack import SnackScreen, ButtonChoiceWindow +def within_available_memory(needed_ram): + # kernel binary code estimate that is + # not reported in MemTotal by /proc/meminfo: + epsilon = 15360 # 15 MB + return needed_ram < (iutil.memInstalled() + epsilon) + +def check_memory(anaconda, opts, display_mode=None): + + if not display_mode: + display_mode = anaconda.displayMode + + extra_ram = 0 + reason = '' + if opts.stage2.startswith(('http', 'ftp', '@')): + extra_ram += isys.URL_INSTALL_EXTRA_RAM + reason = " using this install method" + needed_ram = isys.MIN_RAM + extra_ram + if not within_available_memory(needed_ram): + from snack import SnackScreen, ButtonChoiceWindow screen = SnackScreen() ButtonChoiceWindow(screen, _('Fatal Error'), _('You do not have enough RAM to install %s ' - 'on this machine.\n' + 'on this machine%s.\n' '\n' 'Press <return> to reboot your system.\n') - %(product.productName,), + %(product.productName, reason), buttons = (_("OK"),)) screen.finish() sys.exit(0) # override display mode if machine cannot nicely run X - if not flags.usevnc: - if anaconda.displayMode not in ('t', 'c') and iutil.memInstalled() < isys.MIN_GUI_RAM: + if display_mode not in ('t', 'c') and not flags.usevnc: + needed_ram = isys.MIN_GUI_RAM + extra_ram + + if not within_available_memory(needed_ram): complain = _("You do not have enough RAM to use the graphical " "installer.") if flags.livecdInstall: @@ -546,6 +564,9 @@ if __name__ == "__main__": (opts, args) = parseOptions() + # check memory, just the text mode for now: + check_memory(anaconda, opts, 't') + if opts.unsupportedMode: stdoutLog.error("Running anaconda in %s mode is no longer supported." % opts.unsupportedMode) sys.exit(0) @@ -741,7 +762,7 @@ if __name__ == "__main__": log.info("Display mode = %s" % anaconda.displayMode) log.info("Default encoding = %s " % sys.getdefaultencoding()) - checkMemory(anaconda) + check_memory(anaconda, opts) # # now determine if we're going to run in GUI or TUI mode diff --git a/isys/isys.c b/isys/isys.c index 6b49ba625..409170b29 100644 --- a/isys/isys.c +++ b/isys/isys.c @@ -313,6 +313,7 @@ void init_isys(void) { PyDict_SetItemString(d, "MIN_RAM", PyInt_FromLong(MIN_RAM)); PyDict_SetItemString(d, "MIN_GUI_RAM", PyInt_FromLong(MIN_GUI_RAM)); + PyDict_SetItemString(d, "URL_INSTALL_EXTRA_RAM", PyInt_FromLong(URL_INSTALL_EXTRA_RAM)); PyDict_SetItemString(d, "EARLY_SWAP_RAM", PyInt_FromLong(EARLY_SWAP_RAM)); } diff --git a/isys/isys.h b/isys/isys.h index 265dc7760..e3cb1fca5 100644 --- a/isys/isys.h +++ b/isys/isys.h @@ -20,8 +20,9 @@ #ifndef H_ISYS #define H_ISYS -#define MIN_RAM 131072 -#define MIN_GUI_RAM 393216 +#define MIN_RAM 262144 // 256 MB +#define MIN_GUI_RAM 524288 // 512 MB +#define URL_INSTALL_EXTRA_RAM 131072 // 128 MB #define EARLY_SWAP_RAM 524288 #define OUTPUT_TERMINAL "/dev/tty5" diff --git a/isys/isys.py b/isys/isys.py index b16c8e4e0..38eafe791 100755 --- a/isys/isys.py +++ b/isys/isys.py @@ -61,6 +61,7 @@ mountCount = {} MIN_RAM = _isys.MIN_RAM MIN_GUI_RAM = _isys.MIN_GUI_RAM +URL_INSTALL_EXTRA_RAM = _isys.URL_INSTALL_EXTRA_RAM EARLY_SWAP_RAM = _isys.EARLY_SWAP_RAM ## Get the amount of free space available under a directory path. |
