If user specifies we should create an LV as a cached LV, we need to transform the parameters in to a CacheRequest instance and pass it to blivet to create a new LV as cached.
This PR requires the [blivet's PR #190] (https://github.com/rhinstaller/blivet/pull/190) to be merged first and the appropriate bump of the required version of blivet will be done before this gets pushed.
From: Vratislav Podzimek vpodzime@redhat.com
If user specifies we should create an LV as a cached LV, we need to transform the parameters in to a CacheRequest instance and pass it to blivet to create a new LV as cached. --- pyanaconda/kickstart.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py index 31c5382..e00dd08 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.devices.lvm import LVMVolumeGroupDevice +from blivet.devices.lvm import LVMVolumeGroupDevice, LVMCacheRequest from blivet.devicelibs.lvm import LVM_PE_SIZE, KNOWN_THPOOL_PROFILES from blivet.devicelibs.crypto import MIN_CREATE_ENTROPY from blivet.formats import getFormat @@ -1005,6 +1005,15 @@ def execute(self, storage, ksdata, instClass): else: maxsize = None
+ if self.cache_size and self.cache_pvs: + pv_devices = (lookupAlias(devicetree, pv) for pv in self.cache_pvs) + pv_devices_names = [pv.name for pv in pv_devices] + cache_size = Size("%d MiB" % self.cache_size) + cache_mode = self.cache_mode or None + cache_request = LVMCacheRequest(cache_size, pv_devices_names, cache_mode) + else: + cache_request = None + try: request = storage.newLV(fmt=fmt, name=self.name, @@ -1015,6 +1024,7 @@ def execute(self, storage, ksdata, instClass): grow=self.grow, maxsize=maxsize, percent=self.percent, + cacheRequest=cache_request, **pool_args) except (StorageError, ValueError) as e: raise KickstartValueError(formatErrorMsg(self.lineno, msg=str(e)))
Looks good to me
Added label: ACK.
anaconda-patches@lists.fedorahosted.org