[PATCH] Check host filesystem space for dirinstall
Vratislav Podzimek
vpodzime at redhat.com
Tue Jun 24 07:00:19 UTC 2014
On Mon, 2014-06-23 at 15:54 -0700, Brian C. Lane wrote:
> This fixes using --dirinstall in GUI mode. The space check was failing
> since storage is totally skipped and nothing is mounted. This adds a
> check class that will check the host system's filesystem size instead.
> ---
> pyanaconda/ui/gui/hubs/summary.py | 8 ++++++--
> pyanaconda/ui/lib/space.py | 34 +++++++++++++++++++++++++++++++++-
> 2 files changed, 39 insertions(+), 3 deletions(-)
>
> diff --git a/pyanaconda/ui/gui/hubs/summary.py b/pyanaconda/ui/gui/hubs/summary.py
> index fe7eeb1..2615377 100644
> --- a/pyanaconda/ui/gui/hubs/summary.py
> +++ b/pyanaconda/ui/gui/hubs/summary.py
> @@ -20,7 +20,8 @@
> #
>
> from pyanaconda.ui.gui.hubs import Hub
> -from pyanaconda.ui.lib.space import FileSystemSpaceChecker
> +from pyanaconda.ui.lib.space import FileSystemSpaceChecker, DirInstallSpaceChecker
> +from pyanaconda.flags import flags
>
> __all__ = ["SummaryHub"]
>
> @@ -53,7 +54,10 @@ class SummaryHub(Hub):
> """
> super(SummaryHub, self).__init__(data, storage, payload, instclass)
>
> - self._checker = FileSystemSpaceChecker(storage, payload)
> + if not flags.dirInstall:
> + self._checker = FileSystemSpaceChecker(storage, payload)
> + else:
> + self._checker = DirInstallSpaceChecker(storage, payload)
>
> @property
> def continueButton(self):
> diff --git a/pyanaconda/ui/lib/space.py b/pyanaconda/ui/lib/space.py
> index 8583eff..4a804ae 100644
> --- a/pyanaconda/ui/lib/space.py
> +++ b/pyanaconda/ui/lib/space.py
> @@ -18,8 +18,9 @@
> #
> # Red Hat Author(s): David Lehman <dlehman at redhat.com>
> #
> -
> +import os
> from blivet.size import Size
> +from pyanaconda import iutil
>
> from pyanaconda.i18n import _, N_
>
> @@ -80,3 +81,34 @@ class FileSystemSpaceChecker(object):
> self.error_message = _(self.error_template) % self.deficit
>
> return self.success
> +
> +class DirInstallSpaceChecker(FileSystemSpaceChecker):
> + """Use the amount of space available at ROOT_PATH to calculate free space.
> +
> + This is used for the --dirinstall option where no storage is mounted and it
> + is using space from the host's filesystem.
> + """
> + def check(self):
> + """Check configured storage against software selections. When this
> + method is complete (which should be pretty quickly), the following
> + attributes are available for inspection:
> +
> + success -- A simple boolean defining whether there's enough
> + space or not.
> + deficit -- If unsuccessful, how much space the system is
> + short for current software selections (in MB).
How hard would it be to have self.deficit a Size instance instead of
just a plain number? I'd really like to avoid any "in MB"/"in KB"/"in
MiB" specification in all new code we add.
Other than that this looks like a nice and simple idea so ACK.
--
Vratislav Podzimek
Anaconda Rider | RHCE | Red Hat, Inc. | Brno - Czech Republic
More information about the anaconda-patches
mailing list