[anaconda][PATCH] Adapt to corrected interpetation of logvol --percent.

David Lehman dlehman at redhat.com
Thu Sep 18 21:58:40 UTC 2014


logvol --percent and --size are now mutually exclusive. Percent does
the same thing as size, but in terms of a percentage of the vg's free
free space (after all requests with sizes have been allocated, and before
any of them have been grown). A logvol defined with percent can still be
growable. In fact, that's a good idea since the percentage allocation
does not make any effort to allocate leftover extents after a
conservative calculation of the percentage-based sizes.

Resolves: rhbz#1116435
---
 pyanaconda/kickstart.py | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index 6487f2e..5ced283 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -755,7 +755,7 @@ class Lang(commands.lang.F19_Lang):
 # no overrides needed here
 Eula = commands.eula.F20_Eula
 
-class LogVol(commands.logvol.F20_LogVol):
+class LogVol(commands.logvol.F21_LogVol):
     def execute(self, storage, ksdata, instClass):
         for l in self.lvList:
             l.execute(storage, ksdata, instClass)
@@ -772,13 +772,16 @@ class LogVolData(commands.logvol.F20_LogVolData):
         # we might have truncated or otherwise changed the specified vg name
         vgname = ksdata.onPart.get(self.vgname, self.vgname)
 
-        try:
-            size = Size("%d MiB" % self.size)
-        except ValueError:
-            raise KickstartValueError(formatErrorMsg(self.lineno,
-                    msg="The size \"%s\" is invalid." % self.size))
-        except TypeError:
-            pass
+        if self.percent:
+            size = Size(0)
+        else:
+            try:
+                size = Size("%d MiB" % self.size)
+            except ValueError:
+                raise KickstartValueError(formatErrorMsg(self.lineno,
+                        msg="The size \"%s\" is invalid." % self.size))
+            except TypeError:
+                pass
 
         if self.mountpoint == "swap":
             ty = "swap"
-- 
1.9.3



More information about the anaconda-patches mailing list