加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
bugfix-Check-if-original-partitions-are-mounted-too.patch 2.81 KB
一键复制 编辑 原始数据 按行查看 历史
xuxiaolong 提交于 2021-04-02 10:25 . sync 49 fixbug from github
From 6515d0779a41c1ea902ada86e4e911821cded92e Mon Sep 17 00:00:00 2001
From: Vladimir Slavik <vslavik@redhat.com>
Date: Thu, 3 Sep 2020 19:27:28 +0200
Subject: [PATCH] Check if original partitions are mounted, too
Resolves: rhbz#1751698
---
pyanaconda/modules/storage/checker/utils.py | 30 +++++++++++++++------
1 file changed, 22 insertions(+), 8 deletions(-)
diff --git a/pyanaconda/modules/storage/checker/utils.py b/pyanaconda/modules/storage/checker/utils.py
index ff3ee3a6b..c40aa1dc3 100644
--- a/pyanaconda/modules/storage/checker/utils.py
+++ b/pyanaconda/modules/storage/checker/utils.py
@@ -417,11 +417,15 @@ def verify_luks2_memory_requirements(storage, constraints, report_error, report_
def verify_mounted_partitions(storage, constraints, report_error, report_warning):
""" Check the selected disks to make sure all their partitions are unmounted.
+ Check both the currently known and original partitions.
+
:param storage: a storage to check
:param constraints: a dictionary of constraints
:param report_error: a function for error reporting
:param report_warning: a function for warning reporting
"""
+ partitions_to_check = {}
+
for disk in storage.disks:
if disk.protected:
continue
@@ -430,14 +434,24 @@ def verify_mounted_partitions(storage, constraints, report_error, report_warning
continue
for part in disk.format.partitions:
- part_dev = storage.devicetree.get_device_by_path(part.path)
- if part_dev and part_dev.protected:
- log.debug("Not checking protected %s for being mounted, assuming live "
- "image mount", part.path)
- continue
- if part.busy:
- report_error(_("%s is currently mounted and cannot be used for the "
- "installation. Please unmount it and retry.") % part.path)
+ if part.path not in partitions_to_check:
+ partitions_to_check[part.path] = part
+
+ if hasattr(disk.original_format, "partitions"):
+ for part in disk.original_format.partitions:
+ if part.path not in partitions_to_check:
+ partitions_to_check[part.path] = part
+
+ for path, part in partitions_to_check.items():
+ part_dev = storage.devicetree.get_device_by_path(path)
+ if part_dev and part_dev.protected:
+ log.debug("Not checking protected %s for being mounted, assuming live "
+ "image mount", path)
+ return
+
+ if part.busy:
+ report_error(_("%s is currently mounted and cannot be used for the "
+ "installation. Please unmount it and retry.") % path)
def verify_lvm_destruction(storage, constraints, report_error, report_warning):
--
2.23.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化