[PATCH 2/2] Make storage sanity check aware of base RAM requirements (#1123466)
Vratislav Podzimek
vpodzime at redhat.com
Tue Jul 29 12:04:01 UTC 2014
Minimum RAM requirements depend on the installation mode (GUI/TUI) so the
storage sanity check needs a parameter telling it what the current minimum RAM
requirement is.
Replace the use of the EARLY_SWAP_RAM constant (removed in the commit
0f200d705b6f167abc29cf93bdac13fa1bbaf6c4) with the NO_SWAP_EXTRA_RAM that has a
better name and gives the right information independent on tthe installation
mode.
Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
pyanaconda/isys/__init__.py | 1 +
pyanaconda/storage_utils.py | 7 +++++--
pyanaconda/ui/gui/spokes/custom.py | 7 ++++---
pyanaconda/ui/gui/spokes/storage.py | 3 ++-
pyanaconda/ui/helpers.py | 6 ++++--
5 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/pyanaconda/isys/__init__.py b/pyanaconda/isys/__init__.py
index 29e9b24..44f6144 100644
--- a/pyanaconda/isys/__init__.py
+++ b/pyanaconda/isys/__init__.py
@@ -54,6 +54,7 @@ else:
MIN_GUI_RAM = MIN_RAM + GUI_INSTALL_EXTRA_RAM
SQUASHFS_EXTRA_RAM = 750
+NO_SWAP_EXTRA_RAM = 200
## Flush filesystem buffers.
def sync ():
diff --git a/pyanaconda/storage_utils.py b/pyanaconda/storage_utils.py
index f49cec0..1d3bf5e 100644
--- a/pyanaconda/storage_utils.py
+++ b/pyanaconda/storage_utils.py
@@ -147,7 +147,7 @@ class SanityWarning(SanityException):
class LUKSDeviceWithoutKeyError(SanityError):
pass
-def sanity_check(storage):
+def sanity_check(storage, min_ram=isys.MIN_RAM):
"""
Run a series of tests to verify the storage configuration.
@@ -155,6 +155,9 @@ def sanity_check(storage):
we can make sure you don't have anything silly (like no /,
a really small /, etc).
+ :param storage: an instance of the :class:`blivet.Blivet` class to check
+ :param min_ram: minimum RAM (in MiB) needed for the installation with swap
+ space available
:rtype: a list of SanityExceptions
:return: a list of accumulated errors and warnings
@@ -270,7 +273,7 @@ def sanity_check(storage):
if not swaps:
installed = util.total_memory()
- required = Size("%s KiB" % isys.EARLY_SWAP_RAM)
+ required = Size("%s MiB" % (min_ram + isys.NO_SWAP_EXTRA_RAM))
if installed < required:
exns.append(
diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
index e0a78b8..99e874e 100644
--- a/pyanaconda/ui/gui/spokes/custom.py
+++ b/pyanaconda/ui/gui/spokes/custom.py
@@ -37,6 +37,7 @@ from pyanaconda.threads import AnacondaThread, threadMgr
from pyanaconda.constants import THREAD_EXECUTE_STORAGE, THREAD_STORAGE, THREAD_CUSTOM_STORAGE_INIT
from pyanaconda.iutil import lowerASCII
from pyanaconda.bootloader import BootLoaderError
+from pyanaconda import isys
from blivet import devicefactory
from blivet.formats import device_formats
@@ -69,7 +70,7 @@ from pyanaconda import storage_utils
from pyanaconda.ui.communication import hubQ
from pyanaconda.ui.gui.spokes import NormalSpoke
-from pyanaconda.ui.gui.spokes.storage import StorageChecker
+from pyanaconda.ui.helpers import StorageChecker
from pyanaconda.ui.gui.spokes.lib.cart import SelectedDisksDialog
from pyanaconda.ui.gui.spokes.lib.passphrase import PassphraseDialog
from pyanaconda.ui.gui.spokes.lib.accordion import updateSelectorFromDevice, Accordion, Page, CreateNewPage, UnknownPage
@@ -133,7 +134,7 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
title = N_("MANUAL PARTITIONING")
def __init__(self, data, storage, payload, instclass):
- StorageChecker.__init__(self)
+ StorageChecker.__init__(self, min_ram=isys.MIN_GUI_RAM)
NormalSpoke.__init__(self, data, storage, payload, instclass)
self._back_already_clicked = False
@@ -2209,7 +2210,7 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
self._storage_playground.doAutoPart = False
log.debug("finished automatic partitioning")
- exns = storage_utils.sanity_check(self._storage_playground)
+ exns = storage_utils.sanity_check(self._storage_playground, min_ram=isys.MIN_GUI_RAM)
errors = [exn for exn in exns if isinstance(exn, SanityError) and not isinstance(exn, LUKSDeviceWithoutKeyError)]
warnings = [exn for exn in exns if isinstance(exn, SanityWarning)]
for error in errors:
diff --git a/pyanaconda/ui/gui/spokes/storage.py b/pyanaconda/ui/gui/spokes/storage.py
index aab3acf..479537b 100644
--- a/pyanaconda/ui/gui/spokes/storage.py
+++ b/pyanaconda/ui/gui/spokes/storage.py
@@ -67,6 +67,7 @@ from pyanaconda.product import productName
from pyanaconda.flags import flags
from pyanaconda.i18n import _, C_, CN_, P_
from pyanaconda import constants
+from pyanaconda import isys
from pyanaconda.bootloader import BootLoaderError
from pykickstart.constants import CLEARPART_TYPE_NONE, AUTOPART_TYPE_LVM
@@ -227,7 +228,7 @@ class StorageSpoke(NormalSpoke, StorageChecker):
title = CN_("GUI|Spoke", "INSTALLATION _DESTINATION")
def __init__(self, *args, **kwargs):
- StorageChecker.__init__(self)
+ StorageChecker.__init__(self, min_ram=isys.MIN_GUI_RAM)
NormalSpoke.__init__(self, *args, **kwargs)
self.applyOnSkip = True
diff --git a/pyanaconda/ui/helpers.py b/pyanaconda/ui/helpers.py
index e688a99..e6654b9 100644
--- a/pyanaconda/ui/helpers.py
+++ b/pyanaconda/ui/helpers.py
@@ -61,6 +61,7 @@ from pyanaconda import constants
from pyanaconda.threads import threadMgr, AnacondaThread
from pyanaconda.ui.communication import hubQ
from pyanaconda.i18n import _
+from pyanaconda import isys
import logging
import copy
@@ -72,8 +73,9 @@ class StorageChecker(object):
errors = []
warnings = []
- def __init__(self, mainSpokeClass="StorageSpoke"):
+ def __init__(self, min_ram=isys.MIN_RAM, mainSpokeClass="StorageSpoke"):
self._mainSpokeClass = mainSpokeClass
+ self._min_ram = min_ram
@abstractproperty
def storage(self):
@@ -90,7 +92,7 @@ class StorageChecker(object):
hubQ.send_not_ready(self._mainSpokeClass)
hubQ.send_message(self._mainSpokeClass, _("Checking storage configuration..."))
- exns = sanity_check(self.storage)
+ exns = sanity_check(self.storage, min_ram=self._min_ram)
errors = [exn.message for exn in exns if isinstance(exn, SanityError)]
warnings = [exn.message for exn in exns if isinstance(exn, SanityWarning)]
(StorageChecker.errors, StorageChecker.warnings) = (errors, warnings)
--
1.9.3
More information about the anaconda-patches
mailing list