1 Star 0 Fork 105

王策/anaconda

forked from src-openEuler/anaconda 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
bugfix-Fix-creating-cached-LVs-on-encrypted-PVs.patch 2.57 KB
一键复制 编辑 原始数据 按行查看 历史
xuxiaolong 提交于 2021-04-02 10:25 . sync 49 fixbug from github
From 373da9db5d1c7d138f87abfb69165bd9de413a41 Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Mon, 13 Jul 2020 14:53:42 +0200
Subject: [PATCH] Fix creating cached LVs on encrypted PVs
We need to get the child device for encrypted PVs because the PV
devices from kickstart are the underlying partitions, not the
lvmpv formatted LUKS devices.
Resolves: rhbz#1855973
---
.../partitioning/custom/custom_partitioning.py | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/pyanaconda/modules/storage/partitioning/custom/custom_partitioning.py b/pyanaconda/modules/storage/partitioning/custom/custom_partitioning.py
index 754a48e2e..17c125dd6 100644
--- a/pyanaconda/modules/storage/partitioning/custom/custom_partitioning.py
+++ b/pyanaconda/modules/storage/partitioning/custom/custom_partitioning.py
@@ -851,6 +851,16 @@ class CustomPartitioningTask(NonInteractivePartitioningTask):
if data.logvol.lvList:
grow_lvm(storage)
+ def _get_cache_pv_devices(self, devicetree, logvol_data):
+ pv_devices = []
+ for pvname in logvol_data.cache_pvs:
+ pv = lookup_alias(devicetree, pvname)
+ if pv.format.type == "luks":
+ pv_devices.append(pv.children[0])
+ else:
+ pv_devices.append(pv)
+ return pv_devices
+
def _execute_logvol_data(self, storage, data, logvol_data):
"""Execute the logvol data.
@@ -927,7 +937,7 @@ class CustomPartitioningTask(NonInteractivePartitioningTask):
# If cache PVs specified, check that they belong to the same VG this LV is a member of
if logvol_data.cache_pvs:
- pv_devices = (lookup_alias(devicetree, pv) for pv in logvol_data.cache_pvs)
+ pv_devices = self._get_cache_pv_devices(devicetree, logvol_data)
if not all(pv in vg.pvs for pv in pv_devices):
raise KickstartParseError(
_("Cache PVs must belong to the same VG as the cached LV"),
@@ -1096,7 +1106,7 @@ class CustomPartitioningTask(NonInteractivePartitioningTask):
maxsize = None
if logvol_data.cache_size and logvol_data.cache_pvs:
- pv_devices = [lookup_alias(devicetree, pv) for pv in logvol_data.cache_pvs]
+ pv_devices = self._get_cache_pv_devices(devicetree, logvol_data)
cache_size = Size("%d MiB" % logvol_data.cache_size)
cache_mode = logvol_data.cache_mode or None
cache_request = LVMCacheRequest(cache_size, pv_devices, cache_mode)
--
2.23.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wangce1988/anaconda.git
git@gitee.com:wangce1988/anaconda.git
wangce1988
anaconda
anaconda
master

搜索帮助