[master 1/1] Add basic support for LVM cache creation in kickstart
vpodzime
installerbot-noreply at redhat.com
Tue Aug 4 14:31:31 UTC 2015
From: Vratislav Podzimek <vpodzime at 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 | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index 31c5382..fac3842 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,14 @@ 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]
+ cache_size = Size("%d MiB" % self.cache_size)
+ cache_mode = self.cache_mode or None
+ cache_request = LVMCacheRequest(cache_size, pv_devices, cache_mode)
+ else:
+ cache_request = None
+
try:
request = storage.newLV(fmt=fmt,
name=self.name,
@@ -1015,6 +1023,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)))
--
To view this commit on github, visit https://github.com/rhinstaller/anaconda/commit/a93932365d946777815f0d8e576d794fbc2db73e
More information about the anaconda-patches
mailing list