[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]

 



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>
---
 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
+
+            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)
         elif not total_free:
             log.debug("vg %s has no free space" % vg.name)
             continue
-- 
1.7.4.4

_______________________________________________
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