[PATCH] Add support for thin pool profile specification in kickstart

Vratislav Podzimek vpodzime at redhat.com
Fri Sep 19 13:45:16 UTC 2014


Related: rhbz#869456
Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
 pyanaconda/kickstart.py | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index 07d08e9..f345ff1 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -21,7 +21,7 @@
 from pyanaconda.errors import ScriptError, errorHandler
 from blivet.deviceaction import ActionCreateFormat, ActionDestroyFormat, ActionResizeDevice, ActionResizeFormat
 from blivet.devices import LUKSDevice
-from blivet.devicelibs.lvm import getPossiblePhysicalExtents, LVM_PE_SIZE
+from blivet.devicelibs.lvm import getPossiblePhysicalExtents, LVM_PE_SIZE, KNOWN_THPOOL_PROFILES
 from blivet.devicelibs import swap as swap_lib
 from blivet.formats import getFormat
 from blivet.partitioning import doPartitioning
@@ -744,7 +744,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.RHEL7_LogVol):
     def execute(self, storage, ksdata, instClass):
         for l in self.lvList:
             l.execute(storage, ksdata, instClass)
@@ -752,7 +752,7 @@ class LogVol(commands.logvol.F20_LogVol):
         if self.lvList:
             growLVM(storage)
 
-class LogVolData(commands.logvol.F20_LogVolData):
+class LogVolData(commands.logvol.RHEL7_LogVolData):
     def execute(self, storage, ksdata, instClass):
         devicetree = storage.devicetree
 
@@ -890,11 +890,19 @@ class LogVolData(commands.logvol.F20_LogVolData):
             else:
                 parents = [vg]
 
+            pool_args = {}
             if self.thin_pool:
-                pool_args = { "metadatasize": Size("%d MiB" % self.metadata_size),
-                              "chunksize": Size("%d KiB" % self.chunk_size) }
-            else:
-                pool_args = {}
+                if self.profile:
+                    matching = (p for p in KNOWN_THPOOL_PROFILES if p.name == self.profile)
+                    profile = next(matching, None)
+                    if profile:
+                        pool_args["profile"] = profile
+
+                if self.metadata_size:
+                    pool_args["metadatasize"] = Size("%d MiB" % self.metadata_size)
+
+                if self.chunk_size:
+                    pool_args["chunksize"] = Size("%d KiB" % self.chunk_size)
 
             if self.maxSizeMB:
                 try:
-- 
1.9.3



More information about the anaconda-patches mailing list