Show proper message when we cannot allocate enough space for / and swap
On Fri, 2012-04-27 at 13:02 -0500, David Lehman wrote:
> 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
Do we want to make such a change on the rhel6-branch? I'd rather leave
it there and change this only on master.
> > ---
> > 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.
I've checked that and req_size for / was about 50 GB even when I had 5
GB virtual drive. So that would be triggered almost every time.
> > +
> > + additional_msg = ""
> > + if swap_plus_root > vg.size:
> > + additional_msg = "
Cannot allocate enough space for / "
> > + "and swap big enough to allow hibernation.
> > + "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?
Good point, thanks.
Vratislav Podzimek <firstname.lastname@example.org>
Anaconda-devel-list mailing list