Re: [rhel6-branch] [PATCH] Show proper message when we cannot allocate enough space for / and swap

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

 



On Fri, 2012-04-27 at 12:07 +0200, Vratislav Podzimek wrote:
> We try to create swap big enough for hibernation in autopartioning,
> but this can be a problem on machines with a lot of RAM and small disks.
> Since we shouldn't create swap not enough big for hibernation, just
> let users know they should use custom partitioning in such cases.
> 
> Resolves: rhbz#815557
> 
> <not-in-commit-message>
> This patch means that we don't need flexible swap suggestions, agreed?
> </not-in-commit-message>

I don't even care if we have flexible suggestions, but if you remove the
ranges, you should remove the code that is only there to accommodate the
ranges.

> ---
>  storage/partitioning.py |   17 ++++++++++++++++-
>  1 files changed, 16 insertions(+), 1 deletions(-)
> 
> diff --git a/storage/partitioning.py b/storage/partitioning.py
> index b038c23..d8a5a6a 100644
> --- a/storage/partitioning.py
> +++ b/storage/partitioning.py
> @@ -1716,7 +1716,22 @@ def growLVM(storage):
>          if total_free < 0:
>              # by now we have allocated the PVs so if there isn't enough
>              # space in the VG we have a real problem
> -            raise PartitioningError("not enough space for LVM requests")
> +
> +            # if we cannot allocate enough space for / and swap, show
> +            # proper error message
> +            swap_plus_root = 0
> +            for lv in vg.lvs:
> +                if lv.format.type == "swap" or lv.format.mountpoint == "/":
> +                    swap_plus_root += lv.minSize

You should sum up lv.req_size values. minSize is the minimum size for
existing devices or filesystems and is used as a lower bound for resize.

> +
> +            additional_msg = ""
> +            if swap_plus_root > vg.size:
> +                additional_msg = "\n\nCannot allocate enough space for / "\
> +                                 "and swap big enough to allow hibernation.\n"\
> +                                 "Use custom partitioning, please."
> +
> +            raise PartitioningError("not enough space for LVM requests" +
> +                                    additional_msg)

This will get triggered for cases other than the one you are describing.
Perhaps you should add a check that swap is the same size as ram?

>          elif not total_free:
>              log.debug("vg %s has no free space" % vg.name)
>              continue


_______________________________________________
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